Add led strip API

This commit is contained in:
redfast00 2022-02-28 19:55:51 +01:00
parent 2efcdb0624
commit e08ac5ed7b
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C

View file

@ -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"