Update current temperature for Z-Wave thermostats

Thank you for the answer… the problem is in the database, but i don’t know how to fix this in MySQL database. Otherwise the script is doing his job… only the hystory graph not working

@Bieniu Hmm i dont see this component in HACS and I can’t add it manually also. I mean using “add custom repository” in HACS

This is not a component. It’s python_script or AppDaemon app. Both are available in HACS.

Strange, i dont see appdeamon label and apps like this. Maybe you have another version or some custom repository added? Or maybe its not for HASSIO ?

Look here https://hacs.netlify.com/installation/configuration/

ok now its clear :slight_smile: thank you!

1 Like

@Bieniu Can i have last question? :slight_smile:
Is danfoss-014g0013 after adding Thermostats Update to HASSIO will work with
https://github.com/nervetattoo/simple-thermostat addon ? I mean it will get all needed data to display the card correctly? Forgive me if i bother you but I’m planning to buy danfoss and I would like to be sure that I won’t regret shopping

Honestly, I don’t know. 014g0013 doesn’t have state and hvac_mode in standard. Python_script can add state but not hvac_mode. I will try to check this and post a screenshot.

1 Like

Simple Thermostat card with 014G0013:

without_script

After run my python_script and add humidity sensor to card configuration:

with_script

1 Like

thank you! :slight_smile:

Hello, I use the edit script in pairs. I have a lot of mistakes in the log. Is there a solution to my problem?

