Device state to fire again as same state?

I’m using a Aqara Mini Switch Button which has three clicks: single, double, and hold.

I am trying to control my bedside lamp and my wife’s based on clicks…

If I click once to turn on the light, the state of the click will register as single and I can’t press a single again to turn it off… I would have to change the initial state by issuing a double or long hold and then press the single again… Is there any way to make the state of the aqara go null after click? Node Red is seeing each click and then not allowing a secondary click of the same state (single, double, hold)…

Use: Click once and it turns on her lamp / click once again to turn off, click twice for mine. hold to check which devices are on/off and then either turn on which light is off, turn on both, or turn off both depending on the states of the lamps…

I think you should try using light.toggle instead, so a single click will turn off if currently on, or on if currently off.

Doesn’t work because if I press a single click and then press it again, the device state isn’t changing. I would have to double click or hold to change the state and then do a single press for node red to pick up the state of single click.

unmarking “Output only on stage change” doesn’t help?

image

Nope. I have tried it with the box checked and unchecked :\

OK I am using trigger:state node instead of the one you are using with hue dimmers and it register each click even I press same button multiple times.

Tried that again… Still not able to get the aqara button to fire multiple presses of the same type… Any chance you could be so kind to share a simple flow where a device is responding via the same click? I do appreciate you helping out!

As I said I am using 4-button-dimmer from Hue with hue custom component. when I click button 2, it is increasing brightness by 20% with each click. i think this is aligning what you are trying to reach.

BUT, now I am not at home so I tried to simulate clicking in state tab of the developers window and indeed it is not registering the subsequent clicks. So I also need to change the data attributes as well in order node red to recognize it. are you playing in the state tab or physically using the buttons?
you know what I am trying to say? maybe each click has to be marginally different from the previous state in order to be recognized a state update…

[{"id":"502937ac.4cfc58","type":"switch","z":"8ad7a884.2c35b8","name":"buttons","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1_click_up","vt":"str"},{"t":"eq","v":"2_click_up","vt":"str"},{"t":"eq","v":"3_click_up","vt":"str"},{"t":"eq","v":"4_click_up","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":340,"y":140,"wires":[["3272b075.7f04"],["19260b90.87d704","c557b2af.48c71"],["6f0d79bb.72db18","49a1dbdb.af75b4"],["cea30c8b.4c49e"]]},{"id":"7bce3211.f4924c","type":"trigger-state","z":"8ad7a884.2c35b8","name":"Dimmer Switch 2","server":"e447d17a.16a64","entityid":"sensor.hue_dimmer_switch_2","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":130,"y":140,"wires":[["502937ac.4cfc58"],[]]},{"id":"19260b90.87d704","type":"api-current-state","z":"8ad7a884.2c35b8","name":"bedroom","server":"e447d17a.16a64","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.bedroom","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":540,"y":160,"wires":[["b728dad6.faf318"],[]]},{"id":"c557b2af.48c71","type":"api-current-state","z":"8ad7a884.2c35b8","name":"kids","server":"e447d17a.16a64","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.kid_s_room","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":530,"y":80,"wires":[["79adaf21.4c79"],[]]},{"id":"b728dad6.faf318","type":"function","z":"8ad7a884.2c35b8","name":"increase brightness","func":"varBright = msg.data.attributes.brightness;\nvarEntity = msg.data.entity_id;\nif (varBright < 200) {varBrightness = varBright + 50}\nelse {varBrightness = 254}\nmsg.payload = {\"entity_id\":varEntity}\nmsg.payload.data = {\"brightness\":varBrightness}\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":160,"wires":[["5ee61259.d3a04c"]]},{"id":"5ee61259.d3a04c","type":"api-call-service","z":"8ad7a884.2c35b8","name":"bedroom","server":"e447d17a.16a64","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"{{payload.entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":180,"wires":[[]]},{"id":"79adaf21.4c79","type":"function","z":"8ad7a884.2c35b8","name":"increase brightness","func":"varBright = msg.data.attributes.brightness;\nvarEntity = msg.data.entity_id;\nif (varBright < 200) {varBrightness = varBright + 50}\nelse {varBrightness = 254}\nmsg.payload = {\"entity_id\":varEntity}\nmsg.payload.data = {\"brightness\":varBrightness}\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":80,"wires":[["cbd07bd9.6bd9b8"]]},{"id":"cbd07bd9.6bd9b8","type":"api-call-service","z":"8ad7a884.2c35b8","name":"kids room","server":"e447d17a.16a64","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"{{payload.entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":100,"wires":[[]]},{"id":"6f0d79bb.72db18","type":"api-current-state","z":"8ad7a884.2c35b8","name":"bedroom","server":"e447d17a.16a64","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.bedroom","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":540,"y":200,"wires":[["4da73cd6.c974a4"],[]]},{"id":"49a1dbdb.af75b4","type":"api-current-state","z":"8ad7a884.2c35b8","name":"kids","server":"e447d17a.16a64","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.kid_s_room","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":530,"y":120,"wires":[["c6890385.59443"],[]]},{"id":"4da73cd6.c974a4","type":"function","z":"8ad7a884.2c35b8","name":"decrease brightness","func":"varBright = msg.data.attributes.brightness;\nvarEntity = msg.data.entity_id;\nif (varBright > 50) {varBrightness = varBright - 50}\nelse {varBrightness = 1}\nmsg.payload = {\"entity_id\":varEntity}\nmsg.payload.data = {\"brightness\":varBrightness}\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":200,"wires":[["5ee61259.d3a04c"]]},{"id":"c6890385.59443","type":"function","z":"8ad7a884.2c35b8","name":"decrease brightness","func":"varBright = msg.data.attributes.brightness;\nvarEntity = msg.data.entity_id;\nif (varBright > 50) {varBrightness = varBright - 50}\nelse {varBrightness = 1}\nmsg.payload = {\"entity_id\":varEntity}\nmsg.payload.data = {\"brightness\":varBrightness}\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":120,"wires":[["cbd07bd9.6bd9b8"]]},{"id":"cea30c8b.4c49e","type":"api-call-service","z":"8ad7a884.2c35b8","name":"bedroom toggle","server":"e447d17a.16a64","version":1,"debugenabled":false,"service_domain":"light","service":"toggle","entityId":"light.bedroom","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":560,"y":240,"wires":[[]]},{"id":"3272b075.7f04","type":"api-call-service","z":"8ad7a884.2c35b8","name":"kids toggle","server":"e447d17a.16a64","version":1,"debugenabled":false,"service_domain":"light","service":"toggle","entityId":"light.kid_s_room","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":550,"y":40,"wires":[[]]},{"id":"e447d17a.16a64","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]