So, trying to get my fans working, but one of my fans seems to not be displaying the correct state.
Look at the interesting display as a result of a template and also the States service returning a different state for input_boolean.b1_fan_state:
And I get this weird error in my logs:
Logger: homeassistant.helpers.service
Source: helpers/service.py:129
First occurred: 09:54:15 (7 occurrences)
Last logged: 11:25:36
Unable to find referenced entities input_select.b1_fan_speed
Here is my code:
Configuration
input_boolean:
b1_fan_state:
input_select:
b1_fan_speed:
options:
- "33"
- "66"
- "100"
fan:
- platform: template
fans:
b1_fan:
friendly_name: "Bedroom 1 Fan"
value_template: "{{ states('input_boolean.b1_fan_state') }}"
percentage_template: "{{ states('input_select.b1_fan_speed') }}"
turn_on:
service: script.fan_on
data:
room: "b1"
turn_off:
service: script.fan_off
data:
room: "b1"
set_percentage:
service: script.fan_set_speed
data:
percentage: "{{ percentage }}"
room: "b1"
Scripts
fan_set_speed:
alias: Fan (speed)
mode: queued
sequence:
- service: input_select.select_option
target:
entity_id: input_select.{{ room }}_fan_speed
data:
option: "{{ percentage }}"
- delay:
seconds: 2
#Remove below service/line if you don't want to start fan on slider change#
- service: script.fan_on
data:
room: "{{ room }}"
fan_off:
alias: Fan Off
mode: queued
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.{{ room }}_fan_state
- delay:
seconds: 2
- service: remote.send_command
data:
entity_id: remote.rmpro_remote
command: >
{% if room == "b1" %}
b64:
{% elif room == "b2" %}
b64:
{% elif room == "b3" %}
b64:
{% elif room == "l1" %}
b64:
{% elif room == "d1" %}
b64:
{% endif %}
- service: input_boolean.turn_off
target:
entity_id: input_boolean.{{ room }}_fan_state
fan_on:
alias: Fan On
mode: queued
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.{{ room }}_fan_state
- service: "script.fan_{{ states('input_select.' ~ room ~ '_fan_speed') }}"
data:
room: "{{ room }}"
fan_33:
alias: Fan (min)
mode: queued
sequence:
- service: input_text.set_value
target:
entity_id: input_select.{{ room }}_fan_speed
data:
value: "33"
- service: remote.send_command
data:
entity_id: remote.rmpro_remote
#Variables Below
command: >
{% if room == "b1" %}
b64:
{% elif room == "b2" %}
b64:
{% elif room == "b3" %}
b64:
{% elif room == "l1" %}
b64:
{% elif room == "d1" %}
b64:
{% endif %}
fan_66:
alias: Fan (med)
mode: queued
sequence:
- service: input_text.set_value
target:
entity_id: input_select.{{ room }}_fan_speed
data:
value: "66"
- service: remote.send_command
data:
entity_id: remote.rmpro_remote
#Variables Below
command: >
{% if room == "b1" %}
b64:
{% elif room == "b2" %}
b64:
{% elif room == "b3" %}
b64:
{% elif room == "l1" %}
b64:
{% elif room == "d1" %}
b64:
{% endif %}
fan_100:
alias: Fan (max)
mode: queued
sequence:
- service: input_text.set_value
target:
entity_id: input_select.{{ room }}_fan_speed
data:
value: "100"
- service: remote.send_command
data:
entity_id: remote.rmpro_remote
#Variables Below
command: >
{% if room == "b1" %}
b64:
{% elif room == "b2" %}
b64:
{% elif room == "b3" %}
b64:
{% elif room == "l1" %}
b64:
{% elif room == "d1" %}
b64:
{% endif %}