Scene switch and lights

There is a Scene Switch whose status is Single click, Double click, etc.
To begin with, I would like to turn the light on and off using Single click.
I don’t know how to do this, and so far I’ve only been able to make it turn on with Single click and turn off with Double click.
Is it possible to perform both actions only using Single click?
Here’s what happened so far:

[{"id":"51ecfa0f622129ab","type":"tab","label":"Поток 5","disabled":false,"info":"","env":[]},{"id":"cae40b18d8f240f7","type":"server-state-changed","z":"51ecfa0f622129ab","name":"","server":"10cea322.6322ad","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"select.vykliuchatel_switch_1","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":60,"wires":[["692f1339a85e4dd9"]]},{"id":"692f1339a85e4dd9","type":"change","z":"51ecfa0f622129ab","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Single click","fromt":"str","to":"on","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Double click","fromt":"str","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":160,"wires":[["f375b2def998fb42"]]},{"id":"f375b2def998fb42","type":"switch","z":"51ecfa0f622129ab","name":"on and off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":420,"y":160,"wires":[["fb2a30eb57917a1c"],["fb2a30eb57917a1c"]]},{"id":"fb2a30eb57917a1c","type":"api-call-service","z":"51ecfa0f622129ab","name":"","server":"10cea322.6322ad","version":5,"debugenabled":false,"domain":"switch","service":"turn_{{payload}}","areaId":[],"deviceId":[],"entityId":["switch.unknown_switch_1_2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":660,"y":220,"wires":[[]]},{"id":"10cea322.6322ad","type":"server","name":"Home Assistant","addon":true}]

Let’s start with make and model number of the device. Then how it’s integrated into HA.

We need to know what it is and what it’s capable of before advising how to do things.

Bought in China and here is what information the seller has:

Tuya Zigbee Smart Switch 1/2/3 gang - I have a one-key one

Characteristics
Brand Name - None
Origin Mainland - China
Material - Plastic
Item Type - Switches
Certification - FCC
Is Smart Device - YES
Features - zigbee
Certification - CCC
Switch Type - Push Button Switch
Measurement unit - piece/pieces
Each pack - 1
feature - Scene Switch
feature 1 - tuya
feature 2 - Tuya ZigBee Scene Switch
Is Smart Device - YES
Material - Plastic
Switch Type - Push Button Switch
Certification - CCC
Origin - Mainland China
Item Type - Smart Switch
feature 3 - Remote Control
feature 4 - Scene Setting
feature 5 - Tuya Smart Home
feature 6 - Smart Life APP
feature 7 - Tuya Smart Life APP Remote Control
feature 8 - Wireless scene switch

That’s all I know about the device.
Passed to HA via LocalTuya

In the change node you are using "Single click" instead use single_click, double_click and long_press

Don’t quite understand how to do this?

In your flow, the change node. search for single_click instead of Single click. The same for double.

Your option is not working, if you make single_click instead of Single click, then nothing happens, if you leave Single click, then the light turns on.
Apparently I didn’t quite clearly explain what was required, now my light turns on with Single click and turns off with Double click, but this is not convenient, I would like the light to turn on and off with Single click, etc. I pressed the button once and the light turned on, pressed it again and it turned off.

Ok, in the call service use toggle instead of turn_on/turn_off.

image

then use only a switch to differentiate between single and double clicks.

[{"id":"cae40b18d8f240f7","type":"server-state-changed","z":"51ecfa0f622129ab","name":"","server":"","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"select.vykliuchatel_switch_1","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":60,"wires":[["f375b2def998fb42"]]},{"id":"f375b2def998fb42","type":"switch","z":"51ecfa0f622129ab","name":"single or double","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Single click","vt":"str"},{"t":"eq","v":"Double click","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":560,"y":60,"wires":[["fb2a30eb57917a1c"],["1836e098ed948e63"]]},{"id":"fb2a30eb57917a1c","type":"api-call-service","z":"51ecfa0f622129ab","name":"","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"switch","service":"toggle","areaId":[],"deviceId":[],"entityId":["switch.unknown_switch_1_2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":810,"y":60,"wires":[[]]},{"id":"1836e098ed948e63","type":"debug","z":"51ecfa0f622129ab","name":"do something with a double click","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":140,"wires":[]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

2024-04-03_3-45-49

Here double click is superfluous, it is not needed at all, turning it on and off works without it, thank you.

But there is another problem, at first I thought that I was doing something wrong, but apparently this is a feature of this device, if I’m wrong, correct me, maybe this can be solved somehow.
The problem is this: if you press it once - Single click, the light turns on, if you press it once again - Single click, then nothing happens, but if you press it twice - Double click, etc. The device status will be Double click and then press again once - Single click, then the light will turn off.
I don’t know if I described it clearly or not, but to turn the light on or off, you first need to change the status to any other and only then you can turn it on or off with one click - Single click.

Is this a feature of the device or is there a way to solve this?

In the event state node uncheck this box.

image