Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensors = {
- "45400A": ["Dobbelt terrassedør", "ON", "true"],
- "45400E": ["Dobbelt terrassedør", "OFF", "true"],
- "3C003A": ["Havelåge", "ON", "false"]
- }
- payload = data.get("payload")
- if payload is not None:
- if payload in sensors.keys():
- service_data = {"topic": "home/{}".format(sensors[payload][0]), "payload":"{}".format(sensors[payload][1]), "qos":0, "retain":"{}".format(sensors[payload][2])}
- else:
- service_data = {"topic":"home/unknown", "payload":"{}".format(payload), "qos":0, "retain":"false"}
- logger.warning("<rfbridge_demux> Received unknown RF command: {}".format(payload))
- hass.services.call("mqtt", "publish", service_data, False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement