Hello everyone what i want to do with xiaomi wireless button is
one click : Light_A > ON, another one click, Light_A > off ( already ok in the code)
double click : Light_B > ON, another one click, Light_B > off ( already ok in the code)
long click :
if Light_A or Light _B is on , then the button will turn off Light_A or Light _B
if both Light_A and Light _B is on, then will turn off both Light_A and Light _B
if both Light_A and Light_B is off, then will turn on both Light_A and Light _B
One click and double click already can success in the code , I want to add one more “if “ after long click. Can someone help me to edit the code (shout be the code formation issue) or provide some advice?
My automation :
alias: Toggle kitchen light on single press
trigger:
But when i go check the webside one min ago.
————
It said :
SERVICE LIGHT.TOGGLE
Toggles the state of one or multiple lights using groups. Takes the same arguments as turn_on service.
Note : If light.toggle is used for a group of lights, it will toggle the individual state of each light.
————
I also will try first when i back home . And I also want to know , homeassistant automation only allow one ‘if’? Can not input the second if under the frist ‘if’ just like c++?
But when i go check the webside one min ago.
————
It said :
SERVICE LIGHT.TOGGLE
Toggles the state of one or multiple lights using groups. Takes the same arguments as turn_onservice.
Note : If light.toggle is used for a group of lights, it will toggle the individual state of each light.
————
I also will try first when i back home . And I also want to know , homeassistant automation only allow one ‘if’? Can not input the second if under the frist ‘if’ just like c++?
thanks a lot.!! the code already bothered me for a few days…
and i wanna ask , your way is to create a light.group to finish it, let homeassistant think this group is a light to make it happen? so we can definition different to different things? if it is a switch we can also change it to a light? can i delete the old object (F_switch) in the data once i changed (F_switch) to a light( F_light)?
and also how can i change the entity id for example : binary_sensor.motion_sensor_158d00097ka309 to binary_sensor.motion_sensor_a?
it will more easy to write the code.