01ddd7e3cc
Add weather sensors wh2, wh7000 some python3 issues fix docu & PC PIR
25 lines
525 B
Python
Executable file
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)
|