Skip to content

Instantly share code, notes, and snippets.

@Snipercaine
Last active August 11, 2023 03:40
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save Snipercaine/889024b0f13302928c7251e1578734d6 to your computer and use it in GitHub Desktop.
Save Snipercaine/889024b0f13302928c7251e1578734d6 to your computer and use it in GitHub Desktop.
binary_sensor:
- platform: mqtt
state_topic: "tele/RF_Bridge/RESULT"
name: 'Garage Motion'
value_template: '{{value_json.RfReceived.Data}}'
payload_on: 'D54C1E'
off_delay: 10
device_class: motion
qos: 1
retain: false
- platform: mqtt
name: "Garage Fridge"
state_topic: "tele/RF_Bridge/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "DF000A"
payload_off: "DF000E"
device_class: Cold
qos: 1
retain: false
- platform: mqtt
name: "Shop Door"
state_topic: "tele/RF_Bridge/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "F8030A"
payload_off: "F8030E"
device_class: Door
qos: 1
retain: false
- platform: mqtt
name: "Basment Water"
state_topic: "tele/RF_Bridge/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "84B90E"
off_delay: 10
device_class: Moisture
qos: 1
retain: false
- platform: mqtt
name: "Office Wand"
state_topic: "tele/RF_Bridge/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "D31421"
off_delay: 10
qos: 1
retain: false
- platform: mqtt
name: "Office Book"
state_topic: "tele/RF_Bridge/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "C7C2A1"
off_delay: 10
qos: 1
retain: false
##Automations for RF Sensors and Fun
- alias: 'Garage Fridge Open'
hide_entity: true
trigger:
- platform: state
entity_id: binary_sensor.garage_fridge
from: 'off'
to: 'on'
for: '00:02:00'
action:
- service: media_player.alexa_tts
data:
entity_id: media_player.kitchen_dot
message: "Can someone please close the garage fridge?"
- service: tts.google_say
data:
entity_id: media_player.adenaudiocast
message: "Can someone please close the garage fridge?"
- alias: 'Basement Water Leak'
hide_entity: true
trigger:
- platform: state
entity_id: binary_sensor.basment_water
from: 'off'
to: 'on'
action:
- service: tts.google_say
data:
entity_id: media_player.adenaudiocast
message: "Holy Crap there's water in the Basement again! Call someone, do something, ahhhhhhhh?"
- service: media_player.alexa_tts
data:
entity_id: media_player.dads_office
message: "Holy Crap there's water in the Basement again! Call someone, do something, ahhhhhhhh?"
- service: notify.ios_justin_iphone7
data:
title: WATER LEAK
message: "Holy Crap there's water in the Basement again! Call someone, do something, ahhhhhhhh?"
- service: input_select.select_option
data:
entity_id: input_select.all_leds
option: Police All
- alias: Office Lock Magic
hide_entity: true
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.office_book
to: 'on'
- platform: state
entity_id: binary_sensor.office_wand
to: 'on'
action:
- service: switch.toggle
data:
entity_id: switch.office_lock
- service: tts.google_say
data:
entity_id: media_player.adenaudiocast
message: "You have chosen wisely. You may enter my realm"
- alias: Garage Lights Off
hide_entity: true
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.garage_motion
from: 'on'
to: 'off'
for:
minutes: 5
action:
- service: switch.turn_off
data:
entity_id: switch.garage_lights
- alias: Garage Lights On
hide_entity: true
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.shop_door
to: 'on'
- platform: state
entity_id: binary_sensor.garage_entry
to: 'on'
- platform: state
entity_id: binary_sensor.garage_motion
to: 'on'
condition:
- condition: state
entity_id: switch.garage_lights
state: 'off'
action:
service: switch.turn_on
data:
entity_id: switch.garage_lights
@halidss86
Copy link

thanks
how I send or activate key in tasmota (16 keys) from automation?

@BentUhrenholdt
Copy link

Hi!
I'm a new to Home Assistant, and i'm working on my first automations. I have flashed my Sonoff RF bridge with Tasmota, and have used your code exsample above. But I can' get the PIR sensor (One code) to reset via the automation.yaml?!

  1. my 2 automations turning the light on and off works fine when they are triggered manually from HA
  2. The PIR sends the code when triggered - using the console in the web UI
    image
  3. My 2 code garage door sensor works just fine
  4. My own fault finding shows me so far, that the PIR reset automation never gets triggered - I never get notification on my phone

