Xiaomi temp sensor below 19 degree start tado heating not working on my setup

Get this error. TypeError: ‘>’ not supported between instances of ‘str’ and ‘int’

{% if states('sensor.0x00158d0002b57f51_temperature')|int > 19 %}

But you do not want to set the temperature to 10 degrees and set the mode to auto. It will start cooling!

Obaldius write this don’t know why.

Well the missing |int was just a mistake, we all make them, but he also probably assumed you were going to leave it in heating mode.

Don’t want to leave in heating mode. I setup the auto mode and it is good for me. Only then want extra heating if my bedroom temp lower than 19 degree. If the bedroom temp reach 19 want to turn back the thermostat to auto heating.

Ok so make this 2 automation. I think it’s will be ok. What you think?

alias: Heat switch 21
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.0x00158d0002b57f51_temperature
    below: '18.9'
  - platform: time
    at: '01:00'
condition:
  - condition: time
    after: '01:00'
    before: '5:30'
action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    entity_id: climate.room_1
  - service: climate.set_temperature
    data:
      temperature: 21
    entity_id: climate.room_1
mode: single



alias: Heat switch back to auto mode
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.0x00158d0002b57f51_temperature
    above: '19'
condition: []
action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: auto
    entity_id: climate.room_1
mode: single

You might want to limit that second automation to the night time range with a condition to prevent it messing with the thermostat during the day.

if you want to keep it in one automation. Make sure you have sensor.time enabled:

I’m pretty sure the last service call is not well written, you’ll have to figure it out yourself how to set it back to auto mode. This one will put the thermostat temperature to 21 degrees if your other’s room temp drops below 19. Will set the thermostat temp to 10 degrees if it raises above 19. Then, at 05:30, it will revert back to whatever state you want the tado to be (through the last service call).

alias: Heating xiaomi trigger
description: ''
mode: single
trigger:
  - platform: state
    entity_id: sensor.0x00158d0002b57f51_temperature
  - platform: time
    at: '01:00:00'
condition:
  - condition: time
    after: '01:00:00'
    before: '05:30:00'
action:
  - service: climate.set_temperature
    data:
      temperature: >
        {% if states('sensor.0x00158d0002b57f51_temperature')|float > 19 %}
          10
        {% else %}
          21
        {% endif %}
    entity_id: climate.room_1
  - wait_template: "{{is_state('sensor.time', '05:30')}}"
  - service: climate.set_hvac_mode
    data:
      entity_id: climate.room_1
      hvac_mode: auto

Get this error: Message malformed: must contain at least one of below, above.
Have time sensor.

put state instead of numeric_state

  - platform: state
    entity_id: sensor.0x00158d0002b57f51_temperature

this could do it too… not sure what fits you best

action:
  - service: climate.set_temperature
    data:
      temperature: 21
      hvac_mode: >
        {% if states('sensor.0x00158d0002b57f51_temperature')|float > 19 %}
          auto
        {% else %}
          heat
        {% endif %}
    entity_id: climate.room_1
  - wait_template: "{{is_state('sensor.time', '05:30')}}"
  - service: climate.set_hvac_mode
    data:
      entity_id: climate.room_1
      hvac_mode: auto
- platform: state
  entity_id: sensor.0x00158d0002b57f51_temperature

This one how to do triggering?

I meant replacing the action section from the example above xD. Did it accept the ‘state’ instead of ‘numeric_state’?

alias: Heating xiaomi trigger
description: ''
mode: single
trigger:
  - platform: state
    entity_id: sensor.0x00158d0002b57f51_temperature
  - platform: time
    at: '01:00:00'
condition:
  - condition: time
    after: '01:00:00'
    before: '05:30:00'
action:
  - service: climate.set_temperature
    data:
      temperature: 21
      hvac_mode: >
        {% if states('sensor.0x00158d0002b57f51_temperature')|float > 19 %}
          auto
        {% else %}
          heat
        {% endif %}
    entity_id: climate.room_1
  - wait_template: "{{is_state('sensor.time', '05:30')}}"
  - service: climate.set_hvac_mode
    data:
      entity_id: climate.room_1
      hvac_mode: auto

Yes accpet it but want to know ho to trigger?
If the temperature change always do the trigger?

at any temperature change, the action section checks what to do. If above 19, set tado to auto mode, if below, sets it to heat mode only during that time period. At 05:30, reverts back to whatever state you want the tado to be. It’s a good way to keep it in just one automation.

Then if working all temperature change why need this trigger?

- platform: time
  at: '01:00:00'

You could avoid that but… let’s say temperature is 17 degrees at 01:00 and it stays in that number for two hours… Tado won’t heat until there’s some change in the temperature reading and you’ll have your bedroom at 17 degrees for those two hours. Or even consider the rare scenario that it stays at 15 degrees from 01:00 to 05:30, the automation will never trigger. It won’t hurt to have that there, you make sure it’ll always trigger at 01:00 regardless of the temperature.

Ok. Will try it with the last action. Hope it will working good or tomorrow will wake up in fridge. :slight_smile:
Thank your help!

1 Like

Don’t forget to make sure that’s the correct way of setting the tado to auto mode because I have not tried it. Check it out under developer tools/services before waiting for the automation to trigger tonight

Yes it is good, tried it before.