Hi,
Is there a way to make a switch that does nothing? I just wan’t to assign a switch to each of my home temp sensors, so I can use the state of the switch as a condition to choose which sensor controls my central heating.
I could probably use GPIO’s that are not in use but I don’t really want to use the rpi_gpio platform if there’s a better alternative.
Any other suggestions are welcome, I’m very new to all this.
Thanks for the suggestion. I did look at input_boolean, as a way of setting up some conditions for the automatiuon, but I can’t see how I can use this to select a specific sensor that will be used for the trigger. It would appear that I’d still need some switches assigned to the sensors for this to work?
Create an input_boolean for each of your temp senors, name it, for example, “primary sensor” with an additional location description like “primary sensor livingroom”.
Make them “off” by default (maybe except for one “default primary sensor”).
Create an automation that turns off all the other “primary sensor” switches as soon as one is switched on.
Then, in your central heating automation, simply check which sensor has its accompanying “primary sensor” switch turned on and use that one’s value.
I’ve got the code working! So this next query is not really necessary but I’d really like to streamline things, just in case I plan to do something similar in the future.
I’ve copied the code from my config file below. Is there a better way to write this?
# automation to make sure only one temp sensor is used for central heating
automation:
- alias: select_l
trigger:
- platform: state
entity_id: input_boolean.select_livingroom_sensor
from: 'off'
to: 'on'
action:
service: homeassistant.turn_off
entity_id:
- input_boolean.select_hallway_sensor
- input_boolean.select_bedroom_sensor
- input_boolean.select_isabels_room
- input_boolean.select_rowans_room
- alias: select_h
trigger:
- platform: state
entity_id: input_boolean.select_hallway_sensor
from: 'off'
to: 'on'
action:
service: homeassistant.turn_off
entity_id:
- input_boolean.select_livingroom_sensor
- input_boolean.select_bedroom_sensor
- input_boolean.select_isabels_room
- input_boolean.select_rowans_room
- alias: select_b
trigger:
- platform: state
entity_id: input_boolean.select_bedroom_sensor
from: 'off'
to: 'on'
action:
service: homeassistant.turn_off
entity_id:
- input_boolean.select_hallway_sensor
- input_boolean.select_livingroom_sensor
- input_boolean.select_isabels_room
- input_boolean.select_rowans_room
- alias: select_i
trigger:
- platform: state
entity_id: input_boolean.select_isabels_room
from: 'off'
to: 'on'
action:
service: homeassistant.turn_off
entity_id:
- input_boolean.select_hallway_sensor
- input_boolean.select_bedroom_sensor
- input_boolean.select_livingroom_sensor
- input_boolean.select_rowans_room
- alias: select_r
trigger:
- platform: state
entity_id: input_boolean.select_rowans_room
from: 'off'
to: 'on'
action:
service: homeassistant.turn_off
entity_id:
- input_boolean.select_hallway_sensor
- input_boolean.select_bedroom_sensor
- input_boolean.select_isabels_room
- input_boolean.select_livingroom_sensor