Ok guys my first Topic here and obviously just getting started with HA. Below is my Configuration.yaml and automations.yaml files. I have 433 Siren which I am trying to trigger on and off when the alarm is triggered and when it’s disarmed. Setting alarm off when alarm triggered works like a charm but I can not disable when the alarm is disarmed.
I spent good TWO days trying to figure out the disarm automation. Finally, I added some lights to it to check if the Automation actually gets triggered and IT DOES but the service: mqtt.publish does not seem to be doing anything. I know for sure that when I use Dev Tools MQTT and publish the message the siren responds to it. Also the service: light.turn_off part of the automation works perfect so can someone point out what I am doing wrong here.
HA v 0.89.2
EDIT: One more thing I would like to add/ask is when the trigger_time: 300 runs out the alarm goes back to ARMED state but it does not get triggered again even if the binary_sensor.front_door is still open. I have to close it and open it again in order to RE-Trigger the alarm. That does not sound very safe !
TIA.
configuration.yaml
# Security System
alarm_control_panel:
- platform: manual
name: Home Alarm
code: !secret alarm_code
trigger_time: 30 #For testing alarm-300 or more
disarmed:
trigger_time: 0
armed_home:
delay_time: 0
pending_time: 0
armed_away:
delay_time: 5 #For testing alarm-Change to 60
pending_time: 3 #For testing alarm-FChange to 30
triggered:
pending_time: 0
automations.yaml
##################################
# Alarm System
##################################
- alias: Trigger alarm while armed
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: 'on'
condition:
condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_away
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_home
action:
service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.home_alarm
- alias: Sound Siren when alarm triggered
trigger:
- platform: state
entity_id: alarm_control_panel.home_alarm
to: triggered
action:
- service: mqtt.publish
data:
topic: cmnd/RFBridge_Home/RfKey4 # RfKey4/8/12/16 sets alarm off
payload:
- service: light.turn_on
data:
entity_id:
- light.osram_softwhite
- alias: Turn off Siren after triggered alarm disarmed
trigger:
- platform: state
entity_id: alarm_control_panel.home_alarm
to: disarmed
action:
- service: mqtt.publish
data:
topic: cmnd/RfBridge_Home/RfKey2 #RfKey2/6/10/12 turn alarm off
payload:
- service: light.turn_off
data:
entity_id:
- light.osram_softwhite
FYI
Using RF 433Mhz buttons to arm/disarm a security system is not secure (and never used in professionally installed residential or commercial alarm systems). The transmitted code is easily detected and is not secured by any encryption scheme.
At minimum you’d need a rolling-code system to provide some degree of resistance to replay attacks (i.e. arming/disarming code are detected and replayed). The existence of this vulnerability (sending unencrypted, unchanging, RF commands) is what spurred garage door manufacturers to use rolling-code (decades ago).
If you’re aware of the risks, so be it. Otherwise, know that your homebrew security system can be easily defeated.
Yes very true about the 433Mhz devices. But this one is just a siren that I will be placed somewhere outside. The siren itself will not disarm the system or anything. The system will be disarmed with the code only. I am not using 433 Key fob to arm/disarm the system.
So I believe the “RfKey2” is the payload. Sonoff RF Bridge has the ability to send 16 codes. Surprisingly RfKey4/8/12/16 sets the alarm off and 2/6/10/14 can turn it off.
Fixed in OP. Sorry I was testing something else so the setting off the alarm should look like this:
But this does not look like correct code and cannot execute it using Dev Tools MQTT.
What I don’t understand is if the Arming/Sounding the alarm part works but the disarming part does not. The light, however, turns on and off while arming and disarming respectively. Just the mqtt.publish does not seem to be doing anything!???
You need to identify the correct topic that is designed to receive commands. You also need to determine the correct command for the payload.
I suggest you use Home Assistant’s MQTT page to experiment with topics and payloads. Once you get the right topic and payload, you can use that information in the automation.
That is where I am super confused. All of commands works. I checked again too. See the attached Screen shot. But for some reason service: mqtt.publish is not publishing anything when the Turn off alarm Automation runs. Pretty strange. Because in that automation the service: light.turn_off works!
PS: Dude I highly appreciate your help and quick replies. Also LOL, I am at work right now and can see a bunch of 433 messages in my RFBridge console from other stores around me posts when someone opens door etc!
Not the ‘solution’ because retain: false is the default. It’s simply a directive for how the payload is published … and false is the default state.
OK, so publishing an empty payload to cmnd/RfBridge_Home/RfKey2 will activate the alarm (deactivate if sent to cmnd/RfBridge_Home/RfKey4).
If the alarm is triggered merely by publishing nothing to the topic (that’s a pretty low bar) then try something. Maybe the service mqtt.publish doesn’t like publishing an empty payload?? I doubt it, but it’s worth a try.
You can now easily spoof other systems in your vicinity. It’s why RF 433MHz is OK for temperature sensors and non-critical contact sensors but poor for critical security sensors or for activating critical devices (oh like a pool pump for instance or security system).
I am using Digoo DG-ROSA 433MHz siren. It’s tiny in size but pretty loud with built-in little 1S battery as well. It also has enough room to put a bigger battery if you really have to.
I am NOT using any Key fob for disarming the alarm. Just the HA alarm panel. Like @123 said key fob is very unsafe because you can see what code was sent just by using RF Bridge console.
Not sure if this topic is still active or of my question makes sense or anything but here it goes.
I was planing on buying this siren also and noticed that the siren has a Learning mode, so I was wondering if you could maybe put her in Learn Mode and send a better payload than just the Key press? Something like the usual 6 chars that the sensors have?