Esphome alarm system

I like to keep 100% of the logic on the esp chip. I would probably do this manually add it is really just copying and pasting.

Another idea that allows you to dynamically assign group numbers is to create a separate esphome sensor corresponding to each physical sensor. This sensor would hold the group id number. Then you would check the group id number to decide whether to start executing the alarm sequence. You could have a service to update the group_id for those sensors.

My opinion is that this is a lot of implementation work that you are likely to use rarely. You might as well adjust your esphome code and flash over the air.

okay got you i understand. I wanted to make it easy for when i install it by mother and sister so that they can manually make the changes themselves without seeing the code so what i will have to do is develop an external ap that edits the secrets, alarm code and config that change will allow the person the code and add a sensor and so on example

esp_alarm_code: “1111” the external ap which will be password protected with the master code will allow the changing of the code with replace esp_alarm_code: “1111” with esp_alarm_code: “1324” so the person changing the code don’t see any code when they hit change code all they see is change code and a field to enter the old code and the new code.

Also one other thing i realise that when a contact is open the alarm still arms. this should not be so because if i forget a door opened i don’t want that the alarm arms instead highlight the zone that is opened. how would you suggest that i do this

The code in home assistant does not need to match the code in esp home, so you only need to adjust the code in your template_alarm_control_panel. Unfortunately, you can’t put this into your secrets file.

You need to put in a check here so that it only proceeds if nothing is activated. Then I would send the active binary sensors as an event to home assistant

Then you can act on this event in whatever manner you want like text message, persistent notification, or what have you.

Great thanks for that… I have a great idea Mathew.

I know the duplicate secrets file works and we used the ! include

how about if we reverse this so the main secret files in the config folder will have !include esphome/secrets.yaml. that way the secrets are pulled from the esphome directory and included in the config directory. when i was testing before it allowed me to have both secrets files populated without using the !included secrets

Hi Mathew a few day now. I’ve been trying to get the check for motion and open contacts code written but i’m not getting through with this when the areas are still open the alarm still arms i’m getting errors each time writing the code but i think i may be writing it all wrong can you help me with that part.

What have you tried? Youll probably need to check if a binary sensor is on or off in the arm script.

Hey Matt, i was trying to use the wait until action but i was getting an error in the code no matter where i place it Automations and Templates — ESPHome

I’m using this code with an ESP01 and Arduino nano.l as a gpio expansion … I have 16 GPIOs available …
@sparkydave
@MatthewFlamm

Hi to all… I’ve been working in an alarm system inspired in this therad (thank you @MatthewFlamm!), but adding some of the Alarmo integration options as well. As this one, is coded inside an ESP32.

I’m opening a new post because the code has a lot of new things that may be interesting on their own. You can reach it here:

I’d really love to know what you think about it.

Cheers!

1 Like

I answer this because I was re-reading after years. why do your esp die after two months? I don’t think I’ve seen the write to flash feature

If I knew exactly why, I probably would have persisted in using this code. It could be a combination of poor quality of esp boards I was buying, and writing states to flash. See restore_value here. Automations and Templates — ESPHome

I also suspect it might have something to do with my alarm wires being run in very close proximity and parallel to my mains wires (not to code here anymore) and not wiring in enough safety features to the branch zone circuits. The commercial alarm board I am using now has been rock solid, but it isn’t quite as flexible in functionality as I got through the esp implementation.

Even though I’m not using it, I am happy that these ideas have proliferated and others have built on top of it.

the enabling of the reset of the value in the variable is done only on restarts. So I don’t understand how it is possible that your esp chips didn’t last long.

To enable restoring the value at restart, it has to write the variable to RTC memory every time the state changes.

It is true. You are right. 🤦

Any share of your node red flows?

@crzykidd, here is my alarm flow:

