Hallo,
I have done simple node red to trigger on my doors (state change). Next step is to trigger notifications if state change if either myself or wife is not at home. From what I searched it is possible, also tried several options, only problem is I have limited programmer knowledge. Currently it trigger correct during the predetermine times, it does not trigger if either of us is not home. I need some form of JavaScript to get this working. Any help will be much appreciated
Here is my attempt:
[{“id”:“434bc37f25516ed4”,“type”:“api-call-service”,“z”:“8201e5453c024752”,“name”:“Andre”,“server”:“a9d24d13.ac599”,“version”:5,“debugenabled”:true,“domain”:“notify”,“service”:“mobile_app_sm_n950f”,“areaId”:[],“deviceId”:[],“entityId”:[],“data”:"{\t “message”:“Front Door Opened.”,\t \t “data”:{\t “ttl”: 0,\t “priority”: “high”\t }\t}",“dataType”:“jsonata”,“mergeContext”:"",“mustacheAltTags”:false,“outputProperties”:[],“queue”:“all”,“x”:630,“y”:520,“wires”:[[]]},{“id”:“c05e202e19b3b109”,“type”:“switch”,“z”:“8201e5453c024752”,“name”:"",“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“on”,“vt”:“str”},{“t”:“eq”,“v”:“not_home”,“vt”:“str”}],“checkall”:“false”,“repair”:false,“outputs”:2,“x”:450,“y”:560,“wires”:[[“434bc37f25516ed4”,“9831376c979b823c”],[“434bc37f25516ed4”,“9831376c979b823c”]]},{“id”:“9831376c979b823c”,“type”:“api-call-service”,“z”:“8201e5453c024752”,“name”:“Riette”,“server”:“a9d24d13.ac599”,“version”:5,“debugenabled”:true,“domain”:“notify”,“service”:“mobile_app_sm_g991b”,“areaId”:[],“deviceId”:[],“entityId”:[],“data”:"{\t “message”:“Front Door Opened.”,\t \t “data”:{\t “ttl”: 0,\t “priority”: “high”\t }\t}",“dataType”:“jsonata”,“mergeContext”:"",“mustacheAltTags”:false,“outputProperties”:[],“queue”:“all”,“x”:630,“y”:580,“wires”:[[]]},{“id”:“6a54373ce60e5ab3”,“type”:“server-state-changed”,“z”:“8201e5453c024752”,“name”:“Front Door”,“server”:“a9d24d13.ac599”,“version”:4,“exposeToHomeAssistant”:false,“haConfig”:[{“property”:“name”,“value”:""},{“property”:“icon”,“value”:""}],“entityidfilter”:“binary_sensor.sonoff_100124ba90”,“entityidfiltertype”:“exact”,“outputinitially”:true,“state_type”:“str”,“haltifstate”:“on”,“halt_if_type”:“str”,“halt_if_compare”:“is”,“outputs”:2,“output_only_on_state_change”:false,“for”:“0”,“forType”:“num”,“forUnits”:“milliseconds”,“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”:100,“y”:560,“wires”:[[“e433a51ce47e4bc4”],[]]},{“id”:“e433a51ce47e4bc4”,“type”:“time-range-switch”,“z”:“8201e5453c024752”,“name”:“Timer”,“lat”:"-26.103668",“lon”:“27.954189”,“startTime”:“sunset”,“endTime”:“07:00”,“startOffset”:0,“endOffset”:0,“x”:250,“y”:500,“wires”:[[“c05e202e19b3b109”],[]],“icon”:“node-red-contrib-bigtimer/timer.png”},{“id”:“eb2fb787389b7156”,“type”:“poll-state”,“z”:“8201e5453c024752”,“name”:“Andre”,“server”:“a9d24d13.ac599”,“version”:2,“exposeToHomeAssistant”:false,“haConfig”:[{“property”:“name”,“value”:""},{“property”:“icon”,“value”:""}],“updateinterval”:“1”,“updateIntervalType”:“num”,“updateIntervalUnits”:“minutes”,“outputinitially”:true,“outputonchanged”:true,“entity_id”:“device_tracker.sm_n950f”,“state_type”:“str”,“halt_if”:“not_home”,“halt_if_type”:“str”,“halt_if_compare”:“is”,“outputs”:2,“x”:90,“y”:640,“wires”:[[“e589312c28bb8c32”],[]]},{“id”:“b1dc395e61de531e”,“type”:“poll-state”,“z”:“8201e5453c024752”,“name”:“Riette”,“server”:“a9d24d13.ac599”,“version”:2,“exposeToHomeAssistant”:false,“haConfig”:[{“property”:“name”,“value”:""},{“property”:“icon”,“value”:""}],“updateinterval”:“1”,“updateIntervalType”:“num”,“updateIntervalUnits”:“minutes”,“outputinitially”:true,“outputonchanged”:true,“entity_id”:“device_tracker.sm_g991b”,“state_type”:“str”,“halt_if”:“not_home”,“halt_if_type”:“str”,“halt_if_compare”:“is”,“outputs”:2,“x”:250,“y”:640,“wires”:[[“e589312c28bb8c32”],[]]},{“id”:“4a10f6f13d45c215”,“type”:“comment”,“z”:“8201e5453c024752”,“name”:“Front Door”,“info”:"",“x”:100,“y”:520,“wires”:[]},{“id”:“e589312c28bb8c32”,“type”:“trigger-state”,“z”:“8201e5453c024752”,“name”:“Front Door”,“server”:“a9d24d13.ac599”,“version”:2,“exposeToHomeAssistant”:false,“haConfig”:[{“property”:“name”,“value”:""},{“property”:“icon”,“value”:""}],“entityid”:“binary_sensor.sonoff_100124ba90”,“entityidfiltertype”:“exact”,“debugenabled”:true,“constraints”:[{“targetType”:“this_entity”,“targetValue”:"",“propertyType”:“current_state”,“propertyValue”:“new_state.state”,“comparatorType”:“is”,“comparatorValueDatatype”:“str”,“comparatorValue”:""}],“inputs”:1,“outputs”:3,“customoutputs”:[{“messageType”:“payload”,“messageValue”:"{“entity_id”:“binary_sensor.sonoff_100124ba90”,“old_state”:{“state”:“off”},“new_state”:{“state”:“on”}}",“messageValueType”:“json”,“comparatorPropertyType”:“always”,“comparatorPropertyValue”:"",“comparatorType”:“is”,“comparatorValue”:"",“comparatorValueDataType”:“str”}],“outputinitially”:true,“state_type”:“str”,“enableInput”:true,“x”:400,“y”:700,“wires”:[[],[],[]]},{“id”:“a9d24d13.ac599”,“type”:“server”,“name”:“Home Assistant”,“version”:5,“addon”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:false,“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}]