Update current temperature for Z-Wave thermostats

Hi @Bieniu,

I have 2 more questions about your script. I hope you will answer them :slight_smile: :

  1. In your last reply you said that these thermostats don’t support states. But in the python script are these lines:
 - heat_state			- name of heating state, default 'heat' (optional),
                          changing heat_state from the default value will broke
                          compatibility with HomeKit
 - idle_state			- name of idle state, default 'off' (optional),
                          changing idle_state from the default value will broke
                          compatibility with HomeKit

So I can’t use these with my thermostat?

  1. I want to change my entities to Dutch. So I have to rename.
    sensor.temperature_livingroom to sensor.temperatuur_huiskamer
    and
    climate.thermostat_livingroom to climate.thermostaat_huiskamer

Can you tell me what I have to rename in the python script and in the automation?
In that way it is also more clear for me how the script is working. I’m not good in those things, but I want to learn :slight_smile:

Thanks in advance.

These thermostats don’t support states, they always work autonomously. This is why in HA the state is always set to ‘unknown’. The script changes the state to visually make the thermostats look better in HA. This doesn’t affect their work.

You have to change automations after change names of entities.

- id: heating_update_thermostats
  alias: 'Heating Update Thermostats'
  trigger:
    platform: state
    entity_id:
      - sensor.temperatuur_huiskamer
      - climate.thermostaat_huiskamer
  condition:
    condition: template
    value_template: >-
      {% if 'thermostaat' in trigger.entity_id and trigger.to_state.attributes.current_temperature == none %}
        true
      {% elif 'sensor' in trigger.entity_id %}
        true
      {% else %}
        false
      {% endif %}
  action:
    service: python_script.heating_thermostat_update
    data_template:
      thermostat: >-
        {% if 'thermostaat' in trigger.entity_id %}
          {{ trigger.entity_id }}
        {% else %}
          climate.thermostaat_{{ trigger.entity_id | replace('sensor.temperatuur_', '') }}
        {% endif %}
      sensor: >-
        {% if 'sensor' in trigger.entity_id %}
          {{ trigger.entity_id }}
        {% else %}
          sensor.temperatuur_{{ (trigger.entity_id | replace('climate.thermostaat_', '')) }}
        {% endif %}
      heat_state: 'auto'

Thanks @Bieniu
Now everything works fine for me :smiley:

Is it possible to use you’re automation without completely rename my entities? I got totally different names (not granular as u have).

Thx

I’ve a question about this reply of you

“If you set the target_temperature to 21degrees, the thermostat will open/close the valve so that the 21 degrees get in the room. No automation is needed for this.”

This doesn’t work for me. Today I set the temperature of the valve to 21 degrees. The external temperature sensor said it was 19.5 degrees in the room. But still, the radiator was not hot. But it was supposed to be hot.
So I think the valve checks the temperature of the valve itself instead of the external sensor.
What can I do about this?

At this moment, if you don’t want to change the entities names, you have use the AppDaemon version or the modified one.

It may mean that you have mounted the thermostat incorrectly. You screwed it too tight. In the assembly mode it should be completely loose. The problem may also be the lack of hydraulic regulation of the central heating system - incorrect settings on the valves.

I think it is installed correctly. It is completely loose
The valve is working. If I set the temperature to 22 the radiator gets hot. So that’s not the problem.

What I meant is that I always have to set the temperature to 22 degrees (or higher) to heat up the room to 20 degrees on the external temperature sensor.

This is not how it supposed to be, right? When I set the valve at 20 degrees (on the external sensor) the radiator has to be hot till the external sensor reaches the 20 degrees. And then the valve can go off / lower.

@Bieniu
Could it be that the script isn’t working anymore under 90.2… I just updated from 88 and it doesn’t update the temps anymore… I’m using the latest version

Do you use python_script or AppDaemon?

Python_script… its wierd though…it looks like the script is working as when I manually trigger the HA start script I see the changes in the UI… however while looking at the UI you see them being removed as if the update script doesn’t get the right values…

I need to have another look at it as it has been working for a long time…

I’m using python_script on HA 0.90.2 and it works fine. In the latest version of the script, the configuration has changed slightly. Maybe there you have issue.

latest version of which script? I took a new copy today VERSION = ‘0.3.1’ and the python script works as it is also called during the start as:

action:
  - service: python_script.thermostat_current_temp
    data:
      thermostat: climate.thermostat_kitchen_heating_1
      sensor: sensor.kitchen_temperature

but the update script seems to remove the info:

alias: Heating Update Current Temperature
trigger:
  platform: state
  entity_id:
    - sensor.kitchen_temperature
    - climate.thermostat_kitchen_heating_1
    - sensor.livingroom_temperature
    - climate.thermostat_livingroom_heating_1
    - sensor.diningroom_temperature
    - climate.thermostat_diningroom_heating_1
    - sensor.office_temperature
    - climate.thermostat_office_heating_1    
    - sensor.bathroom_temperature
    - climate.thermostat_bathroom_heating_1 
    - sensor.bedroom_temperature
    - climate.thermostat_bedroom_heating_1     
    
condition:
  condition: template
  value_template: >-
    {% if "thermostat" in trigger.entity_id and trigger.to_state.attributes.current_temperature == none %}
       true
    {% elif "sensor" in trigger.entity_id %}
       true
    {% else %}
       false
    {% endif %}
action:
  service: python_script.thermostat_current_temp
  data_template:
    thermostat: >-
       {% if "thermostat" in trigger.entity_id %}
          {{ trigger.entity_id }}
       {% else %}
          climate.thermostat_{{ trigger.entity_id | replace('sensor.', '')  | replace('_temperature', '')}}_heating_1
       {% endif %}
    sensor: >-
       {% if "sensor" in trigger.entity_id %}
          {{ trigger.entity_id }}
       {% else %}
          sensor.{{ (trigger.entity_id | replace('climate.thermostat_', '')) | replace('_heating_1', '') }}_temperature
       {% endif %}

any idea… it just disapears

wonder if it has anything to do with all the changes on the entity_id

0.3.1 is the current version. Automations look good. Check that this automations are turned on.

Indeed no automation is triggered since the update to 90.2 weird

so all automations are turned off… but didn’t noticed it yet…I guess this is the reason:

AUTOMATION INITIAL STATE

When you create a new automation, it will be disabled (and therefore won’t trigger) unless you explicitly add initial_state: true to it or turn it on manually via UI/another automation/developer tools.

In case automations need to be enabled or disabled upon Home Assistant restart, then you have to set the initial_state in your automations. Otherwise, the previous state will be restored. Please note that if for some reason Home Assistant cannot restore the previous state, e.g., because of an interrupted or failed startup, it will result in the automation being disabled on the next Home Assistant startup.

Thanks for putting me on the right track !!

Both scripts (AppDaemon and python_script) are now available via HACS

hy, current_temperature graphs is missing from graph (with scripts that add value from the external sensor), when i hover the mouse over graph it pops out only the peaks of the current_temperature

An ideea?

Because HA sets current_temp to null, and the script sets a real value recoder save to database alternating empty and true results. That is why the graph is drawn in this way. The only way to correct this is the script, which from the database will delete entries from current_temperature = null for the thermostat entity.

Well, the current temperature from external sensor isn’t drawn at all… this is what’s bugging me

I gave you an answer why is that.