good day.
I try to create a flow and it is beyond my power.
I have several dozen devices and I’m trying to create a flow that would:
- notified a specific device to the mobile device that has just disconnected or connected to the wifi.
- and at the same time added to the message the exact time of disconnection or connection in the format 22:55:59 hours 13.12.2021
the messages should therefore read:
The device xyz disconnected from wifi on xx.xx.xxxx at xx: xx: xx hours.
and
The xyz device connected wifi on xx.xx.xxxx at xx: xx: xx hours.
I have a problem with entities entity_xyz_status where disconnected is “unavailable” and the state for connection is a value in%, I do not want to notify every change of value% so I would like to state as “previous state”: “unavailable”.
I can’t do this in conjunction with reading the friendly_name attribute.
[{"id":"ae95bf2e903ba71e","type":"api-call-service","z":"4430f113656a1199","name":"message 1","server":"1c1ccadc.716d65","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_p30_lite_1","entityId":"","data":"true","dataType":"jsonata","mergecontext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":890,"y":360,"wires":[[]]},{"id":"66e8804abbc91c97","type":"function","z":"4430f113656a1199","name":"disconnect wifi","func":"const friendlyName = msg.data.new_state.attributes.friendly_name;\nnode.status({text: friendlyName});\nreturn {\n \"payload\": {\n \"data\": {\n \"message\":\"device: \" + friendlyName + \" disconnect WiFi\"\n } \n }\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":400,"wires":[["ae95bf2e903ba71e","b0607e78cd48e111"]]},{"id":"b0607e78cd48e111","type":"api-call-service","z":"4430f113656a1199","name":"message 2","server":"1c1ccadc.716d65","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_tablet_2","entityId":"","data":"payload","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":440,"wires":[[]]},{"id":"cf35eb56f089f5d6","type":"api-call-service","z":"4430f113656a1199","name":"message 1","server":"1c1ccadc.716d65","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_p30_lite_1","entityId":"","data":"payload","dataType":"jsonata","mergecontext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":890,"y":560,"wires":[[]]},{"id":"dc73d1bdf2eb414d","type":"function","z":"4430f113656a1199","name":"connect wifi","func":"const friendlyName = msg.data.new_state.attributes.friendly_name;\nnode.status({text: friendlyName});\nreturn {\n \"payload\": {\n \"data\": {\n \"message\":\"Zařízení: \" + friendlyName + \" se právě připojilo k WiFi\"\n } \n }\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":600,"wires":[["cf35eb56f089f5d6","8d2af609433b6d7b"]]},{"id":"8d2af609433b6d7b","type":"api-call-service","z":"4430f113656a1199","name":"message 2","server":"1c1ccadc.716d65","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_tablet_2","entityId":"","data":"payload","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":640,"wires":[[]]},{"id":"0bfa4140ca639669","type":"server-state-changed","z":"4430f113656a1199","name":"device.1.status","server":"1c1ccadc.716d65","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.hdo_indikator_status","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unavailable","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":180,"y":380,"wires":[["66e8804abbc91c97"],[]]},{"id":"cea97c8a9cb4f6cf","type":"server-state-changed","z":"4430f113656a1199","name":"device.2.status","server":"1c1ccadc.716d65","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.hdo_indikator_status_2","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unavailable","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":180,"y":480,"wires":[["66e8804abbc91c97"],[]]},{"id":"8222f291db0dadff","type":"server-state-changed","z":"4430f113656a1199","name":"device.3.status","server":"1c1ccadc.716d65","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.hdo_indikator_status_3","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unavailable","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":180,"y":580,"wires":[["66e8804abbc91c97"],[]]},{"id":"1c1ccadc.716d65","type":"server","name":"Dubak_HAss","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Thank you for your help.