LeskoIam / kronoterm_cloud_relay

REST server for forwarding data from cloud.kronoterm.com to local network
GNU General Public License v3.0
1 stars 0 forks source link

HA templete error: #12

Closed wifi75 closed 2 months ago

wifi75 commented 2 months ago

hello below your template:

image

template:

  - sensor:
  # System info
  - name: "Heat pump id"
    unique_id: heat_pump_id
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'hp_id') }}"

  - name: "Heat pump location name"
    unique_id: heat_pump_location_name
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'location_name') }}"

  - name: "Heat pump room temperature"
    unique_id: heat_pump_room_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').room_temperature }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump outlet temperature"
    unique_id: heat_pump_outlet_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').outlet_temperature }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump outside temperature"
    unique_id: heat_pump_outside_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').outside_temperature }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Sanitary water temperature"
    unique_id: sanitary_water_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').sanitary_water_temperature }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heating system pressure"
    unique_id: heat_pump_heating_system_pressure
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').heating_system_pressure }}"
    unit_of_measurement: bar
    device_class: pressure
    state_class: measurement

  - name: "Heat pump working function"
    unique_id: heat_pump_working_function
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').working_function }}"

  # Heating loop 1 (radiators)
  - name: "Heat pump loop 1 current temperature"
    unique_id: heating_loop_1_current_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_1').current_temp }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump loop 1 target temperature"
    unique_id: heating_loop_1_target_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_1').target_temp }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump loop 1 calculated target temperature"
    unique_id: heating_loop_1_calculated_target_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_1').calc_target_temp }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump loop 1 working status"
    unique_id: heating_loop_1_working_status
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_1').working_status }}"

  - name: "Heat pump loop 1 working mode"
    unique_id: heating_loop_1_working_mode
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_1').working_mode }}"

  # Heating loop 2 (radiators)
  - name: "Heat pump loop 2 target temperature"
    unique_id: heating_loop_2_target_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_2').target_temp }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump loop 2 calculated target temperature"
    unique_id: heating_loop_2_calculated_target_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_2').calc_target_temp }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump loop 2 working status"
    unique_id: heating_loop_2_working_status
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_2').working_status }}"

  - name: "Heat pump loop 2 working mode"
    unique_id: heating_loop_2_working_mode
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'heating_loop_2').working_mode }}"
LeskoIam commented 2 months ago

I think you will have to figure out this one by yourself. I have split configuration files in multiple directories, let me explain:

File: /sensors/heat_pump.yaml

# Main sensor with all the data
- platform: rest
  name: Kronoterm heat pump
  unique_id: kronoterm_heat_pump
  scan_interval: 60
  resource: http://ip-or-host:8555/hp_info/info_summary
  value_template: "{{ value_json.data.system_info.working_function }}"
  json_attributes_path: '$.data'
  json_attributes:
    - hp_id
    - location_name
    - user_level
    - heating_loop_names
    - alarms
    - system_info
    - heating_loop_1
    - heating_loop_2

File: custom_templates.yaml

- sensor:
  # System info
  - name: "Heat pump id"
    unique_id: heat_pump_id
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'hp_id') }}"

  - name: "Heat pump location name"
    unique_id: heat_pump_location_name
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'location_name') }}"

  - name: "Heat pump room temperature"
    unique_id: heat_pump_room_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').room_temperature }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump outlet temperature"
    unique_id: heat_pump_outlet_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').outlet_temperature }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heat pump outside temperature"
    unique_id: heat_pump_outside_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').outside_temperature }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Sanitary water temperature"
    unique_id: sanitary_water_temperature
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').sanitary_water_temperature }}"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement

  - name: "Heating system pressure"
    unique_id: heat_pump_heating_system_pressure
    state: "{{ state_attr('sensor.kronoterm_heat_pump', 'system_info').heating_system_pressure }}"
    unit_of_measurement: bar
...
..
.

File: configuration.yaml

template: !include custom_templates.yaml
sensor: !include_dir_merge_list ./sensors

