Skip to content

Instantly share code, notes, and snippets.

@jhalbrecht
Created December 10, 2018 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhalbrecht/f8a01fa46ea8dafc5abcbf255bc82667 to your computer and use it in GitHub Desktop.
Save jhalbrecht/f8a01fa46ea8dafc5abcbf255bc82667 to your computer and use it in GitHub Desktop.
Home Assistant sensor and automation .yaml to toggle a SonOff light with a 433mhz RF Bridge w/tasmota for the buttons...
Given this topic make sensor/button unique in this working example any button on that topic will fire the automation.
tele/homeamation/sonoff02/STATE {"Time":"2018-12-10T16:30:27","Uptime":"30T22:46:46","Vcc":3.121,"POWER":"OFF","Wifi":{"AP":1,"SSId":"ADP","BSSId":"F8:32:E4:AE:00:F8","Channel":3,"RSSI":100}}
# commented lines are failed attempts
in sensors....
#
# button
#
# 12/9/2018
- platform: mqtt
name: Button01
initial_state: true
optimistic: true
force_update: true
state_topic: "tele/homeamation/rf/sonoff/RESULT"
# value_template: "{{ value_json['RfReceived'].Data }}"
# value_template: 'value_json.RfReceived.Data'
# payload_on: '00C824'
# payload_off: '00C824'
in automation...
# jha 12/9/2018 from Home Assistant discourse channel Malixlizard
#
# Button 1 automation
#
- alias: Button 1 pushed
trigger:
- platform: state
entity_id: sensor.Button01
# to: '00C824'
# payload: '00C824'
action:
# - condition: template
# value_template: '{{ value_json.RfReceived.Data == '00C824' }}'
- service: switch.toggle
entity_id:
- switch.back_lights_front
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment