Hi! Is it possible to create a entity that includes script actions? Let me explain what I need.
I want to control an air conditioner using the broadlink IR integration, the problem is the A/C got different remote codes for ON/OFF so I have to create a script for each operation. I want to expose this to homekit without having two separate operations. So, is it possible to create like a fake or virtual switch/fan entity that link those ON/OFF operations to the broadlink scripts?
Template switch can do this
Thanks, Im trying with template switch but it doesn’t triggers the scripts, here’s my template
switch:
- platform: template
switches:
aire_sala:
value_template: "{{ is_state('sensor.aire_sala', 'on') }}"
turn_on:
service: switch.turn_on
target:
entity_id: script.airesalaon
turn_off:
service: switch.turn_off
target:
entity_id: script.airesalaoff
Am I doing something wrong?
You don’t use the switch.turn_on service for scripts. Call the script directly or use script.turn_on
Thanks, I called the script directly and removed target, when touch, this calls the ON script but the sensor stays at “off” state so the second touch won’t trigger the OFF script. How can I fix this?
Remove the value_template
Simple as that, thanks petro!
Hello Gado,
Can you give me some advice? I’m trying to do something similar with the broadlink IR transceiver. Just trying to call a script as a light or swith.
Do you have an example perhaps?
thanks