Hi, need some help to write a code for Lovelace , Picture Element.
I tried to search HA forum and Github, but could not find any similar application. Please kindly direct me to the right post if there is already resource available, Thanks in Advance.
My objective is to use Picture Element, place an Air-Conditioner icon on it.
Use this Icon to activate 2 different scene, “turn on the AC” and “turn off the AC” scene.
At the same time change the color of the ICON for each scene triggered.
My AC does not have state feedback, and I am using Tuya IR remote.
I can only turn on my AC by activating the Tuya IR remote scene.
a) scene.turn on AC
b) scene.turn off AC.
I am thinking if I could use the State-Icon element, use Tap Action: toggle to trigger 2 call-service, one to call-service “scene.turn on AC”, the other to call-service “scene.turn off AC”. at the same time make the Icon to change color for the toggled scene.
At the moment, I have only successfully written a code to toggle icon color with the state-icon element. I am thinking if I could use it to activate 2 call-services in the toggle mode. I will just get my IR remote to fire 2 scene although I do not know the actual state of the AC…
Or maybe it is not possible, could you suggest other method if this is not possible, Thanks
The drawback here is that you’ll get out of sync with your device here and there. The good news is that you just need to physically change the state on the device or call one of the scenes without touching the switch.
Hi, appreciate your immediate response.
Does that mean I will input all these 3 scripts into ui-lovelace.yaml file?
Sorry for this dumb question, I am really a beginner…
So we are actually faking a “tuya_ac” switch…cool.
I will take sometime to experiment with it and digest. I will give a feedback if it is successful.
Thanks for your generous help. Looking at the code, I cannot see myself getting this far if I am on my own…Thanks, really appreciate.
As I am excited, I tried it out immediately, unfortunately the icon didn’t show up and come with an error message when mouse over “entity not available: switch.tuya_ac”
Voila! It work perfectly. Thanks @petro.
I almost wanted to buy a dummy smart switch just to achieve the same purpose.
Didn’t know we can create a fake switch in HA.
Brilliant!