Skip to content

Instantly share code, notes, and snippets.

@dgomes
dgomes / filter.py
Created February 13, 2018 03:02
Filter Component for Home Assistant
"""
Support for filtering for sensor values.
Example config:
sensor:
- platform: filter
entity_id: sensor.outside_temperature
For more details about this platform, please refer to the documentation at
@dgomes
dgomes / sql.py
Created February 1, 2018 01:12
Home Assistant SQL Sensor
"""
Sensor from an SQL Query.
Example usage:
sensor:
- platform: sql
db_url: mysql://user:password@localhost/
queries:
- name: DB size
@dgomes
dgomes / main.py
Last active July 31, 2019 08:51
Workshop TTN - Movimento Maker Portugal
import pycom
from network import LoRa
import time
import binascii
import socket
from machine import Pin
from onewire import DS18X20
from onewire import OneWire
@dgomes
dgomes / mediaroom.py
Last active February 12, 2022 21:36
MediaRoom - Home Assistant Media Player Component
"""
Support for the Mediaroom Set-up-box.
WORK IN PROGRESS!!!
You need to place this file in ~/.homeassistant/custom_components/media_player
and install pymediaroom:
pip install pymediaroom

Keybase proof

I hereby claim:

  • I am dgomes on github.
  • I am dgomes (https://keybase.io/dgomes) on keybase.
  • I have a public key ASBgFdBhQ-0Pu2KwDErpLo0g7Rg6bheDuhNP8m4oiY2T7Qo

To claim this, I am signing this object:

@dgomes
dgomes / HeatingMonitor.ino
Created January 23, 2017 22:48
Arduino sketch with 2 DS18S20 sensors and a RF433 OOK transmitter to monitor the temperature of water tanks
#include <DallasTemperature.h>
#include <OneWire.h>
#include <RCSwitch.h>
OneWire ds(12);
DallasTemperature sensors(&ds);
DeviceAddress prh, aqs;
typedef uint8_t ScratchPad[9];
@dgomes
dgomes / GreenHouseProtocol.h
Last active August 29, 2015 14:07
Greenhouse Source Code
#ifndef GREENHOUSEPROTOCOL_H
#define GREENHOUSEPROTOCOL_H
#include <Arduino.h>
typedef enum { GH_GETDATA = 0, GH_ONSWITCH = 1, GH_OFFSWITCH = 2 } gh_command;
struct GHCommandPacket {
gh_command cmd;
};
@dgomes
dgomes / iRemotuino
Created July 5, 2012 17:00
Remote IR and RF Control for Sony TV and Chacon Ref:54656
/*
* iRemotuino - Remote IR and RF Control for Sony TV and Chacon Ref:54656
* Diogo Gomes <[email protected]>
* Copyright 2012
*/
#include <IRremote.h> //http://github.com/shirriff/Arduino-IRremot
#include <RemoteTransmitter.h> //https://bitbucket.org/fuzzillogic/433mhzforarduino
IRsend irsend;
@dgomes
dgomes / miau
Created April 30, 2012 17:39
How to encode a video to play on a STB
ffmpeg -i $1 -scodec copy -vcodec libx264 -vprofile high -preset slow -b:v 800k -maxrate 800k -bufsize 2000k -threads 16 -acodec libfaac -ac 2 -ab 128k -vol 400 -f mp4 -an -pass 1 -y /dev/null
ffmpeg -i $1 -scodec copy -vcodec libx264 -vprofile high -preset slow -b:v 800k -maxrate 800k -bufsize 2000k -threads 16 -acodec libfaac -ac 2 -ab 128k -vol 400 -f mp4 -pass 2 -y $1.tmp
qt-faststart $1.tmp $1.m4v