Closed onkytonk closed 5 years ago
Could you show more commitment and share your automation please?
I am using nodered. Here is what my automation looks like and I have attached the flow.
[{"id":"5291702a.b1a11","type":"server-state-changed","z":"f9a8a8ea.c4b0f8","name":"Alarm Control Panel","server":"1b36a1cc.1e72ee","version":1,"entityidfilter":"alarm_control_panel.house","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"x":150,"y":215,"wires":[["e003ce23.da744"]]},{"id":"4c3b8341.d6930c","type":"switch","z":"f9a8a8ea.c4b0f8","name":"Alarm State","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"armed_away","vt":"str"},{"t":"eq","v":"armed_home","vt":"str"},{"t":"eq","v":"disarmed","vt":"str"},{"t":"eq","v":"triggered","vt":"str"},{"t":"eq","v":"warning","vt":"str"},{"t":"eq","v":"pending","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":590,"y":220,"wires":[["90eaf91c.ef1f68"],["59cead0a.e5a384"],["1f037dad.2f96f2"],["4d291bb6.131c04"],["c76a4a1a.075b08"],[]]},{"id":"90eaf91c.ef1f68","type":"api-call-service","z":"f9a8a8ea.c4b0f8","name":"Notify Armed Away","server":"1b36a1cc.1e72ee","service_domain":"notify","service":"ios_josephs_iphone_x","data":"{\"title\": \"ALARM\", \"message\": \"Armed Away\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":990,"y":180,"wires":[[]]},{"id":"59cead0a.e5a384","type":"api-call-service","z":"f9a8a8ea.c4b0f8","name":"Notify Armed Home","server":"1b36a1cc.1e72ee","service_domain":"notify","service":"ios_josephs_iphone_x","data":"{\"title\": \"ALARM\", \"message\": \"Armed Home\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":990,"y":240,"wires":[[]]},{"id":"1f037dad.2f96f2","type":"api-call-service","z":"f9a8a8ea.c4b0f8","name":"Notify Disarmed","server":"1b36a1cc.1e72ee","service_domain":"notify","service":"ios_josephs_iphone_x","data":"{\"title\": \"ALARM\", \"message\": \"Disarmed\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":980,"y":300,"wires":[[]]},{"id":"846c5985.bee828","type":"api-call-service","z":"f9a8a8ea.c4b0f8","name":"Notify Triggered","server":"1b36a1cc.1e72ee","service_domain":"notify","service":"ios_josephs_iphone_x","data":"{}","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":980,"y":360,"wires":[[]]},{"id":"96e26a1b.8324d8","type":"api-call-service","z":"f9a8a8ea.c4b0f8","name":"Notify Warning","server":"1b36a1cc.1e72ee","service_domain":"notify","service":"ios_josephs_iphone_x","data":"{\"title\": \"ALARM\", \"message\": \"Warning\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":980,"y":420,"wires":[[]]},{"id":"cda190a.ce4667","type":"comment","z":"f9a8a8ea.c4b0f8","name":"Notifications","info":"","x":130,"y":140,"wires":[]},{"id":"e003ce23.da744","type":"traffic","z":"f9a8a8ea.c4b0f8","name":" ","property_allow":"payload","filter_allow":"on","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"off","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":true,"differ":false,"x":450,"y":220,"wires":[["4c3b8341.d6930c"]]},{"id":"fcf18af8.ad1798","type":"server-state-changed","z":"f9a8a8ea.c4b0f8","name":"On/Off","server":"1b36a1cc.1e72ee","version":"1","entityidfilter":"input_boolean.alarm_notifications","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"x":110,"y":285,"wires":[["e003ce23.da744"]]},{"id":"4d291bb6.131c04","type":"function","z":"f9a8a8ea.c4b0f8","name":"Message","func":"msg.payload =\n{\n \"data\": {\n \"message\": \"Triggered! {{states[states.alarm_control_panel.house.attributes.changed_by.split(\\\".\\\")[0]][states.alarm_control_panel.house.attributes.changed_by.split(\\\".\\\")[1]].name}}\",\n \"title\": \"ALARM\"\n }\n}\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":360,"wires":[["846c5985.bee828"]]},{"id":"c76a4a1a.075b08","type":"function","z":"f9a8a8ea.c4b0f8","name":"Message","func":"msg.payload =\n{\n \"data\": {\n \"message\": \"Warning! {{states[states.alarm_control_panel.house.attributes.changed_by.split(\\\".\\\")[0]][states.alarm_control_panel.house.attributes.changed_by.split(\\\".\\\")[1]].name}}\",\n \"title\": \"ALARM\"\n }\n}\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":420,"wires":[["96e26a1b.8324d8"]]},{"id":"1b36a1cc.1e72ee","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
This is my current workaround. I've added a node that checks the previous state of the alarm. If its already in a "disarmed" state, the flow stops. However, still don't know why toggling any alarm settings is sending a "disarmed" state.
Okay, the workaround worked to solve one problem, but I've just found another one.
If the alarm is armed, and I press disarm without a code, or the wrong code + disarm, I receive my phone notifications. However, the alarm is remainging armed. EDIT: So I've realised this might be a seperate issue - but basically the alarm is resending the "armed_away" trigger after an incorrect code entry. This is inturn sending my notifications through.
So I have solved all my issues by adding an RBE node. Not sure if the same issues occure when using YAML automations, but this is my workaround. There is still something from Bwalarm that is resending the disarm state when toggling settings though.
Look, it is not unusual for ANY entity in Home Assistant to signal that its state has changed, but it is not necessary means that the state string has changed. It can be change in attributes, exactly what happens when you change any setting. I can confirm that the integration's code receives state change event every time settings have changed, but I just compare old and hew state strings and react only if they are different. I also have automation that sends me an email when my alarm becomes Disarmed, and it still works as expected, no false emails received. Hope it helps. P.S. I'm 0 at NodeRed ;)
Yeah, I guess the trick is to input a "state change" into the automation.
But is there any reason a state/attribute change is occuring when settings are being toggled? Seems strange to me.
But is there any reason a state/attribute change is occuring when settings are being toggled? Seems strange to me.
I believe there is. Look at attributes of your alarm_control_panel.house
in Developer tools -> States.
In another window open alarm Settings and change something - you should notice change in an appropriate attribute.
That's because you just changed the alarm's attribute, and that's the way HA works with State Objects - look at last_changed and last_updated attributes' descriptions.
I'm closing this issue as there is no activity here.
Your components (from Alarm/Settings/About):
Platform & Browser:
Describe the bug I have an automation to send a notification to my phone and google TTS announces when the alarm is "disarmed". Every time I toggle any setting in the alarm panel UI, it is sending a "disarmed" state. I then receive a notification and google announces it every time.
To Reproduce Steps to reproduce the behavior:
Expected behavior There shouldn't be any state changes when toggling settings