My automation.yaml (sorry for the danish terms)

Garage PIR reset

  • alias: Reset garage PIR state
    hide_entity: false
    initial_state: 'on'
    trigger:
    • platform: state
      entity_id: binary_sensor.garage_bevaegelse
      from: 'off'
      to: 'on'
      for:
      seconds: 5
      action:
    • service: mqtt.publish
      data:
      topic: tele/Sonoff_RF_Bridge_1/RESULT
      payload: "E9EA2Eoff"
    • service: notify.ios_bents_iphone8
      data:
      title: Garagelys
      message: Så er PIR nulstillet

Garagelys sluk

  • alias: Garage Lights Off
    hide_entity: false
    initial_state: 'on'
    trigger:
    • platform: state
      entity_id: binary_sensor.garage_bevaegelse
      from: 'on'
      to: 'off'
      for:
      minutes: 1
      action:
    • service: switch.turn_off
      data:
      entity_id: switch.sonoff_sw_1
    • service: notify.ios_bents_iphone8
      data:
      title: Garagelys
      message: Så er lyset slukket

Garagelys tænd

  • alias: Garage Lights On
    hide_entity: false
    initial_state: 'on'
    trigger:
    • platform: state
      entity_id: binary_sensor.garage_bevaegelse
      to: 'on'
      condition:
    • condition: state
      entity_id: switch.sonoff_sw_1
      state: 'off'
      action:
    • service: switch.turn_on
      data:
      entity_id: switch.sonoff_sw_1
    • service: notify.ios_bents_iphone8
      data:
      title: Garagelys
      message: Så er lyset tændt

Part of my configuration.yaml (sorry for the danish terms)

############ Sonoff RF Bridge sensorer #########
binary_sensor:

  • platform: mqtt
    state_topic: "tele/Sonoff_RF_Bridge_1/RESULT"
    name: 'Garage bevægelse'
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: 'E9EA2E'
    payload_off: 'E9EA2Eoff'
    device_class: motion
    qos: 1
  • platform: mqtt
    name: 'Garage port'
    state_topic: "tele/Sonoff_RF_Bridge_1/RESULT"
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: '342E0A'
    payload_off: '342E0E'
    device_class: garage_door
    qos: 1

Could anyone give me a hint to get the PIR to reset via the automation ?

BR Bent

@Snipercaine
Copy link
Author

Snipercaine commented Sep 18, 2019 via email

@BentUhrenholdt
Copy link

BentUhrenholdt commented Sep 19, 2019 via email

@BentUhrenholdt
Copy link

BentUhrenholdt commented Sep 19, 2019 via email

@BentUhrenholdt
Copy link

BentUhrenholdt commented Sep 19, 2019 via email

@Snipercaine
Copy link
Author

Snipercaine commented Sep 20, 2019 via email

@Luciano3272
Copy link

hi, sorry I speak english very bad.
I'm new in HA, I'd like to know if u can help me to give a function up and down in a sonoff pir motion sensor .
I saw this example:
- platform: mqtt
state_topic: "tele/RF_Bridge/RESULT"
name: 'Garage Motion'
value_template: '{{value_json.RfReceived.Data}}'
payload_on: 'D54C1E'
payload_off: 'D54C1Eoff'
device_class: motion
optimistic: false
qos: 1
retain: false

but I don't know where I found this info like ... ( D54C1Eoff ... )
Thanks in advance
Lu

@Snipercaine
Copy link
Author

Snipercaine commented Nov 11, 2019 via email

@BentUhrenholdt
Copy link

BentUhrenholdt commented Nov 11, 2019 via email

@Luciano3272
Copy link

Thanks, with " off_delay: 30 " . all works !!!
Only for info a little question.
If I add more pir ( example 5 or 10pc ) the system becomes heavy or does not suffer?
Lu
p.s. for fan : DrZzs when you want to do a short tutorial on Jinvoo smart switches that are spreading in Europe :D

@Snipercaine
Copy link
Author

Snipercaine commented Nov 11, 2019 via email

@BentUhrenholdt
Copy link

BentUhrenholdt commented Nov 11, 2019 via email

@oldercodergithub
Copy link

Nowadays we get such error on check config.
.... [retain] is an invalid option for [binary_sensor.mqtt]....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment