Generic_thermostat: how to setup different target sensor in different scenes?

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.

1 Like

Thank you for the answer!

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.

How are you doing that now?

Now not doing, just planning to do this way.

I’m planning to create scenes (?) and switch between them. But, honestly, didn’t tried that yet.

A scene is used to set a selected set of entities to desired states. What will your proposed scenes do?

Away: switch on alarm, turn off all lights, set “away” temperature in generic thermostat and change temp. sensor.

Home: switch off alarm, set “home” temperature and change temp. sensor.

Maybe, I’ll add something later, but for now I’m planning to do only this.

Edit: Chances are, that I didn’t understand scenes correctly and wand something unachievable.

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.

2 Likes

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.

Thank you one more time!

Here are examples of what I had described:

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.

alias: example
trigger:
  - platform: state
    entity_id: input_select.occupancy
condition: []
action:
script:
  - if: "{{ trigger.to_state.state == 'Away' }}"
    then:
      - service: alarm_control_panel.alarm_arm_away
        target:
          entity_id: alarm_control_panel.your_alarm
      - service: light.turn_on
        target:
          entity_id:
            - light.front
            - light.back
      - service: light.turn_off
        target:
          entity_id:
            - light.kitchen
            - light.living_room
    else:
      - service: alarm_control_panel.alarm_arm_home
        target:
          entity_id: alarm_control_panel.your_alarm
      - service: light.turn_off
        target:
          entity_id:
            - light.front
            - light.back
      - service: light.turn_on
        target:
          entity_id:
            - light.kitchen
            - light.living_room

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

Can you use that trigger to “set” a scene? so i can “hide” all the “actions” into a scene?

What do you mean by “set” a scene? Do you mean to turn on an existing scene or to create a snapshot scene?

Reference: Scenes

turn on one existing scene

Turning on an existing scene is explained in the documentation link in my previous post.

aaa just realized i don’t need to do that i think i can just use the trigger sensor template to switch between source sensors…