I encounter a little issue using the generic thermostat component. It’s unable to retrieve the temperature value of my MQTT sensor !! The sensor itself displays well in HA frontend with correct temperature but not in thermostat component ! I thought I needed to convert in float the temperature value but it doesn’t accept typecasting Some suggestions ?
Sorry forgot to mention it but it’s what I tried first and it was not working and so that’s why I went looking at more complicated solutions for basic thing !!
In fact I got a guess about the problem, it looks like sensor returns unit (C for Celsius) as part of the number string for temperature and so thermostat is confused by it !!
Unable to update from sensor: C is not a recognized temperature unit.
11:13 components/climate/generic_thermostat.py (ERROR)
Don’t know how to remove it from string ! I thought that Float conversion would do that no ?
No, the generic does not support template.
Then you have to make a template sensor with {{ sensor.salon_temp_temperature | float }}
And link the template sensor to the generic thermostat
Or fix the mqtt sensor so that the state is only numeric (remove the unit from the state)
What is your config for the temperature sensor? Particularly, what unit of measurement are you using?
I set two sensors in order to deal with the state of the sensor not being initialized when HA starts (and makes the temp at 25 degrees). First sensor is the raw value taken from the MQTT.
Thanks for clarification, will go this way if I find out the second option is not working !
To be sure I checked content of mqtt messages and my mqtt sensor returns only the numerical value (there is no letter or symbol in string sent to MQTT !). I guess the problem is in config of that sensor in HA but the issue is that it’s a device added by auto discover in HA not sure what I can do here to fix that problem in HA !
As indicated just above there is no specific configuration as it’s a mqtt sensor added in HA by the autodiscover of HA so I didn’t do any configuration for it
Thanks a lot it resolved the issue you are right May you just tell me what’s the function of states. and .state ? as I saw then mentionned on website but without any explanations
So I updated my generic_thermostat to use now my variable with temperature correctly formatted but now it complains it has no unit ??? What’s the f*ck ?
Unable to update from sensor: None is not a recognized temperature unit.
15:04 components/climate/generic_thermostat.py (ERROR)
I think that it is more convenient to add MQTT components manually. Splitting the configuration into multiple files would be much easier after you get the hang of it.