Platform: generic_thermostat with target_temp: "{{ states('sensor.bla') }}"

Hi all,
is it somehow possible to use an entity value for target_temp instead of a fix value?

I like to realize following stuff:

climate:
  - platform: generic_thermostat
    name: Außentemperatur
    heater: input_boolean.dummy_thermostatschaler
    target_sensor: sensor.aqara_tempsensor_aussen
    target_temp: "{{ states('sensor.aqara_tempsensor_aussen') }}"

The target temp should be sync with the measured temp as soon as the value changes.

No, not in the generic thermostat configuration. That does not accept templates.

You can set the target temp with a template in an automation. But…

It seems odd that you would want to set the target temperature to the value of the same temperature sensor you are using in the thermostat. If you do this your thermostat will always be at the target temperature and so will never turn on.

Thx for the fast replay.

The idea behind this is to let Google Home just say the current temperature of the temp sensor instead of “The temperature is set to 21° and it is 15°”.
When I expose the native temp sensor of HA, Google answers always similar as follows “The sensor is OFF and it is 15°”.

Both is not that nice. :confused:

Just make a temperature template sensor.

1 Like

Can you tell me a little bit more. I am new to HA so I need to learn all this fency stuff :smiley:

sensor:
  - platform: template
    sensors:
      temp_aussen:
        friendly_name: "Außentemperatur"
        unit_of_measurement: "°C"
        value_template: "{{ states('sensor.aqara_tempsensor_aussen') }}"
1 Like

Thx, will give it a try!

Okay, I create it, but shame on me I think I have not gotten the idea behind it, sorry…
Should I am now be able to combine the template with the generic_thermostat to get a variable target_temp or should I expose the temperature template sensor to GH?

The second one.

I have already several devices in GH via Nabu Case. Is there a way to expose additional devices like the temperature template sensor?
I have tried this:

cloud:
  google_actions:
    filter:
      include_entities:
        - sensor.temp_aussen_template

But this would end up in the result that all previous devices would no longer be exposed to GH, but only the one from the example.

OFFTOPIC:
As I said it is just a workaround for this annoying "…is off" verbiage, what I get at the moment. Hopefully Nabu Casa will handle this somehow. Maybe the pimatic dev could help in this regard, because he got it to work with temp and humidity exposed a thermostat in GH via Nora.


The termostat shows 10° because GH is not able to show lower target temps. Internally the target temp is 7°, so GH answers just: “The outside temperature is 7°” :smiley:

if you don’t have a configuration, the sensor should just appear but you have to restart home assistant.

Adding that configuration only exposes that single sensor. So add the others. Either way, you shouldn’t have to do anything other than restart without that configuration and it should be exposed to google home.

This is deleted, it was just a test:

cloud:
  google_actions:
    filter:
      include_entities:
        - sensor.temp_aussen_template

I have this in my configuration.yaml:

      # Temperature sensors workaround (for Google Home)
      temp_aussen_template:
        friendly_name: "ABC"
        unit_of_measurement: "°C"
        value_template: "{{ states('sensor.aqara_tempsensor_aussen') }}"

Called it now “ABC” to make it definitively unique.

I can’t find it in Home Assistant Cloud -> Google Assistant -> entities. I will play around with this tomorrow, have no clue at the moment.

Thx for all your answers!

I’m not sure how GH works, but alexa requires you to rediscover devices if you add something. It doesn’t automatically appear in alexa.

In GH it appears automatically after a while, but it can be forced as well.

1 Like

Maybe its better not to look for a workaround, but for a solution for the problem itself.
My initial problem is at the end that GH answered for every exposed temp or humidity sensor that it is off + the measured temperature. Like this:

“The temperature is set to 21° and it is 15°” <<< this was wrong
“The sensor is off and it is 15°”

I just like to hear the measured value of the temperature.
As I understood this is a known issue. Who is the right address to fix this, the Nabu Casa guys?

It’s not home asssistant that’s the problem, that’s what Google home announces for any thermostat. This is why you need to expose it as a temperature sensor.

But can’t be forced that the device is exposed in “on” state?

I don’t know how that would change the outcome…

I don’t understand why you don’t just use the current methods. You have 2 options:

  1. Template temperature sensor
  2. Change the smarthome device type

Both are fairly simple to do, however going the template sensor route will give you exactly what you want.

If that’s not working for you, post your configuration as you’re likely doing something wrong.

My expectation would be that the current response:
“The sensor is off and it is 15°”

would change to:
“It is 15°”

because the device is “on” now. This is the way how it works when I add this to the configuration.yaml:

climate:
  - platform: generic_thermostat
    name: Außentemperatur
    heater: input_boolean.dummy_thermostatschaler
    target_sensor: sensor.aqara_tempsensor_aussen
    target_temp: X

input_boolean.dummy_thermostatschaler represents an always on dummy switch.

But… the problem here is now that as long as the “target temp” and the “measure temp” are not equal, GH will answer:
“Außentemperatur is set to X° and it is 15°”

When both are the same them I get my expected announcement
“Außentemperatur is 15°”

But I don’t like to wait for this moment always :smile:

Therefore I had the idea here to make this hack:
target_temp: "{{ states('sensor.aqara_tempsensor_aussen') }}"

But as I learned from @tom_l this is not possible. :frowning: .
Till now I haven’t tried the way via an automation. I will do, but isn’t it to much effort for such a simple thing?


EDIT

This is new to me. I would give it a try. Where I can find infos for this?