I would like to change my AC code so it will detect its state, whether its on or off. The old script bellow. Currently, I add new plugs that cover the electrical usage so I will be able to make a new binary_sensor that show the AC status on/off. Now how do I change it states. The new binary called binary_sensor.ac_daikin_real_status
script:
- sequence:
#activate turn_off only if switch.ac_power is 'on'
- condition: template
value_template: >
{% if is_state('switch.ac_power', 'off') %}
true
{% elif is_state('switch.ac_power', 'on') %}
false
{% else %}
false
{% endif %}
- service: switch.turn_on
entity_id: switch.ac_power
# AC Scripts
- sequence:
#activate turn_off only if switch.ac_power is 'on'
- condition: template
value_template: >
{% if is_state('switch.ac_power', 'on') %}
true
{% elif is_state('switch.ac_power', 'off') %}
false
{% else %}
false
{% endif %}
- service: switch.turn_off
entity_id: switch.ac_power
switch:
- platform: broadlink
# host: !secret broad_rm_ip
mac: !secret broad_rm_mac
# timeout: 20
# retry: 5
switches:
# Switches AC
- name: "AC Power"
command_on: 'JgC8AXI4DisODg4ODg4PKg4ODg8ODg4ODisODg4qDyoODg8qDioPKg4qDyoODg4PDioODg8ODg4ODg4ODw4OKg8qDioPKg4ODw4ODg4ODg4ODw4ODg4ODg8ODg4ODg4PDg4ODg4ODw4ODg4ODg4PDg4ODg4ODw4ODioPDg4ODg4ODg8ODg4OAAPMcTkOKg4PDg4ODg4rDg4ODg4ODw4OKg8ODioOKw4ODioPKg4rDioOKw4ODg4OKw4ODg4PDg0PDg4ODg8ODQ8ODg4PDg4ODg4ODw4ODg4ODg4PDg4qDg8ODg4ODisOKg4ODw4ODg4ODw4ODg4qDyoODg4PDg4ODg4ODw4ODg4ODg4PDg4ODg4ODw4ODioPKg4ODg4PDg4ODg4ODw4ODg4ODg8ODg4ODg4ODw4ODg4ODg8ODg4ODg4PDg4ODg4ODg8ODg4ODg8ODg4ODg4ODw4ODg4ODg4PDg4ODg4PDg4ODg4ODg8ODg4ODg4PDg4ODg4ODw4ODg4ODg4PDg4ODg4OKw4qDw4ODg4ODg4PDg4ODg4ODw4ODg4ODg8ODg4ODg4ODw4OKg8qDg4ODg8ODioOKw4ODgANBQAAAAAAAAAAAAAAAA=='