Check who changed entity state then notify only that person

Is there a way to check who changed the state of entity and then notify only that person?

What Iā€™m trying to do is to notify only the person that activated sprinklers instead of the whole family. The sprinklers will automatically deactivate after 20min and then I want to send the notification.

how do you activate the sprinkler? How is HA supposed to know who turned it on? Mobile app?

node-red-contrib-map

[{"id":"e478ab5de292a4ad","type":"server-state-changed","z":"91a80f99.6180e","name":"","server":"","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.sprinkler","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":"data","propertyType":"msg","value":"","valueType":"eventData"}],"x":270,"y":4256,"wires":[["154a3d9a4af89d61"],[]]},{"id":"154a3d9a4af89d61","type":"delay","z":"91a80f99.6180e","name":"","pauseType":"delay","timeout":"20","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":494,"y":4256,"wires":[["7520abc27ca75379"]]},{"id":"7520abc27ca75379","type":"map-map","z":"91a80f99.6180e","name":"","config":"ae81f2d898cc3aa2","in":"data.context.user_id","inType":"msg","inLhsOrRhs":"lhs","out":"service","outType":"msg","outLhsOrRhs":"rhs","caseInsensitive":true,"forwardIfNoMatch":false,"defaultIfNoMatch":"Unknown: {{{data.context.user_id}}}","x":638,"y":4256,"wires":[["fde3a588dc56986e"]]},{"id":"fde3a588dc56986e","type":"api-call-service","z":"91a80f99.6180e","name":"","server":"","version":5,"debugenabled":false,"domain":"notify","service":"{{service}}","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\": \"Sprinkler off\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":800,"y":4256,"wires":[[]]},{"id":"ae81f2d898cc3aa2","type":"map-config","name":"user id > notify","lhsName":"user id","rhsName":"notify","mappings":[{"lhs":"user001","rhs":"notify.mobile_app_homer"},{"lhs":"user002","rhs":"notify.mobile_app_marge"}]}]
1 Like

usefull?

Every action done on UI, is done by the currently logged on person, hence that data is available :wink:

2 Likes

Thanks! This helped!