Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- # __ _______ ____________ _____ #
- # / |/ / __ \/_ __/_ __/ / ___/___ ____ _________ __________ #
- # / /|_/ / / / / / / / /_____\__ \/ _ \/ __ \/ ___/ __ \/ ___/ ___/ #
- # / / / / /_/ / / / / /_____/__/ / __/ / / (__ ) /_/ / / (__ ) #
- # /_/ /_/\___\_\/_/ /_/ /____/\___/_/ /_/____/\____/_/ /____/ #
- # by J-Lindvig #
- ################################################################################
- # Created: 25/10/2020 #
- ################################################################################
- windows_doors:
- group:
- open_sensors:
- name: "Vinduer og døre med åbn sensor"
- icon: mdi:window-open-variant
- all: true
- entities:
- - binary_sensor.havelaage
- open_close_sensors:
- name: "Vinduer og døre med åbn/luk sensor"
- icon: mdi:window-closed-variant
- all: true
- entities:
- - binary_sensor.dobbelt_terrassedoer
- automation:
- - alias: "RF Bridge Demux"
- mode: parallel
- trigger:
- - platform: mqtt
- topic: "tele/kontor/RESULT"
- - platform: mqtt
- topic: "tele/indgang/RESULT"
- - platform: mqtt
- topic: "tele/pigernes_stue/RESULT"
- action:
- - service: "python_script.rfbridge_demux"
- data:
- payload: "{{ value_json.RfReceived.Data }}"
- binary_sensor:
- - platform: mqtt
- name: "Havelåge"
- unique_id: cd71f96a0d0e412bba41e91e3866ee07
- device_class: door
- state_topic: "home/Havelåge"
- off_delay: 15
- - platform: mqtt
- name: "Dobbelt_terrassedoer"
- unique_id: 4b03ffb918314900b4b59eed108c1960
- device_class: door
- state_topic: "home/Dobbelt terrassedør"
- script:
- reload_mqtt_sensors:
- alias: "Genindlæs MQTT sensorer"
- icon: mdi:reload
- description: "Genindlæs MQTT, Grupper, Templates og Scripts"
- mode: single
- sequence:
- - service: automation.reload
- - service: mqtt.reload
- - service: template.reload
- - service: group.reload
- ################################################################################
- #### End of file ####
- ################################################################################
- sensors = {
- "3C003A": ["Havelåge", "ON", "false"],
- "45400A": ["Dobbelt terrassedør", "ON", "true"],
- "45400E": ["Dobbelt terrassedør", "OFF", "true"]
- }
- 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