Skip to content

Commit 8b08294

Browse files
committed
Add Tasmota OpenTherm to HA (#35)
1 parent 573bc47 commit 8b08294

File tree

18 files changed

+517
-135
lines changed

18 files changed

+517
-135
lines changed

playbooks/vms.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
---
2+
- name: Bootstrap host
3+
hosts: localhost
4+
become: false
5+
tasks:
6+
# - name: Change private key permissions
7+
# ansible.builtin.raw: >-
8+
# chmod -c 644 {{ ansible_ssh_private_key_file }}
9+
# register: private_key_perms
10+
# changed_when: private_key_perms.stdout != ""
11+
- name: Change private key permissions
12+
file:
13+
path: "{{ ansible_ssh_private_key_file }}"
14+
mode: 0600
15+
216
- name: Fedora on Clevo
317
ansible.builtin.import_playbook: fedora.yml
418
vars:

roles/servers/apps/home-assistant/defaults/main.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,33 @@ home_assistant:
6262
climate:
6363
# - name: garaz
6464
- name: przedpokoj
65-
switch: switch.sonoff_4chpror3_podlogowkadol1_4chpror3_switch_przedpokoj
66-
# - name: lazienka_dol
67-
# switch: switch.sonoff_4chpror3_podlogowkadol1_4chpror3_switch_przedpokoj
65+
switch: switch.sonoff_4chpror3_ogrzewanie_dol2_sonoff_4chpror3_ogrzewanie_dol2_korytarz
66+
- name: lazienka_dol
67+
switch: switch.sonoff_4chpror3_ogrzewanie_dol1_sonoff_4chpror3_ogrzewanie_dol1_lazienka
6868
- name: salon
69-
switch: switch.sonoff_4chpror3_podlogowkadol1_4chpror3_switch_przedpokoj
69+
switch: switch.sonoff_4chpror3_ogrzewanie_dol1_sonoff_4chpror3_ogrzewanie_dol1_salon
7070
- name: kuchnia
71-
switch: switch.sonoff_4chpror3_podlogowkadol1_4chpror3_switch_przedpokoj
71+
switch: switch.sonoff_4chpror3_ogrzewanie_dol1_sonoff_4chpror3_ogrzewanie_dol1_kuchnia
7272
- name: sypialnia_dol
73-
switch: switch.sonoff_4chpror3_podlogowkadol1_4chpror3_switch_przedpokoj
73+
switch: switch.sonoff_4chpror3_ogrzewanie_dol1_sonoff_4chpror3_ogrzewanie_dol1_sypialnia
7474
- name: pokoj_julia
75-
switch: switch.sonoff_4chpror3_podlogowkagora1_4chpror3_switch_przedpokoj
76-
- name: serwerownia
77-
switch: switch.sonoff_4chpror3_podlogowkagora1_4chpror3_switch_przedpokoj
78-
- name: pokoj_timi
79-
switch: switch.sonoff_4chpror3_podlogowkagora1_4chpror3_switch_przedpokoj
80-
- name: biuro_miki
81-
switch: switch.sonoff_4chpror3_podlogowkagora1_4chpror3_switch_przedpokoj
75+
switch: switch.sonoff_4chpror3_ogrzewanie_gora1_sonoff_4chpror3_ogrzewanie_gora1_pokoj_julia
8276
- name: sypialnia_gora
83-
switch: switch.sonoff_4chpror3_podlogowkagora2_4chpror3_switch_przedpokoj
77+
switch: switch.sonoff_4chpror3_ogrzewanie_gora1_sonoff_4chpror3_ogrzewanie_gora1_sypialnia
8478
- name: garderoba
85-
switch: switch.sonoff_4chpror3_podlogowkagora2_4chpror3_switch_przedpokoj
79+
switch: switch.sonoff_4chpror3_ogrzewanie_gora1_sonoff_4chpror3_ogrzewanie_gora1_garderoba
80+
- name: biuro_miki
81+
switch: switch.sonoff_4chpror3_ogrzewanie_gora1_sonoff_4chpror3_ogrzewanie_gora1_pokoj_nad_garazem
82+
- name: lazienka_gora
83+
switch: switch.sonoff_4chpror3_ogrzewanie_gora2_sonoff_4chpror3_ogrzewanie_gora2_lazienka
84+
- name: pokoj_timi
85+
switch: switch.group_ogrzewanie_pokoj_timi
86+
87+
# - name: pokoj_timi
88+
# switch: switch.sonoff_4chpror3_ogrzewanie_gora2_sonoff_4chpror3_ogrzewanie_gora2_pokoj_timi
89+
# - name: serwerownia
90+
# switch: switch.sonoff_4chpror3_ogrzewanie_gora2_sonoff_4chpror3_ogrzewanie_gora2_korytarz
91+
8692

8793
mqtt:
8894
zigbee_coordinator_base_topic: "tasmota_10B490"

roles/servers/apps/home-assistant/files/config/configuration.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ virtual:
7272
switch: !include switch.yaml
7373
climate: !include climate.yaml
7474

75+
rest:
76+
# scan_interval: 10
7577

7678
zha:
7779
zigpy_config:

roles/servers/apps/home-assistant/files/config/dashboard-tesla.yaml

Lines changed: 0 additions & 55 deletions
This file was deleted.

roles/servers/apps/home-assistant/files/config/mqtt.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,63 @@ binary_sensor: !include_dir_merge_list mqtt/binary_sensors/
66
light: !include_dir_merge_list mqtt/lights/
77

88
switch: !include_dir_merge_list mqtt/switches/
9+
10+
water_heater:
11+
- name: "piec_ciepla_woda_uzytkowa"
12+
temperature_command_topic: "cmnd/tasmota_1AA4E8/OT_TWATER"
13+
temperature_state_topic: "tele/tasmota_1AA4E8/SENSOR"
14+
temperature_state_template: "{{ value_json.OPENTHERM.DHWS }}"
15+
current_temperature_topic: "tele/tasmota_1AA4E8/SENSOR"
16+
current_temperature_template: "{{ value_json.OPENTHERM.TDHW }}"
17+
modes:
18+
- "off"
19+
- "gas"
20+
mode_command_topic: "cmnd/tasmota_1AA4E8/OT_CH"
21+
mode_command_template: >
22+
{% set values = { 'gas':'CH,DHW', 'off':'CH'} %}
23+
{% set cmd = values[value] %}
24+
{{ cmd }}
25+
mode_state_topic: "tele/tasmota_1AA4E8/SENSOR"
26+
mode_state_template: >
27+
{% if states('sensor.ot_dhw') == "1" %}
28+
gas
29+
{% else %}
30+
off
31+
{% endif %}
32+
qos: 0
33+
availability_topic: "tele/tasmota_1AA4E8/LWT"
34+
payload_available: "Online"
35+
payload_not_available: "Offline"
36+
temperature_unit: C
37+
min_temp: 40
38+
max_temp: 65
39+
- name: "piec_woda_ogrzewanie"
40+
temperature_command_topic: "cmnd/tasmota_1AA4E8/OT_TBOILER"
41+
temperature_state_topic: "tele/tasmota_1AA4E8/SENSOR"
42+
temperature_state_template: "{{ value_json.OPENTHERM.BTMP.ACT }}"
43+
current_temperature_topic: "tele/tasmota_1AA4E8/SENSOR"
44+
current_temperature_template: "{{ value_json.OPENTHERM.OT33 }}"
45+
modes:
46+
- "off"
47+
- "gas"
48+
mode_command_topic: "cmnd/tasmota_1AA4E8/OT_CH"
49+
mode_command_template: >
50+
{% set values = { 'gas':'1', 'off':'0'} %}
51+
{% set cmd = values[value] %}
52+
{{ cmd }}
53+
mode_state_topic: "tele/tasmota_1AA4E8/SENSOR"
54+
mode_state_template: >
55+
{% if states('sensor.ot_ch') == "1" %}
56+
gas
57+
{% else %}
58+
off
59+
{% endif %}
60+
qos: 0
61+
availability_topic: "tele/tasmota_1AA4E8/LWT"
62+
payload_available: "Online"
63+
payload_not_available: "Offline"
64+
temperature_unit: C
65+
min_temp: 30
66+
max_temp: 70
67+
68+
# mqttx - gui

roles/servers/apps/home-assistant/files/config/template.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,14 @@
1111
# {%- elif now().hour >= 19 and now().hour < 24 -%}
1212
# https://www.meteo.pl/um/metco/mgram_pict.php?ntype=0u&fdate={{ now().strftime('%Y%m%d') }}12&row=466&col=232&lang=pl
1313
# {%- endif %}
14+
15+
- sensor:
16+
- name: current_state_ch
17+
state: >
18+
{% if states('sensor.opentherm_opentherm_slave_dhw') == "1" %}
19+
Water
20+
{% elif states('sensor.opentherm_opentherm_slave_ch') == "1" %}
21+
CH
22+
{% else %}
23+
Idle
24+
{% endif %}

roles/servers/apps/home-assistant/tasks/config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
loop:
77
- "{{ install_path }}/config"
88
- "{{ install_path }}/config/automations"
9+
- "{{ install_path }}/config/sensors"
910
- "{{ install_path }}/config/.storage"
1011
- "{{ install_path }}/config/mqtt/binary_sensors"
1112
- "{{ install_path }}/config/mqtt/sensors"
@@ -42,6 +43,17 @@
4243
- ../templates/config/automations/*
4344
- "{{ playbook_dir }}/../../ansible-ops-private/templates/home-assistant/config/automations/*"
4445

46+
- name: Configure config/sensors
47+
template:
48+
src: "{{ item }}"
49+
dest: "{{ install_path }}/config/sensors/"
50+
mode: 0664
51+
backup: true
52+
with_fileglob:
53+
- ../templates/config/sensors/*
54+
- "{{ playbook_dir }}/../../ansible-ops-private/templates/home-assistant/config/sensors/*"
55+
56+
4557
- name: Configure config/mqtt/sensors
4658
template:
4759
src: "{{ item }}"
@@ -78,6 +90,15 @@
7890
with_fileglob:
7991
- ../templates/config/mqtt/switches/*
8092

93+
- name: Configure config/mqtt/water_heater
94+
template:
95+
src: "{{ item }}"
96+
dest: "{{ install_path }}/config/mqtt/water_heater/"
97+
mode: 0664
98+
backup: true
99+
with_fileglob:
100+
- ../templates/config/mqtt/water_heater/*
101+
81102
- name: Check that the .storage exists
82103
stat:
83104
path: "{{ install_path }}/config/.storage/onboarding"

roles/servers/apps/home-assistant/templates/config/automations/automations.yaml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- service: switch.turn_on
1212
data: {}
1313
target:
14-
entity_id: switch.gosund_pompa_gosund_switch_pompa_cyrkulacyjna
14+
entity_id: switch.sonoff_4chpror3_ogrzewanie_piec_sonoff_4chpror3_ogrzewanie_piec_pompa_cyrkulacyjna
1515
mode: single
1616
- alias: Wylacz cyrkulacje
1717
description: ''
@@ -25,7 +25,35 @@
2525
- service: switch.turn_off
2626
data: {}
2727
target:
28-
entity_id: switch.gosund_pompa_gosund_switch_pompa_cyrkulacyjna
28+
entity_id: switch.sonoff_4chpror3_ogrzewanie_piec_sonoff_4chpror3_ogrzewanie_piec_pompa_cyrkulacyjna
29+
mode: single
30+
- alias: Wlacz Grzejniki
31+
description: ''
32+
trigger:
33+
- platform: time
34+
at: 06:30:00
35+
- platform: time
36+
at: '18:30:00'
37+
condition: []
38+
action:
39+
- service: switch.turn_on
40+
data: {}
41+
target:
42+
entity_id: switch.sonoff_4chpror3_ogrzewanie_piec_sonoff_4chpror3_ogrzewanie_piec_pompa_grzejniki
43+
mode: single
44+
- alias: Wylacz Grzejniki
45+
description: ''
46+
trigger:
47+
- platform: time
48+
at: '07:00:00'
49+
- platform: time
50+
at: '19:00:00'
51+
condition: []
52+
action:
53+
- service: switch.turn_off
54+
data: {}
55+
target:
56+
entity_id: switch.sonoff_4chpror3_ogrzewanie_piec_sonoff_4chpror3_ogrzewanie_piec_pompa_grzejniki
2957
mode: single
3058
- alias: Click button to close dwor_brama
3159
description: ''
@@ -49,7 +77,7 @@
4977
- trigger: state
5078
entity_id:
5179
{% for i in home_assistant.climate %}
52-
- switch.virtual_ogrzewanie_{{ i.name }}
80+
- "{{ i.switch }}"
5381
{% endfor %}
5482
from: "off"
5583
to: "on"
@@ -59,7 +87,7 @@
5987
metadata: {}
6088
data: {}
6189
target:
62-
entity_id: switch.virtual_ogrzewanie_pompy
90+
entity_id: switch.sonoff_4chpror3_ogrzewanie_piec_sonoff_4chpror3_ogrzewanie_piec_pompa_podlogowka
6391
mode: single
6492
- alias: ogrzewanie_wylacz
6593
description: ""
@@ -85,7 +113,7 @@
85113
metadata: {}
86114
data: {}
87115
target:
88-
entity_id: switch.virtual_ogrzewanie_pompy
116+
entity_id: switch.sonoff_4chpror3_ogrzewanie_piec_sonoff_4chpror3_ogrzewanie_piec_pompa_podlogowka
89117
mode: single
90118

91119
# - alias: Alert Brama

0 commit comments

Comments
 (0)