RaspyRFM/apps/mqttdash.py
S. Seegel 01ddd7e3cc Better timing tolerance
Add weather sensors wh2, wh7000
some python3 issues
fix docu & PC PIR
2020-12-27 01:00:37 +01:00

25 lines
525 B
Python
Executable file

#!/usr/bin/env python
import rcprotocols
import time
import paho.mqtt.client as mqtt
mqttClient = mqtt.Client()
mqttClient.connect("localhost", 1883, 60)
mqttClient.loop_start()
def publish(proto, params):
print("Publish: " + str(proto) + " / " + params)
mqttClient.publish("home/rcbuttons/" + proto, params)
def rxcb(dec, train):
if dec is None:
print("raw", train)
return
for d in dec:
publish(d["protocol"], str(d["params"]))
rctrx = rcprotocols.RcTransceiver(1, 433.92, rxcb)
while True:
time.sleep(1)