Add led strip API
This commit is contained in:
parent
2efcdb0624
commit
e08ac5ed7b
1 changed files with 5 additions and 0 deletions
5
chat.py
5
chat.py
|
@ -11,6 +11,7 @@ import mpd
|
|||
from urllib.parse import urlencode
|
||||
import urllib.request
|
||||
import base64
|
||||
import requests
|
||||
|
||||
mpc = mpd.MPDClient()
|
||||
mpc.timeout = 0.2
|
||||
|
@ -132,6 +133,10 @@ def messages_post():
|
|||
assembly_request = urllib.request.Request(url, urlencode(post_fields).encode())
|
||||
assembly_request.add_header("X-Messages", msg_b64)
|
||||
urllib.request.urlopen(assembly_request).read().decode()
|
||||
try:
|
||||
requests.put("http://10.0.0.10/api/mailbox.json", json={"topic": "morsemessage", "message": msg_with_sendr})
|
||||
except:
|
||||
pass
|
||||
|
||||
return "OK"
|
||||
|
||||
|
|
Loading…
Reference in a new issue