rest_command:
  hp_set_mode_loop_1_on:
    url: http://ip-or-host:8555/hp_control/set_heating_loop_mode
    method: POST
    payload: '{"mode": "ON", "heating_loop": 1}'
    content_type: 'application/json'
  hp_set_mode_loop_1_off:
    url: http://ip-or-host:8555/hp_control/set_heating_loop_mode
    method: POST
    payload: '{"mode": "OFF", "heating_loop": 1}'
    content_type: 'application/json'
  hp_set_mode_loop_1_auto:
    url: http://ip-or-host:8555/hp_control/set_heating_loop_mode
    method: POST
    payload: '{"mode": "AUTO", "heating_loop": 1}'
    content_type: 'application/json'

  hp_set_mode_loop_2_on:
    url: http://ip-or-host:8555/hp_control/set_heating_loop_mode
    method: POST
    payload: '{"mode": "ON", "heating_loop": 2}'
    content_type: 'application/json'
  hp_set_mode_loop_2_off:
    url: http://ip-or-host:8555/hp_control/se
...
..
.

So some tinkering will be necessary I think this will get you started.

wifi75 commented 2 months ago

my configuration now it is as below:


group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
switch: !include switch.yaml
light: !include light.yaml
media_player: !include media_player.yaml
cover: !include cover.yaml 
climate: !include climate.yaml
sensor: !include sensors.yaml
binary_sensor: !include binary_sensor.yaml

homeassistant:

  customize: !include customize.yaml
  customize_glob: !include customize_glob.yaml
  packages: !include_dir_named packages

how i can add this ?

template: !include custom_templates.yaml sensor: !include_dir_merge_list ./sensors

wifi75 commented 2 months ago

could i copy all my yaml files into the package directory, just like i do with my other yaml files?

LeskoIam commented 2 months ago

You could paste from "my" /sensors/heat_pump.yaml to your sensors.yaml, and add the

template: !include custom_templates.yaml`

under your other includes.

Make sure you don't have duplicate !includes!

I don't know how you have set up your system so I can't tell you a lot more.

I don't know about packages, never used them.

wifi75 commented 2 months ago

can you post your HA dashboard for kronoterm pump please?

LeskoIam commented 2 months ago

hp_dash_01 hp_dash_02 hp_dash_03 hp_dash_04

wifi75 commented 2 months ago

oh yes thank you!!!

but this what is it for? you also have nothing that recalls this code..


rest_command:
  hp_set_mode_loop_1_on:
    url: http://192.168.1.131:8555/hp_control/set_heating_loop_mode
    method: POST
    payload: '{"mode": "ON", "heating_loop": 1}'
    content_type: 'application/json'
  hp_set_mode_loop_1_off:
    url: http://192.168.1.131/hp_control/set_heating_loop_mode
    method: POST
    payload: '{"mode": "OFF", "heating_loop": 1}'
    content_type: 'application/json'
  hp_set_mode_loop_1_auto:
    url: http://192.168.1.131/hp_control/set_heating_loop_mode
    method: POST
    payload: '{"mode": "AUTO", "heating_loop": 1}'
    content_type: 'application/json'

  hp_set_mode_loop_2_on:
    url: http://192.168.1.131:8555/hp_control/set_heating_loop_mode
    method: POST
    payload: '{"mode": "ON", "heating_loop": 2}'
    content_type: 'application/json'
  hp_set_mode_loop_2_off:
    url: http://192.168.1.131:8555/hp_control/se
LeskoIam commented 2 months ago

There is a automation that triggers on input_number.heat_pump_set_temperature change redme

wifi75 commented 2 months ago

There is a automation that triggers on input_number.heat_pump_set_temperature change redme

I don't understand this one.. can you give me a practical example?

LeskoIam commented 2 months ago

When you set helper input_number.heat_pump_set_temperature to a new value (e.g from 22 to 23°C) automation alias: HP_set_room_temperature detects the change (look at the trigger:) and calls rest_command.hp_set_temperature to set new temperature. hp_dash_05 hp_dash_06 hp_dash_07

wifi75 commented 2 months ago

hello i created the automation as below: but i cant make it work, i didnt understand what to add in the HA dashboard.

image

LeskoIam commented 2 months ago

You add input_number.heat_pump_set_temperature to your dashboard.