Hi all, somewhat of a newb here with NodeRED. I am trying to have my Shelly switches automatically adjust to max brightness when their physical switch is pressed. I am trying to do this in NodeRED (but if anyone knows an easier alternative, I’m definitely open to trying it), and have confirmed this is possible with this flow:
[{"id":"e9995e8e98de0842","type":"server-events","z":"9101afde4c3e71c9","name":"","server":"790d432d.fb71ac","version":2,"eventType":"shelly.click","exposeToHomeAssistant":false,"eventData":"","haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"}],"event_type":"","x":110,"y":1440,"wires":[["dca40aad83b99652"]]},{"id":"dca40aad83b99652","type":"api-current-state","z":"9101afde4c3e71c9","name":"","server":"790d432d.fb71ac","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.office_light","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"payload.event.device","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":390,"y":1440,"wires":[[],["9671249574d77665"]]},{"id":"9671249574d77665","type":"delay","z":"9101afde4c3e71c9","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":670,"y":1440,"wires":[["c5a7cf4a8e7907b5"]]},{"id":"c5a7cf4a8e7907b5","type":"api-call-service","z":"9101afde4c3e71c9","name":"Light Brightness Max","server":"790d432d.fb71ac","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":["5a3f823af3ad1c7e0c59dde92295124c"],"entityId":[],"data":"{\"brightness_step_pct\":100}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":1440,"wires":[[]]},{"id":"790d432d.fb71ac","type":"server","name":"Home Assistant","addon":true}]
The issue here is “events: shelly.click” only returns the device id and name, not the entity ID, so I am unable to pass the specific entity into the current state and call service nodes.
As a result, the above flow will only affect the hard-coded “light.office_light” and not necessarily the light that was actually phiscally switched on/off.
Is there is a way to convert a “device_id” or “device” to an “entity_id”? Is this even the right way of trying to achieve what I want? I would appreciate any assistance