[{"id":"b540a889.59e9b8","type":"tab","label":"Alarm","disabled":false,"info":""},{"id":"bf04b9df281b19f4","type":"junction","z":"b540a889.59e9b8","x":620,"y":460,"wires":[["ca3ce755.dc5518"]]},{"id":"dd43fe4cb67b22fe","type":"junction","z":"b540a889.59e9b8","x":620,"y":240,"wires":[["95049419.8d5138"]]},{"id":"93ee34adeb2b64d7","type":"junction","z":"b540a889.59e9b8","x":980,"y":160,"wires":[["4b6d01c1.19f8d"]]},{"id":"78247ae4b9aad933","type":"junction","z":"b540a889.59e9b8","x":620,"y":320,"wires":[["4ee24fdd.0be28"]]},{"id":"a9a5f5ba69432db5","type":"junction","z":"b540a889.59e9b8","x":1020,"y":1160,"wires":[["1f29cb3ce134a4b7","6937c4e403848069","2b4db706ea55106d","b85e3f178c83e931","a11a475048b445d4","81f9845d264a47bd","de1645de2fdc737d"]]},{"id":"586fc9b3af66ec05","type":"junction","z":"b540a889.59e9b8","x":480,"y":1060,"wires":[["6e9b7957cd613843","96092219d7e157b4","fecf0e371c3b6ef1"]]},{"id":"b95342fc.bc974","type":"server-state-changed","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"alarm_control_panel.home_alarm","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":240,"y":40,"wires":[["e52da894.949f88","3d2d99e7.5ed6a6","1e573853.30cec8"]]},{"id":"dd23d152.e0d26","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"domain":"alarm_control_panel","service":"alarm_trigger","areaId":[],"deviceId":[],"entityId":["alarm_control_panel.home_alarm"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":580,"y":540,"wires":[[]]},{"id":"b62efda5.0689","type":"inject","z":"b540a889.59e9b8","name":"Trigger Alarm","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":400,"wires":[["dd23d152.e0d26"]]},{"id":"e52da894.949f88","type":"switch","z":"b540a889.59e9b8","name":"Alarm State Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"disarmed","vt":"str"},{"t":"eq","v":"armed_away","vt":"str"},{"t":"eq","v":"armed_home","vt":"str"},{"t":"eq","v":"armed_night","vt":"str"},{"t":"eq","v":"pending","vt":"str"},{"t":"eq","v":"triggered","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":390,"y":300,"wires":[["eef0f251.805a4","15ed993e.825217","dd43fe4cb67b22fe","78247ae4b9aad933"],["bf04b9df281b19f4","dd43fe4cb67b22fe","78247ae4b9aad933"],["bf04b9df281b19f4","dd43fe4cb67b22fe","78247ae4b9aad933"],["bf04b9df281b19f4","dd43fe4cb67b22fe","78247ae4b9aad933"],["b4340a1c.2863f8","fa86467a.34c738","78247ae4b9aad933"],["9b3e7f02.59569","fda66fc0.7d2e5","28930649.e682ea","dd43fe4cb67b22fe"]]},{"id":"fe222553.6e4ca8","type":"debug","z":"b540a889.59e9b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":780,"wires":[]},{"id":"852dec59.b187c","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"domain":"alarm_control_panel","service":"alarm_disarm","areaId":[],"deviceId":[],"entityId":["alarm_control_panel.home_alarm"],"data":"{\"code\":\"2295\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":680,"y":740,"wires":[["fe222553.6e4ca8"]]},{"id":"b12669.5db5e998","type":"link out","z":"b540a889.59e9b8","name":"3 short beeps","links":["33f10660.c8516a"],"x":1365,"y":80,"wires":[]},{"id":"d7495616.0d3688","type":"comment","z":"b540a889.59e9b8","name":"3 short beeps","info":"","x":1480,"y":80,"wires":[]},{"id":"b85ce9fb.e857e8","type":"link out","z":"b540a889.59e9b8","name":"Slow Blips","links":["17b989db.70ab36"],"x":1365,"y":280,"wires":[]},{"id":"225e188c.871008","type":"comment","z":"b540a889.59e9b8","name":"Slow blips","info":"","x":1470,"y":280,"wires":[]},{"id":"95049419.8d5138","type":"change","z":"b540a889.59e9b8","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":240,"wires":[["b85ce9fb.e857e8"]]},{"id":"a77c2e58.27ae4","type":"comment","z":"b540a889.59e9b8","name":"Fast blips","info":"","x":1470,"y":340,"wires":[]},{"id":"9b3e7f02.59569","type":"link out","z":"b540a889.59e9b8","name":"Fast Blips","links":["54b4afe0.968","21e3dddba6614190"],"x":1365,"y":340,"wires":[]},{"id":"4ee24fdd.0be28","type":"change","z":"b540a889.59e9b8","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":300,"wires":[["9b3e7f02.59569","c30e8645.adb1b8"]]},{"id":"b4340a1c.2863f8","type":"function","z":"b540a889.59e9b8","name":"if old state was armed_away","func":"var newmsg = {payload: \"pending\"};\nif(msg.data.old_state.state == \"armed_away\") {\n    return [newmsg];\n}\nelse {\n    return [null];\n}\n","outputs":1,"noerr":0,"x":760,"y":180,"wires":[["b85ce9fb.e857e8","832240a5.0a7e3"]]},{"id":"eef0f251.805a4","type":"function","z":"b540a889.59e9b8","name":"if old state was not disarmed","func":"var newmsg = {payload: \"disarmed\"};\nif(msg.data.old_state.state != \"disarmed\") {\n    return [newmsg];\n}\nelse {\n    return [null];\n}\n","outputs":1,"noerr":0,"x":760,"y":80,"wires":[["b12669.5db5e998"]]},{"id":"2b2228ae.4cf128","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"domain":"alarm_control_panel","service":"alarm_arm_away","areaId":[],"deviceId":[],"entityId":["alarm_control_panel.home_alarm"],"data":"{\"code\":\"2295\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":690,"y":800,"wires":[["fe222553.6e4ca8"]]},{"id":"83b1ab4e.c6bba8","type":"link out","z":"b540a889.59e9b8","name":"","links":["8470282c.d71e28","ab6dda30f29695b0"],"x":1365,"y":400,"wires":[]},{"id":"4cc6251a.30298c","type":"comment","z":"b540a889.59e9b8","name":"Siren 1","info":"","x":1460,"y":400,"wires":[]},{"id":"c30e8645.adb1b8","type":"change","z":"b540a889.59e9b8","name":"set payload = 0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":420,"wires":[["83b1ab4e.c6bba8"]]},{"id":"fda66fc0.7d2e5","type":"change","z":"b540a889.59e9b8","name":"set payload = 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":380,"wires":[["83b1ab4e.c6bba8"]]},{"id":"cba49138.1c4b6","type":"link in","z":"b540a889.59e9b8","name":"Trigger Any","links":["59996eb3.dfdbd","191ba753.e9c9b9","c6d80eda.6223b"],"x":245,"y":440,"wires":[["dd23d152.e0d26"]]},{"id":"1202cf8.d37e831","type":"link in","z":"b540a889.59e9b8","name":"Trigger armed_away","links":["8df98f58.3b98d","2d17b9cc.680ce6","e8bc91b6.46f34","1e0bc39.51f7f3c"],"x":35,"y":480,"wires":[["752e02d4.3a8eec"]]},{"id":"263a41db.01056e","type":"link in","z":"b540a889.59e9b8","name":"Trigger armed_home","links":["34206ef2.d08272","b13b0d3b.d1b75","8a95417e.274e3"],"x":35,"y":540,"wires":[["99edac3c.794f7"]]},{"id":"6d28aa42.09c2a4","type":"link in","z":"b540a889.59e9b8","name":"Trigger armed_night","links":["8df98f58.3b98d","bf2ddb63.d2b688","7928e788.92e7c8","9e2461ca.f092a"],"x":35,"y":600,"wires":[["6c578b8e.87efa4"]]},{"id":"4b6d01c1.19f8d","type":"telegram sender","z":"b540a889.59e9b8","name":"na","bot":"77306bae.0610c4","outputs":1,"x":1420,"y":160,"wires":[[]]},{"id":"28930649.e682ea","type":"function","z":"b540a889.59e9b8","name":"kev: Alarm Triggered","func":"// Alarm triggered telegrams\nvar previousState = msg.data.old_state.attributes.previous_state;\nvar textContent = \"\";\n\nif(previousState == \"armed_home\") {\n    textContent = \"Alarm Triggered!!! (home)\";\n    msg.payload = {\n    \tchatId:\"0\", //kevS8\n    \ttype:\"message\",\n    \tcontent: textContent\n    };\n    return [msg];\n}\nelse if(previousState == \"armed_away\") {\n    textContent = \"Alarm Triggered!!! (away)\";\n    msg.payload = {\n    \tchatId:\"0\", //kevS8\n    \ttype:\"message\",\n    \tcontent: textContent\n    };\n    return [msg];\n}\nelse if(previousState == \"armed_night\") {\n    textContent = \"Alarm Triggered!!! (night)\";\n    msg.payload = {\n    \tchatId:\"0\", //kevS8\n    \ttype:\"message\",\n    \tcontent: textContent\n    };\n    return [msg];\n}\nelse {\n    textContent = \"Alarm Triggered!!! (???)\";\n    msg.payload = {\n    \tchatId:\"0\", //kevS8\n    \ttype:\"message\",\n    \tcontent: textContent\n    };\n    return [msg];\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":740,"y":400,"wires":[["93ee34adeb2b64d7"]]},{"id":"fa86467a.34c738","type":"function","z":"b540a889.59e9b8","name":"kev: Alarm Pending...","func":"// Alarm pending telegrams\nvar pendingState = msg.data.new_state.attributes.next_state;\nvar textContent = \"\";\nif(pendingState == \"triggered\") {\n    textContent = \"Alarm Pending!!!\";\n    msg.payload = {\n    \tchatId:\"0\", //kevS8\n    \ttype:\"message\",\n    \tcontent: textContent\n    };\n    return [msg,null];\n}\nelse if(pendingState == \"armed_away\") {\n    textContent = \"Arm Away pending...\";\n    msg.payload = {\n    \tchatId:\"0\", //kevS8\n    \ttype:\"message\",\n    \tcontent: textContent\n    };\n    return [null,msg];\n}\nelse {\n    return [null,null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":740,"y":140,"wires":[["93eb80ac.7d14","93ee34adeb2b64d7"],["93ee34adeb2b64d7"]]},{"id":"752e02d4.3a8eec","type":"api-current-state","z":"b540a889.59e9b8","name":"armed_away","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"armed_away","halt_if_type":"str","halt_if_compare":"is","entity_id":"alarm_control_panel.home_alarm","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":190,"y":480,"wires":[["dd23d152.e0d26"],[]]},{"id":"99edac3c.794f7","type":"api-current-state","z":"b540a889.59e9b8","name":"armed_home","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"armed_home","halt_if_type":"str","halt_if_compare":"is","entity_id":"alarm_control_panel.home_alarm","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":190,"y":540,"wires":[["dd23d152.e0d26"],[]]},{"id":"6c578b8e.87efa4","type":"api-current-state","z":"b540a889.59e9b8","name":"armed_night","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"armed_night","halt_if_type":"str","halt_if_compare":"is","entity_id":"alarm_control_panel.home_alarm","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":190,"y":600,"wires":[["dd23d152.e0d26"],[]]},{"id":"b04ebfae.aad95","type":"file","z":"b540a889.59e9b8","name":"","filename":"/config/alarm_log.yaml","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":240,"y":180,"wires":[[]]},{"id":"3d2d99e7.5ed6a6","type":"function","z":"b540a889.59e9b8","name":"parse log lines","func":"\nif(msg.payload == \"pending\") {\n    msg.payload = msg.data.new_state.last_updated + \", \"  + msg.payload + '_' + msg.data.new_state.attributes.next_state;\n}\nelse {\n    msg.payload = msg.data.new_state.last_updated + ', ' + msg.payload;\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":120,"wires":[["b04ebfae.aad95"]]},{"id":"1312da96.901fa5","type":"inject","z":"b540a889.59e9b8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":460,"y":840,"wires":[["2b2228ae.4cf128"]]},{"id":"53c1a606.35d218","type":"inject","z":"b540a889.59e9b8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":460,"y":700,"wires":[["852dec59.b187c"]]},{"id":"1e573853.30cec8","type":"debug","z":"b540a889.59e9b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":530,"y":40,"wires":[]},{"id":"15ed993e.825217","type":"function","z":"b540a889.59e9b8","name":"kev: Alarm Disarmed","func":"// Alarm disarm telegram\nvar newmsg = {payload: \"disarmed\"};\nif(msg.data.old_state.state != \"disarmed\") {\n    textContent = \"Alarm Disarmed\";\n    msg.payload = {\n    \tchatId:\"0\", //kevS8\n    \ttype:\"message\",\n    \tcontent: textContent\n    };\n    return [null,msg];\n}\nelse {\n    return [null,null];\n}","outputs":2,"noerr":0,"x":740,"y":40,"wires":[["5c3c0f28.05987","93ee34adeb2b64d7"],[]]},{"id":"5c3c0f28.05987","type":"change","z":"b540a889.59e9b8","name":"023","rules":[{"t":"set","p":"payload","pt":"msg","to":"023","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":40,"wires":[["2041d777.dcd808"]]},{"id":"93eb80ac.7d14","type":"change","z":"b540a889.59e9b8","name":"012","rules":[{"t":"set","p":"payload","pt":"msg","to":"012","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":100,"wires":[["2041d777.dcd808"]]},{"id":"832240a5.0a7e3","type":"change","z":"b540a889.59e9b8","name":"014","rules":[{"t":"set","p":"payload","pt":"msg","to":"014","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":180,"wires":[["2041d777.dcd808"]]},{"id":"ca3ce755.dc5518","type":"change","z":"b540a889.59e9b8","name":"013","rules":[{"t":"set","p":"payload","pt":"msg","to":"013","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":460,"wires":[["2041d777.dcd808"]]},{"id":"2041d777.dcd808","type":"api-call-service","z":"b540a889.59e9b8","name":"set esphome_voice","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.esphome_voice"],"data":"{\"value\":\"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"all","x":1430,"y":220,"wires":[[]]},{"id":"daa579e754aa8c37","type":"server-state-changed","z":"b540a889.59e9b8","d":true,"name":"","server":"684e76d1.f36e78","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.fridge","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":240,"y":760,"wires":[["852dec59.b187c"],["2b2228ae.4cf128"]]},{"id":"17ae8c88762c0bf8","type":"comment","z":"b540a889.59e9b8","name":"House Sitter Easy Arm/Disarm","info":"","x":220,"y":720,"wires":[]},{"id":"229e28a515982556","type":"api-call-service","z":"b540a889.59e9b8","d":true,"name":"Siren1 on","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.siren1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":1000,"wires":[[]]},{"id":"96092219d7e157b4","type":"api-call-service","z":"b540a889.59e9b8","d":true,"name":"Siren1 off","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.siren1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":1080,"wires":[[]]},{"id":"ab6dda30f29695b0","type":"link in","z":"b540a889.59e9b8","name":"Siren 1","links":["83b1ab4e.c6bba8"],"x":215,"y":1040,"wires":[["8b0af887147cdb15"]]},{"id":"59108de98a3c8595","type":"comment","z":"b540a889.59e9b8","name":"Siren1 (varitone)","info":"","x":100,"y":1040,"wires":[]},{"id":"1383e6bf814fd916","type":"api-call-service","z":"b540a889.59e9b8","d":true,"name":"Siren2 on","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.siren2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":520,"y":1260,"wires":[[]]},{"id":"5ec4bb5c4f9c9356","type":"api-call-service","z":"b540a889.59e9b8","d":true,"name":"Siren2 off","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.siren2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":520,"y":1320,"wires":[[]]},{"id":"ae2296179fac4397","type":"link in","z":"b540a889.59e9b8","name":"Siren 2","links":[],"x":215,"y":1280,"wires":[["9e47f88ed37afa23"]]},{"id":"a4e0da011e2409c1","type":"comment","z":"b540a889.59e9b8","name":"Siren2 (monotone)","info":"","x":110,"y":1280,"wires":[]},{"id":"8b0af887147cdb15","type":"switch","z":"b540a889.59e9b8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":1040,"wires":[["229e28a515982556","691b27835bd81a32"],["586fc9b3af66ec05"]]},{"id":"9e47f88ed37afa23","type":"switch","z":"b540a889.59e9b8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":1280,"wires":[["1383e6bf814fd916"],["5ec4bb5c4f9c9356"]]},{"id":"1b46093b558b8563","type":"inject","z":"b540a889.59e9b8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":170,"y":1000,"wires":[["8b0af887147cdb15"]]},{"id":"1cc4dfefb6ad87f8","type":"inject","z":"b540a889.59e9b8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":1080,"wires":[["8b0af887147cdb15"]]},{"id":"caca4594c6330498","type":"inject","z":"b540a889.59e9b8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":170,"y":1240,"wires":[["9e47f88ed37afa23"]]},{"id":"0db3d01c604b1610","type":"inject","z":"b540a889.59e9b8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":1320,"wires":[["9e47f88ed37afa23"]]},{"id":"acfd4fd301c30da2","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.front_yard_lights"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1020,"wires":[[]]},{"id":"2b4db706ea55106d","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.front_yard_lights"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":960,"wires":[[]]},{"id":"36dcf560f30ad3c0","type":"api-current-state","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.front_yard_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":970,"y":960,"wires":[["2b4db706ea55106d"],["acfd4fd301c30da2"]]},{"id":"fecf0e371c3b6ef1","type":"change","z":"b540a889.59e9b8","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":960,"wires":[["691b27835bd81a32"]]},{"id":"de1645de2fdc737d","type":"link out","z":"b540a889.59e9b8","name":"","links":["c6991805.e2f108"],"x":1235,"y":1680,"wires":[]},{"id":"bda07a517bae55ac","type":"comment","z":"b540a889.59e9b8","name":"Reset Lighting","info":"","x":1330,"y":1680,"wires":[]},{"id":"6e9b7957cd613843","type":"change","z":"b540a889.59e9b8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"auto","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":1160,"wires":[["a9a5f5ba69432db5"]]},{"id":"98fd5acff862c705","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.front_yard_plug_b_relay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1140,"wires":[[]]},{"id":"1f29cb3ce134a4b7","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.front_yard_plug_b_relay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1080,"wires":[[]]},{"id":"6e96c0c1c3bd173f","type":"api-current-state","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.front_yard_plug_b_relay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":990,"y":1080,"wires":[["1f29cb3ce134a4b7"],["98fd5acff862c705"]]},{"id":"be783d3d43d15c96","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.backyard_lights"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1290,"y":1260,"wires":[[]]},{"id":"6937c4e403848069","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.backyard_lights"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1290,"y":1200,"wires":[[]]},{"id":"a2e91fe9d767911d","type":"api-current-state","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.backyard_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":960,"y":1240,"wires":[["6937c4e403848069"],["be783d3d43d15c96"]]},{"id":"77a47463d07608d8","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.patio_light_relay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1380,"wires":[[]]},{"id":"b85e3f178c83e931","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.patio_light_relay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1320,"wires":[[]]},{"id":"601a9c0705798b57","type":"api-current-state","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.patio_light_relay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":970,"y":1340,"wires":[["b85e3f178c83e931"],["77a47463d07608d8"]]},{"id":"c3564f5b2c0903b8","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.side_yard_light_relay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1500,"wires":[[]]},{"id":"a11a475048b445d4","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.side_yard_light_relay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1440,"wires":[[]]},{"id":"0ca0b812f9efb37a","type":"api-current-state","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.side_yard_light_relay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":990,"y":1460,"wires":[["a11a475048b445d4"],["c3564f5b2c0903b8"]]},{"id":"70b15f0ff52cfd16","type":"comment","z":"b540a889.59e9b8","name":"Lights to flash during alarm","info":"","x":950,"y":900,"wires":[]},{"id":"691b27835bd81a32","type":"trigger","z":"b540a889.59e9b8","name":"","op1":"on","op2":"0","op1type":"str","op2type":"str","duration":"-1.5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":670,"y":960,"wires":[["6e96c0c1c3bd173f","a2e91fe9d767911d","601a9c0705798b57","0ca0b812f9efb37a","36dcf560f30ad3c0","83f7eb42c1edbd72"]]},{"id":"f377664302c2c567","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.front_yard_plug_a_relay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1620,"wires":[[]]},{"id":"81f9845d264a47bd","type":"api-call-service","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.front_yard_plug_a_relay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":1560,"wires":[[]]},{"id":"83f7eb42c1edbd72","type":"api-current-state","z":"b540a889.59e9b8","name":"","server":"684e76d1.f36e78","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.front_yard_plug_a_relay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":990,"y":1580,"wires":[["81f9845d264a47bd"],["f377664302c2c567"]]},{"id":"684e76d1.f36e78","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"77306bae.0610c4","type":"telegram bot","botname":"na","usernames":"","chatids":"0","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"0","socksusername":"anonymous","sockspassword":"","bothost":"","localbotport":"0","publicbotport":"0","privatekey":"","certificate":"","useselfsignedcertificate":false,"verboselogging":false}]

There is a lot of extra stuff in there that isn’t purely alarm control panel related, but hopefully it gives an idea of how to use nodered to handle automations for the HA alarm panel. Don’t forget to add the alarm panel lines to your configuration file (or add it through GUI if that capability is there these days).

I added a request on the ESPHome github for supporting the SRAM on some of the clock chips that ESPHome supports. These chips support unlimited Read/Write on their non-volatile memory, so by using these, there won’t be any of the problems with the ESP chips eventually failing because of too many writes to their flash memory.
See the request here: DS1307 - Add support for SRAM · Issue #2352 · esphome/feature-requests · GitHub.
As far as the wires too close to the mains, using external pull-up resistors of lower value (2k2 or 3k3), instead of depending on the built-in resistors of the ESP chip, usually helps. If you want to make it foolproof, you can also use opto-isolators on the inputs, this is what I did on my system and it took care of all the noise issues I had.

hellow everybody

Is it possibleto use the disarm code from the alarm panel with a text_sensor? of a number? that would be easy for changing the code without changing the yaml.

I know this is somewhat old but, i dont think the wiegand26 output/keypad was available back then. Another user made this and shared it with me to help me setup my keypad/rfid reader.

This allows you to add/remove people/codes from HA input_select entities or the keypad itself by doing certain sequences and many more features.

The thing i really like about these keypad/rfid readers is each persons access can be turned on and off instantly. This also allows you to see who is coming and going and when, because each persln has a unique pin or rfid tag and its logged each time they use the keypad.

With minimal work, a wiegand26 keypad could be used to arm/disarm the alarm or maybe even if a relative stops by and comes in, maybe for that person/pin number you dont want the alarm to trigger, but instead its disarmed and you get a notification that your mother-in-law is in town and you coincidentally have to stay st work late…

Theres lots of possibilities someone could do with a little imagination, thats my point and this would be a huge head start in combining it with alarm.

There are lots of keypads, rfid readers or combo keypad w/rfid readers that can be used. You just have to make sure that it has the Wiegand26/34 Output available because some dont.
This is the keypaf/rfid i use and can confirm it works with esphome.

You should be able to. The problem with doing that though is instead of everything being contained in esphome and not being dependent on HA working inorder for your alarm to work, you would have to give that up or atleast thats the only way i can think of.

In your yaml where you set codes. You would need to use a lambda to check for a new sensor state from your HA text_sensor. You may need to do some converting back and forth from a string to an integer because, i think whay you enter in text_sensor is a string and the code needs to be an integer…

I could be wrong about some lf the details but you have a framework to now go off of and fill in the details.

Do you really expect to be changing the code so frequently that you need a text sensor to do it faster? Doing that also opens up the possibility of HA users to reset your own pin on you too. Its probably nor the best Idea,. It only takesv20 seconds for update your config and change the code…