This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
### Get one or more true random numbers using the qrng.anu.edu.au quantum | |
### random number generator through the available API | |
### Author: Fabio <BlackLight> Manganiello | |
import argparse | |
import json | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import logging | |
import nfc | |
import ndef | |
import sys | |
import time | |
from redis import Redis | |
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type":"request", | |
"action":"light.hue.on", | |
"args": { | |
"groups": [ | |
"Living Room", | |
"Bathroom" | |
] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from platypush.context import get_plugin | |
response = get_plugin('light.hue').on(groups=['Living Room', 'Bathroom']) | |
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cURL example | |
curl -XPOST -H 'Content-Type: application/json' \ | |
-d '{"type":"request", "action":"light.hue.on", "args": {"groups": ["Living Room", "Bedroom"]}}' \ | |
http://localhost:8008/execute | |
# HTTPie example | |
echo '{"type":"request", "action":"light.hue.on", "args": {"groups": ["Living Room", "Bedroom"]}}' | http http://localhost:8008/execute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type":"request", | |
"action":"light.hue.get_lights" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "6e5383cee53e8330afc5dfb9bde12a25", | |
"type": "response", | |
"target": "http", | |
"origin": "your_server_name", | |
"_timestamp": 1564154465.715452, | |
"response": { | |
"output": { | |
"1": { | |
"state": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Play a specific radio on the mpd (or mopidy) plugin | |
event.hook.PlayRadioParadiseAssistantCommand: | |
if: | |
type: platypush.message.event.assistant.SpeechRecognizedEvent | |
phrase: "play (the)? radio paradise" | |
then: | |
action: music.mpd.play | |
args: | |
resource: tunein:station:s13606 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: procedures can be synchronous (`procedure.sync` prefix) or asynchronous | |
# (`procedure.async` prefix). In a synchronous procedure the logic will wait for | |
# each action to be completed before proceeding with the next - useful if you | |
# want to link actions together, letting each action access the response of the | |
# previous one(s). An asynchronous procedure will execute instead all the actions | |
# in parallel. Useful if you want to execute a set of actions independent from | |
# each other, but be careful not to stack too many of them - each action will be | |
# executed in a new thread. | |
procedure.sync.at_home: | |
- action: serial.get_measurement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from platypush.context import get_plugin | |
>>> plugin = get_plugin('light.hue') | |
>>> print(plugin.__doc__) | |
Philips Hue lights plugin. | |
Requires: | |
* **phue** (``pip install phue``) |