'Generic Thermostat' component doesn't ever switch heater on or off

Hi all,

I am a bit mystified on how to get this thing working - I feel like I have tried everything. Essentially: nothing I do will trigger the switch. Not moving the target termperature, not turning the away mode on and off, and (of course) not setting the target temp to a value higher than the sensor.

And so I come to you, cap in hand, asking for help :slight_smile: I have Google Home successfully changing the thermostat target value so I am very much looking forward to getting this going.

The primary thing that I am suspicious of: the temperature sensor values are correctly logged in the ‘state history’ (not in my screenshot as I had jjust rebooted), but not displayed as ‘Currently: nn°’ as I have seen in others’ posts - indicating that the component is not detectig the sensor?

P.S. maybe this has been placed in the ‘too hard basket’?

OK I will just bulletpoint the things I anticipate being asked by any helpful people:

  • The switch works when manually triggered
  • The switch successfully calls using switch.toggle
  • The switch is an mqtt switch controlling a Sonoff Basic
  • I have set the state to ‘heat’ and away mode is off
  • The state of the sensor is a float value, with 1 decimal place
  • My previous automation based on the sensor worked very reliably
  • I have tried the other optional config items for generic_thermostat
  • I created a dummy sensor that read off an input_number - no change
  • Anything else please ask I will be very grateful for the help!

configuration.yaml:

climate:
  - platform: generic_thermostat
    name: Thermostat
    heater: switch.lounge_heater
    target_sensor: sensor.temp
    min_temp: 10
    max_temp: 22
    ac_mode : 'False'
    target_temp: 18
    cold_tolerance: 0.3
    hot_tolerance: 0.3
    away_temp: 11

Switch.yaml:

- platform: mqtt
  name: "Lounge Heater"
  state_topic: "stat/heater/POWER"
  command_topic: "cmnd/heater/POWER"
  availability_topic: "tele/heater/LWT"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  retain: false
  payload_available: "Online"
  payload_not_available: "Offline"

Sensor:

- platform: mqtt
  name: "Temp"
  state_topic: "tele/dooralarm/SENSOR"
  value_template: "{{((value_json['SI7021'].Temperature) | round(1)) | float }}"
  qos: 1
  json_attributes: 
    - Temperature

Hi
can u print the log. There should be a log message saying it tried to turn the heater on.
Also it doesn’t use toggle it uses on, off service. Try if that work too.
If your instressted you can try my version of the Generic Thermostat. Thermostat with PID controller

1 Like

Hi

OK the logs…[EDIT] I tried a better search term and found these:

2018-07-19 00:56:47 ERROR (MainThread) [custom_components.climate.generic_thermostat] Unable to update from sensor: None is not a recognized temperature unit.

So now I am going through the generic_thermostat.py…

FYI - i got the toggle requirement from the documentation: "heater (Required): entity_id for heater switch, must be a toggle device. "

You need to define a unit_of_measurement: in the temperature sensor.

1 Like

Aaahhh - yes I will need to go back to the JSON that I get from the Tasmota firmware I am using

Thanks, I was wondering whether that was a general HASS setting

[EDIT] Beautiful, as a final proof I hard-coded °C into a temporary /custom_components/generic_thermostat.py - works perfectly, straight away!

Now to fix that sensor…

[EDIT 2] Just as @gpbenton said… it was as easy as adding the unit_of_measurement in my sensor:

- platform: mqtt
  name: "Temp"
  state_topic: "tele/dooralarm/SENSOR"
  value_template: '{{(value_json["SI7021"].Temperature | float ) | round(1) }}'
  qos: 1
  unit_of_measurement: "°C"   << this one
  json_attributes:
    - Temperature
1 Like