Switch node not working for string comparison with 'on'/'off' values

I am trying to use the switch node after a current state node to check whether the device is turned on or off, and based on that value, perform a subsequent operation. Inside the switch node, I am doing a direct comparison to see if the value matches a string with "on" or "off". However, it's not working, and I can't understand why. I'm forced to create a custom function where I use an "if" statement and the "===" operator for comparison. This way, it works. Is it possible to do the same comparison in the switch node? How can I avoid using a custom function?

Show us what is going into the Switch node (using a debug node) and how you have configured the node. We are not telepathic so it is impossible to know what is wrong if you do not show us what you have tried.

Here it is the code for this flow : Test - Pastebin.com

Could you take a look? You can change the device with any other you have.
this is what is going inside the switch node.

{"_msgid":"8f65cfa7583d532e","payload":"on","topic":"","data":{"entity_id":"media_player.webos_tv","state":"on","attributes":{"source_list":["Accessibilità","AirPlay","All 4","Apple TV","Attività","BBC iPlayer","Browser Web","Canali TV","Configurare la TV per Amazon Alexa","Configurare la TV per Assistente Google","Connettore dispositivo","Developer Mode","Foto e video","GALLERIA","Google","Guida TV","HDMI ARC","IPTV Smarters Player","ITVX","LG Channels","LG Content Store","MKIPTV","Manuale d'uso","Multi-view","Musica","My5","NOW","Netflix","Notifiche","PC","Prime Video","Rakuten TV","Registrazioni","Riproduzione audio Bluetooth","Screen Share","Servizio remoto LG","Smart IPTV","Smart STB","TV Cast","VOYO","YouTube"],"volume_level":0.02,"is_volume_muted":false,"source":"PC","sound_output":"external_arc","assumed_state":true,"device_class":"tv","entity_picture":"/api/media_player_proxy/media_player.webos_tv?token=6318c843b84b8041d8b61c1c34479287694ff47332534bf1994baaff304da638&cache=9ab22af5828b3226","friendly_name":"webOS TV","supported_features":24377},"context":{"id":"01GZRZC0EBR0MPZ4DHKN80QWE8","parent_id":null,"user_id":null},"last_changed":"2023-05-06T10:42:39.091Z","last_updated":"2023-05-06T16:47:24.107Z","timeSinceChangedMs":25045338}}

I check if payload is on or off.

Typo in switch node property field paylod

Really? Oh my gosh…I am blind…thank you!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.