Setting climate temperature from pyscript

Hi - I am trying to use pyscript and have managed to set up the jupyter notebook with my homeassistant.
My goal is to controll the thermostat temperatures according to a configutation (a bit like schedy in appdeamon). One thing I should be able to is to set the target temperature of a thermostat /climate entity.
This is done easily from the notebook, but it does not trigger any behaviour on the thermostat.
If I fx set the current temperature is 20 and I set the target temperature to 25 it should turn on heating. The thermostat displays 25 deg but the heater is not turned on. if I adjust the temp to 24.5 it is turned on. What am I missing?

Here is my simple code:
climate.bad.temperature = 25
Then when I run
climate.bad.temperature 25 is printet.

What should I do to get this working?
Thanks
Helge

I think more information is necessary here. There are many possibilities. You could start by telling us more about your thermostat. Then go to Developer tools and click on states. Filter entities by climate.bad and click on that entity in the list. That will show us something like the following and post that here. Then I can get a better idea of your thermostat setup.

hvac_modes:
  - 'off'
  - heat
  - cool
  - emergency_heating
min_temp: 45
max_temp: 86
target_temp_step: 1
fan_modes:
  - auto
  - 'on'
current_temperature: 72
target_temp_high: 79
target_temp_low: 60
fan_mode: auto
hvac_action: 'off'
battery: 93
fan_state: 'ON'
linkquality: 102
local_temperature: 22.11
local_temperature_calibration: null
occupied_cooling_setpoint: 26
occupied_heating_setpoint: 15.5
running_state: idle
system_mode: heat
temperature_setpoint_hold: false
voltage: 2600
friendly_name: thermostat
supported_features: 10

Thanks for the reply!

It is a Namron floor thermostat on the bathroom (bad). I also tested with a generic_thermostat where the thermostat is constructed by a smartplug and a temp sensor. The generic_thermostat behaved on exactly the same way, no action when I turned the temperature higer than current temperature and you would expect the heat to be turned on

States for the bad thermostat:

hvac_modes:
  - 'off'
  - heat
min_temp: 7
max_temp: 35
preset_modes:
  - none
  - Dry
  - Energy heat
  - Away
current_temperature: 23.8
temperature: 22
hvac_action: idle
preset_mode: none
friendly_name: Bad
supported_features: 17

Definition of the generic_thermostat:


climate:
  - platform: generic_thermostat
    name: Gang3
    unique_id: gang3.climate
    heater: climate.gang
    target_sensor: sensor.gang_air_temperature_2_2
    min_temp: 5
    max_temp: 27
    ac_mode: false
    target_temp: 15
    cold_tolerance: 0.3
    hot_tolerance: 0
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 3
    initial_hvac_mode: "off"
    away_temp: 3
    precision: 0.1

states for the generic_thermostat:

hvac_modes:
  - heat
  - 'off'
min_temp: 5
max_temp: 25
target_temp_step: 0.1
preset_modes:
  - none
  - away
current_temperature: 22
temperature: 19.5
hvac_action: idle
preset_mode: none
friendly_name: Stue_Terassedor
supported_features: 17

It appears to me that you can’t simply change the state of climate.device.temperature. The thermostat won’t recognize that. Instead you may need to use the service climate.set_temperature and use entity_id: climate.bad as the target.

Thanks - got it to work now

climate.set_temperature(entity_id=“climate.bad”, temperature=15)

works like a dream

1 Like