Node-Red | Dim a "Switch node" in percentage instead of just brightness?

Hi you all,

I am trying to get some lights to dim further if the current state is 50% or lower.
I was trying it with a “switch node”, (because I think it is the way to do it).

I tried the data.attributes.brightness_pct and data.attributes.brightness_pct
But doesn’t seem to work.

Does anyone have a solution for this?

asdfasfasdfadsadsfasfasfasdfafawfe

[{"id":"9ad02e96.53bfe8","type":"api-call-service","z":"db795106.4f449","name":"Zet keukenlamp 25%","server":"9b8bc642.fed038","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.slaapkamer_lamp_boven_bed","data":"{\"brightness_pct\":25,\"transition\":5}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1220,"y":280,"wires":[[]]},{"id":"a7f3fa45.fd1778","type":"time-range-switch","z":"db795106.4f449","name":"Tussen 20:00 en 05:00","lat":"52.12","lon":"4.65","startTime":"08:00","endTime":"20:00","startOffset":0,"endOffset":0,"x":650,"y":240,"wires":[["1eec56a3.48f379"],[]]},{"id":"30a5eba6.4a1b84","type":"time-range-switch","z":"db795106.4f449","name":"Tussen 20:00 en 05:00","lat":"52.12","lon":"4.65","startTime":"08:00","endTime":"20:00","startOffset":0,"endOffset":0,"x":650,"y":360,"wires":[["96bf9a27.526278"],[]]},{"id":"629a5695.44a178","type":"api-call-service","z":"db795106.4f449","name":"Zet keukenlamp 15%","server":"9b8bc642.fed038","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.slaapkamer_lamp_boven_bed","data":"{\"brightness_pct\":15,\"transition\":5}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1200,"y":420,"wires":[[]]},{"id":"452e2582.c2b2f4","type":"server-state-changed","z":"db795106.4f449","name":"Shield","server":"9b8bc642.fed038","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"media_player.google_home_zolder","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":150,"y":300,"wires":[["a730a944.20f69"]]},{"id":"a730a944.20f69","type":"switch","z":"db795106.4f449","name":"Switch pauze, uit & afspelen","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"paused","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"stop","vt":"str"},{"t":"eq","v":"stopped","vt":"str"},{"t":"eq","v":"playing","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":380,"y":300,"wires":[["a7f3fa45.fd1778"],["a7f3fa45.fd1778"],["a7f3fa45.fd1778"],["a7f3fa45.fd1778"],["30a5eba6.4a1b84"]]},{"id":"1eec56a3.48f379","type":"api-current-state","z":"db795106.4f449","name":"Keukenlamp lager dan 20%","server":"9b8bc642.fed038","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.slaapkamer_lamp_boven_bed","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":880,"y":120,"wires":[["815952f.a5edb3"]]},{"id":"96bf9a27.526278","type":"api-current-state","z":"db795106.4f449","name":"Keukenlamp lager dan 20%","server":"9b8bc642.fed038","version":1,"outputs":2,"halt_if":"25","halt_if_type":"num","halt_if_compare":"lte","override_topic":false,"entity_id":"light.slaapkamer_lamp_boven_bed","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":880,"y":460,"wires":[["629a5695.44a178"],[]]},{"id":"815952f.a5edb3","type":"switch","z":"db795106.4f449","name":"","property":"attributes.brightness_pct","propertyType":"msg","rules":[{"t":"lt","v":"25","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":220,"wires":[["9ad02e96.53bfe8"]]},{"id":"9b8bc642.fed038","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]

I think your property is incorrect. Unfortunately I cannot say what is right. My tip is to place a debug node right after the state change node to find out. If you output the complete message object, you can easily determine the correct property path.