2019-09-04 14:56:15 ERROR (SyncWorker_0) [homeassistant.components.python_script.thermostat_update.py] entity_id climate.danfoss_z_thermostat_014g0013_heating_1_10.
2019-09-04 14:56:15 ERROR (SyncWorker_2) [homeassistant.components.python_script.thermostat_update.py] entity_id sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2.
2019-09-04 14:56:15 ERROR (SyncWorker_0) [homeassistant.components.python_script.thermostat_update.py] Values: climate.danfoss_z_thermostat_014g0013_heating_1_10 - sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2.
2019-09-04 14:56:15 ERROR (SyncWorker_2) [homeassistant.components.python_script.thermostat_update.py] Values: climate.danfoss_z_thermostat_014g0013_heating_1_10 - sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2.
2019-09-04 14:56:16 ERROR (SyncWorker_3) [homeassistant.components.python_script.thermostat_update.py] thermostats ['climate.danfoss_z_thermostat_014g0013_heating_1', 'climate.danfoss_z_thermostat_014g0013_heating_1_2', 'climate.danfoss_z_thermostat_014g0013_heating_1_3', 'climate.danfoss_z_thermostat_014g0013_heating_1_4', 'climate.danfoss_z_thermostat_014g0013_heating_1_5', 'climate.danfoss_z_thermostat_014g0013_heating_1_6', 'climate.danfoss_z_thermostat_014g0013_heating_1_7', 'climate.danfoss_z_thermostat_014g0013_heating_1_8', 'climate.danfoss_z_thermostat_014g0013_heating_1_9', 'climate.danfoss_z_thermostat_014g0013_heating_1_10'].
2019-09-04 14:56:16 ERROR (SyncWorker_3) [homeassistant.components.python_script.thermostat_update.py] sensors ['sensor.temperature_chambre_parentale', 'sensor.temperature_chambre_noham', 'sensor.temperature_salon', 'sensor.temperature_salon', 'sensor.temperature_salon', 'sensor.temperature_chambre_theo', 'sensor.temperature_chambre_sacha', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2'].
2019-09-04 14:56:16 ERROR (SyncWorker_3) [homeassistant.components.python_script.thermostat_update.py] entity_id sensor.fibaro_system_fgsd002_smoke_sensor_temperature.
2019-09-04 14:56:16 ERROR (SyncWorker_3) [homeassistant.components.python_script.thermostat_update.py] Values: climate.danfoss_z_thermostat_014g0013_heating_1_8 - sensor.fibaro_system_fgsd002_smoke_sensor_temperature.
2019-09-04 14:56:16 ERROR (SyncWorker_4) [homeassistant.components.python_script.thermostat_update.py] thermostats ['climate.danfoss_z_thermostat_014g0013_heating_1', 'climate.danfoss_z_thermostat_014g0013_heating_1_2', 'climate.danfoss_z_thermostat_014g0013_heating_1_3', 'climate.danfoss_z_thermostat_014g0013_heating_1_4', 'climate.danfoss_z_thermostat_014g0013_heating_1_5', 'climate.danfoss_z_thermostat_014g0013_heating_1_6', 'climate.danfoss_z_thermostat_014g0013_heating_1_7', 'climate.danfoss_z_thermostat_014g0013_heating_1_8', 'climate.danfoss_z_thermostat_014g0013_heating_1_9', 'climate.danfoss_z_thermostat_014g0013_heating_1_10'].
2019-09-04 14:56:16 ERROR (SyncWorker_4) [homeassistant.components.python_script.thermostat_update.py] sensors ['sensor.temperature_chambre_parentale', 'sensor.temperature_chambre_noham', 'sensor.temperature_salon', 'sensor.temperature_salon', 'sensor.temperature_salon', 'sensor.temperature_chambre_theo', 'sensor.temperature_chambre_sacha', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2'].
2019-09-04 14:56:16 ERROR (SyncWorker_4) [homeassistant.components.python_script.thermostat_update.py] entity_id sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4.
2019-09-04 14:56:16 ERROR (SyncWorker_4) [homeassistant.components.python_script.thermostat_update.py] Values: climate.danfoss_z_thermostat_014g0013_heating_1_9 - sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4.
2019-09-04 14:57:06 ERROR (SyncWorker_6) [homeassistant.components.python_script.thermostat_update.py] thermostats ['climate.danfoss_z_thermostat_014g0013_heating_1', 'climate.danfoss_z_thermostat_014g0013_heating_1_2', 'climate.danfoss_z_thermostat_014g0013_heating_1_3', 'climate.danfoss_z_thermostat_014g0013_heating_1_4', 'climate.danfoss_z_thermostat_014g0013_heating_1_5', 'climate.danfoss_z_thermostat_014g0013_heating_1_6', 'climate.danfoss_z_thermostat_014g0013_heating_1_7', 'climate.danfoss_z_thermostat_014g0013_heating_1_8', 'climate.danfoss_z_thermostat_014g0013_heating_1_9', 'climate.danfoss_z_thermostat_014g0013_heating_1_10'].
2019-09-04 14:57:06 ERROR (SyncWorker_6) [homeassistant.components.python_script.thermostat_update.py] sensors ['sensor.temperature_chambre_parentale', 'sensor.temperature_chambre_noham', 'sensor.temperature_salon', 'sensor.temperature_salon', 'sensor.temperature_salon', 'sensor.temperature_chambre_theo', 'sensor.temperature_chambre_sacha', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4', 'sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2'].
2019-09-04 14:57:06 ERROR (SyncWorker_6) [homeassistant.components.python_script.thermostat_update.py] entity_id climate.danfoss_z_thermostat_014g0013_heating_1_6.
2019-09-04 14:57:06 ERROR (SyncWorker_6) [homeassistant.components.python_script.thermostat_update.py] Values: climate.danfoss_z_thermostat_014g0013_heating_1_6 - sensor.temperature_chambre_theo.
2019-09-04 14:57:12 ERROR (SyncWorker_1) [homeassistant.components.python_script.thermostat_update.py] thermostats ['climate.danfoss_z_thermostat_014g0013_heating_1', 'climate.danfoss_z_thermostat_014g0013_heating_1_2', 'climate.danfoss_z_thermostat_014g0013_heating_1_3', 'climate.danfoss_z_thermostat_014g0013_heating_1_4', 'climate.danfoss_z_thermostat_014g0013_heating_1_5', 'climate.danfoss_z_thermostat_014g0013_heating_1_6', 'climate.danfoss_z_thermostat_014g0013_heating_1_7', 'climate.danfoss_z_thermostat_014g0013_heating_1_8', 'climate.danfoss_z_thermostat_014g0013_heating_1_9', 'climate.danfoss_z_thermostat_014g0013_heating_1_10'].

python_script thermostat_update.py

VERSION = '0.2.6'

ATTR_THERMOSTAT = 'thermostat'
ATTR_SENSOR = 'sensor'
ATTR_HEAT = 'heat_state'
ATTR_IDLE = 'idle_state'
ATTR_IDLE_HEAT = 'idle_heat_temp'
ATTR_CURRENT_TEMP = 'current_temperature'
ATTR_OPERATION_LIST = 'operation_list'
ATTR_OPERATION_MODE = 'operation_mode'
ATTR_TEMPERATURE = 'temperature'
ATTR_THERMOSTATS = 'thermostats'
ATTR_SENSORS = 'sensors'
ATTR_ENTITY_ID = 'entity_id'

ATTR_HEAT_STATE = 'heat'
ATTR_IDLE_STATE = 'off'
ATTR_IDLE_HEAT_STATE = 8

thermostat_id = data.get(ATTR_THERMOSTAT)
sensor_id = data.get(ATTR_SENSOR)
entity_id = data.get(ATTR_ENTITY_ID)
thermostats = data.get(ATTR_THERMOSTATS)
sensors = data.get(ATTR_SENSORS)
heat_state = data.get(ATTR_HEAT, ATTR_HEAT_STATE)
idle_state = data.get(ATTR_IDLE, ATTR_IDLE_STATE)
idle_heat_temp = data.get(ATTR_IDLE_HEAT, ATTR_IDLE_HEAT_STATE)

logger.error("thermostats {}.".format(thermostats))
logger.error("sensors {}.".format(sensors))
logger.error("entity_id {}.".format(entity_id))

def getIndex(list, value):
    if value in list:
        return list.index(value)
    return -1

if entity_id:
    index = getIndex(thermostats, entity_id)
    if index>=0:
        thermostat_id = entity_id
        sensor_id = sensors[index]
    else:
        index = getIndex(sensors, entity_id)
        if index>=0:
            sensor_id = entity_id
            thermostat_id = thermostats[index]

logger.error("Values: {} - {}.".format(thermostat_id, sensor_id))

if thermostat_id and sensor_id:
    try:
        temp = float(hass.states.get(sensor_id).state)
    except ValueError:
        logger.error("Could not get state of {}.".format(sensor_id))
    thermostat = hass.states.get(thermostat_id)
    if thermostat is None:
        logger.error("Could not get state of {}.".format(thermostat_id))
    else:
        attributes = thermostat.attributes.copy()
        attributes[ATTR_CURRENT_TEMP] = temp
        attributes[ATTR_OPERATION_LIST] = [heat_state, idle_state]
        if float(attributes[ATTR_TEMPERATURE]) > idle_heat_temp:
            state = heat_state
            attributes[ATTR_OPERATION_MODE] = heat_state
        else:
            state = idle_state
            attributes[ATTR_OPERATION_MODE] = idle_state
        hass.states.set(thermostat_id, state, attributes)
else:
    logger.error("Expected {} and {} entity_id, got: {} and {}.".format(
        ATTR_THERMOSTAT, ATTR_SENSOR, thermostat_id, sensor_id))

Automation

  alias: 'Heating Update Thermostats'
  trigger:
    platform: state
    entity_id:
      - sensor.temperature_chambre_parentale
      - sensor.temperature_chambre_noham
      - sensor.temperature_salon
      - sensor.temperature_salon
      - sensor.temperature_salon
      - sensor.temperature_chambre_theo 
      - sensor.temperature_chambre_sacha
      - sensor.fibaro_system_fgsd002_smoke_sensor_temperature
      - sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4
      - sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2
      - climate.danfoss_z_thermostat_014g0013_heating_1
      - climate.danfoss_z_thermostat_014g0013_heating_1_2
      - climate.danfoss_z_thermostat_014g0013_heating_1_3
      - climate.danfoss_z_thermostat_014g0013_heating_1_4
      - climate.danfoss_z_thermostat_014g0013_heating_1_5
      - climate.danfoss_z_thermostat_014g0013_heating_1_6
      - climate.danfoss_z_thermostat_014g0013_heating_1_7
      - climate.danfoss_z_thermostat_014g0013_heating_1_8
      - climate.danfoss_z_thermostat_014g0013_heating_1_9
      - climate.danfoss_z_thermostat_014g0013_heating_1_10
  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_update
    data_template:
      sensors:
        - sensor.temperature_chambre_parentale
        - sensor.temperature_chambre_noham
        - sensor.temperature_salon
        - sensor.temperature_salon
        - sensor.temperature_salon
        - sensor.temperature_chambre_theo 
        - sensor.temperature_chambre_sacha
        - sensor.fibaro_system_fgsd002_smoke_sensor_temperature
        - sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4
        - sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2
      thermostats:
        - climate.danfoss_z_thermostat_014g0013_heating_1
        - climate.danfoss_z_thermostat_014g0013_heating_1_2
        - climate.danfoss_z_thermostat_014g0013_heating_1_3
        - climate.danfoss_z_thermostat_014g0013_heating_1_4
        - climate.danfoss_z_thermostat_014g0013_heating_1_5
        - climate.danfoss_z_thermostat_014g0013_heating_1_6
        - climate.danfoss_z_thermostat_014g0013_heating_1_7
        - climate.danfoss_z_thermostat_014g0013_heating_1_8
        - climate.danfoss_z_thermostat_014g0013_heating_1_9
        - climate.danfoss_z_thermostat_014g0013_heating_1_10
      entity_id: '{{trigger.entity_id}}'

Thank you in advance for your assistance. Sorry for my english

You are using modified version of the script. I’m not author of this modification. My version is here https://github.com/bieniu/ha-thermostat-update

Yes I understand but I have problems when I want to rename my thermostats and smoke detector that serves as a temperature sensor. Does your version allow us to keep our names or can it work in pairs without the room ?

  • climate1
  • climate2
  • climate3
  • sensor1
  • sensor2
  • sensor3

You can use AppDaemon app https://github.com/bieniu/ha-ad-thermostats-update if you don’t want to rename entities.

Thank you for your help and proposal but I have never managed to work with the AppDaemon version.

I just found a solution to my problem. So I managed to rename as requested your initial version with
Climate Group + rename my smoke detector

- platform: template
  sensors:
    # Temperature detecteur fummée couloir entrée
    temperature_couloir_entree:
      friendly_name: "Température Couloir Entrée"
      unit_of_measurement: '°C'
      value_template: >-
        {% if states('sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2') %}
          {{ states('sensor.fibaro_system_fgsd002_smoke_sensor_temperature_2') }}
        {% else %}
          {{ states('temperature_couloir_entree') }}
        {% endif %}
    # Temperature detecteur fummée couloir 1er
    temperature_couloir_1er:
      friendly_name: "Température Couloir 1er"
      unit_of_measurement: '°C'
      value_template: >-
        {% if states('sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4') %}
          {{ states('sensor.fibaro_system_fgsd002_smoke_sensor_temperature_4') }}
        {% else %}
          {{ states('temperature_couloir_1er') }}
        {% endif %}
    # Temperature detecteur fummée palier enfants
    temperature_palier_enfants:
      friendly_name: "Température Palier Enfants"
      unit_of_measurement: '°C'
      value_template: >-
        {% if states('sensor.fibaro_system_fgsd002_smoke_sensor_temperature') %}
          {{ states('sensor.fibaro_system_fgsd002_smoke_sensor_temperature') }}
        {% else %}
          {{ states('temperature_palier_enfants') }}
        {% endif %}

off topic :wink:

There is no longer a beautiful card. If a person has the skill to adapt this Jeedom widget. I leave a file with the png of the Danfoss head and the Jeedom script. widget Jeedom

Thank you very much for your script.

Hey
Im testing your app right now and having som problems. I have a Danfoss LC13 that is standing on the table right now (removed from the radiator).

I installed the AppDeamon app via HACS and made “apps.yaml” and placed that in folder “config\appdaemon\apps”.

apps.yaml

thermostats_update:
  module: thermostats-update
  class: ThermostatsUpdate
  rooms:
    kitchen:
      thermostat: climate.danfoss_z_thermostat_014g0013_heating_1
      sensor: sensor.tvattstuga_temperature_2
  heat_state: 'auto'
  idle_state: 'idle'
  idle_heat_temp: 10
  state_only: true
  wait_for_zwave: true

And the code for the simple-thermostat:

card:
  type: 'custom:simple-thermostat'
  entity: climate.danfoss_z_thermostat_014g0013_heating_1
  sensors:
    - entity: sensor.tvattstuga_temperature_2

But I have No temperature or state.
Added sensor. to display actual temperature in the room.

simple-thermostat

Whats wrong?
No errors or messages in log that related to this!

No errors in AppDaemon log?

hmm there might be a problem with appDaemon… =/

Error: Asked to process document index 0 but there are only 0 document(s)
Usage:
  yq delete [yaml_file] [path] [flags]
Aliases:
  delete, d
Examples:
yq delete things.yaml a.b.c
yq delete --inplace things.yaml a.b.c
yq d -i things.yaml a.b.c
yq d things.yaml a.b.c
	
Flags:
  -d, --doc string   process document index number (0 based, * for all documents) (default "0")
  -h, --help         help for delete
  -i, --inplace      update the yaml file inplace
Global Flags:
  -t, --trim      trim yaml output (default true)
  -v, --verbose   verbose mode
19:41:01 main [ERRO] Asked to process document index 0 but there are only 0 document(s)

Cant start AppDeamon. Dont know whats wrong!??

How do You install AppDaemon?

Via hassio and Add-On Store! How do you mean?