Sorry for the noob’s and completely non-programmer’s question.
I have several temp. sensors in a room. Let’s say, sensor.temp_comfort and sensor.temp_freeze.
When in a “Home” mode, I want target_sensor: sensor.temp_comfort. But when “Away”, I want it to change to target_sensor: sensor.temp_freeze.
The reason is that I have one sensor in the living area, measuring the actual temperature of the place where we are sitting. But when away for a long time (week, month…), the target sensor should be the one I placed in the coldest place. In this case, heating prevents only from freezing (target temperature - about 3o C). I know, that the difference may be several degrees (yes, house insulation so bad), but don’t know exactly. Maybe, I’ll place a few more and use a min-max sensor for finding the lowest one.
How can I make the terget sensor depending on the scene selected?
Create a Template Sensor that reports the temperature from sensor.temp_comfort when in Home mode and changes to reporting the temperature from sensor.temp_freeze when in Away mode. Set the Generic Thermostat integration to use this Template Sensor.
I can help you create the proposed Template Sensor but I need to know what is the entity you are using that indicates Home or Away mode.
This is the problem of my ignorance. I hoped, that simply by changing scenes from “Home” to “Away” I can swap temp. sensosr. Or I am too optimistic? Any suggestions here?
And yes, creating a template is definitely out of my knowledge. Any help is appreciated.
Consider creating an Input Select containing two options: Home, Away. You will use it to manually set the desired occupancy mode.
Create an automation with a State Trigger that monitors the state of the Input Select. When the Input Select changes state (from Home to Away or from Away to Home), the automation detects the state-change and proceeds to perform the desired actions, such as arming/disarming the alarm system, turning various lights on or off, etc.
Create a Trigger-based Template Sensor that uses a State Trigger to monitor the Input Select. When the Input Select changes to Away, it reports the value of sensor.temp_freeze. When the Input Select changes to Home, it reports the value of sensor.temp_comfort.
The Generic Thermostat integration uses the Trigger-based Template Sensor as its temperature reference.
Let me know if this interests you and I can help you compose the automation and Trigger-based Template Sensor.
Thank you very much for the guidance. I have to dig deeper to this, and because I’m a novice and not a programmer, I need time to absorb this. Tomorrow I will look closer and probably will use your generous offer to help in composing automation.
Assuming you make the Input Select I proposed and called it input_select.occupancy the following automation will arm/disarm your alarm system and turn on/off various lights.
Here’s a Trigger-based Template Sensor that reports temperature from the appropriate sensor based on the current state of the Input Select. Your Generic Thermostat integration should be configured to use sensor.temperature_occupancy.
template:
- trigger:
- platform: state
entity_id: input_select.occupancy
sensor:
- name: "Temperature Occupancy"
state: "{{ states('sensor.temp_freeze' if trigger.to_state.state == 'Away' else 'sensor.temp_comfort') }}"
unit_of_measurement: "°C"
device_class: temperature