Help in getting light switches to trigger a notification when turned on or off


I have some TP-Link switches and got the telegram notification working, but only when I toggle the timestamp switch in node red. Pressing the actual switch in the kitchen doesn’t send a notification and same when using the Kasa app.

My flow that I created is obviously bad, so curious if anyone could help me make a better flow? Still a total noob, even after watching some of drzzs videos.
Thanks.

You’re using the wrong ha node, switch to “events: state” node, once you get the grasp of using the ha nodes in general you can move into the trigger state node.

So if you want any notifications of state changed leave the “halt if” empty. If you want to receive only when on, then put halt if “off”,


Thanks! Finally got it working!
Used Events:State > Switch > Telegram Notify

You can replace the double output switch if you use “halt if”, using that option generates a second output in the state node which passes everything that is halted or not matched from the first output.

Are you able to whip up an example along with a screenshot? Thanks, I saw the halt option, but it still confused me. This was the tutorial I was using before

Here’s an example of what subzero is talking about with a device tracker state home or not_home.

It’s a newer functionality of the HA palette. The halt if property used to do nothing, but now it opens up a 2nd output from the node that is the “halt if” or the condition is true output. You can eliminate those switch nodes which are doing the same thing.

[{"id":"b6fd03.48b8e3","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ef47b7e2.3d4b88","type":"server-state-changed","z":"b6fd03.48b8e3","name":"Device Tracker","server":"37567a14.bdb636","entityidfilter":"device_tracker.phone_justin","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"not_home","halt_if_type":"str","halt_if_compare":"is","outputs":2,"x":110,"y":180,"wires":[["63a7aa34.f033e4"],["8c309773.9c8258"]]},{"id":"63a7aa34.f033e4","type":"api-call-service","z":"b6fd03.48b8e3","name":"Do A Thing If Home","server":"37567a14.bdb636","service_domain":"","service":"","data":"","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":350,"y":140,"wires":[[]]},{"id":"8c309773.9c8258","type":"api-call-service","z":"b6fd03.48b8e3","name":"Do A Different Thing If Not Home","server":"37567a14.bdb636","service_domain":"","service":"","data":"","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":400,"y":200,"wires":[[]]},{"id":"37567a14.bdb636","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"}]