ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integration of HASmartThermostat with Homematic IP Thermostats and Zigbee Outlet

Andykakau opened this issue · comments

Hi everyone,

I’m looking to integrate HASmartThermostat 2 into Home Assistant to control my heating. I have Homematic IP thermostats providing the set and actual temperatures. I want to use these with the HASmartThermostat integration to control a Zigbee outlet.

Here is the code I tried:

- platform: smart_thermostat
   name: Kleines Bad Example
   unique_id: climate.hm_tc_it_wm_w_eu_req0837768
   heater: switch.heizung_bad_klein_schalter_2
   target_sensor: sensor.ambient_temperature
   min_temp: 7
   max_temp: 28
   ac_mode: False
   target_temp: climate.hm_tc_it_wm_w_eu_req0837768
   keep_alive:
     seconds: 60
   away_temp: 14
   kp: 50
   ki: 0.01
   kd: 2000
   pwm: 00:15:00

How can I adjust it to properly read values from the thermostat and make it work? Any ideas?

Thanks!

Hello, you can't set an entity id as target temperature. You need to create an automation in HA that will sync he target temperature between Homematic thermostat and the smart thermostat.

Example:

alias: Example sync thermostats
description: ""
trigger:
  - platform: state
    entity_id:
      - climate.netatmo_couloir
    attribute: temperature
    id: Physical change
  - platform: state
    entity_id:
      - climate.salle_de_bain
    attribute: temperature
    id: Smart change
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Physical change
          - condition: template
            value_template: >-
              {{ (state_attr('climate.netatmo_couloir', 'temperature') | float)
              != (state_attr('climate.salle_de_bain', 'temperature') | float )}}
        sequence:
          - service: climate.set_temperature
            metadata: {}
            data:
              temperature: "{{ state_attr('climate.netatmo_couloir', 'temperature') }}"
            target:
              entity_id: climate.salle_de_bain
      - conditions:
          - condition: trigger
            id:
              - Smart change
          - condition: template
            value_template: >-
              {{ (state_attr('climate.netatmo_couloir', 'temperature') | float)
              != (state_attr('climate.salle_de_bain', 'temperature') | float )}}
        sequence:
          - service: climate.set_temperature
            metadata: {}
            data:
              temperature: "{{ state_attr('climate.salle_de_bain', 'temperature') }}"
            target:
              entity_id: climate.netatmo_couloir
mode: single

You may also add more triggers and choices to sync the presets, or on/off.
You also need to extract the physical thermostat ambient temperature with a template sensor using {{ state_attr('climate.netatmo_couloir', 'current_temperature') }} that you'll use as target_sensor.

And of course, the physical thermostat should not control directly the heating.