Skip to content

Instantly share code, notes, and snippets.

View blacklight's full-sized avatar

Fabio Manganiello blacklight

View GitHub Profile
n = 1
t = 0
doubling_time = 2.4
days = 60
while True:
n *= 2
t += doubling_time
print(f'day={t} n={n}')
if t > days:
# /start command handler
event.hook.OnTelegramStartCmd:
if:
type: platypush.message.event.chat.telegram.CommandMessageEvent
command: start
then:
- action: chat.telegram.send_message
args:
chat_id: ${chat_id}
text: "Welcome! Type /help to see the available commands"
# Hue lights configuration
light.hue:
# Hue bridge IP address
bridge: 192.168.1.10
# Default groups to control
groups:
- Living Room
# MPD/Mopidy configuration
chat.telegram:
api_token: <your bot token>
backend.chat.telegram:
enabled: true
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Play the music when you say "play the music".
# Note the regex support: this hook will be triggered whether you
# say "play the music" or "play music".
event.hook.PlayMusicAssistantCommand:
if:
type: platypush.message.event.assistant.SpeechRecognizedEvent
phrase: "play (the)? music"
then:
- action: music.mpd.play
event.hook.OnSensorData:
if:
type: platypush.message.event.sensor.SensorDataChangeEvent
then:
- if ${data.get('ir') == 'code1'}:
- action: music.mpd.play
- if ${data.get('ir') == 'code2'}:
- action: music.mpd.pause
- if ${data.get('ir') == 'code3'}:
- action: music.mpd.stop
@blacklight
blacklight / IRrecv.ino
Last active October 22, 2019 11:06
Infrared receiver sketch for Arduino
#include <IRremote.h>
#define IR_REPEAT 0xFFFFFFFF
const int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned int latest_value = 0;