Switch to zigbee2mqtt auto discovery

This commit is contained in:
Georgi Gardev
2022-12-01 16:02:00 +02:00
parent c8b1404364
commit 94883087c2
51 changed files with 189 additions and 1804 deletions
+8 -8
View File
@@ -16,10 +16,10 @@ automation:
trigger:
platform: state
entity_id:
- binary_sensor.kitchen_window
- binary_sensor.living_room_right_window
- binary_sensor.bedroom_left_window
- binary_sensor.bedroom_right_window
- binary_sensor.kitchen_window_contact
- binary_sensor.living_room_right_window_contact
- binary_sensor.bedroom_left_window_contact
- binary_sensor.bedroom_right_window_contact
from: "off"
to: "on"
condition:
@@ -40,10 +40,10 @@ automation:
condition:
- condition: state
entity_id:
- binary_sensor.kitchen_window
- binary_sensor.living_room_right_window
- binary_sensor.bedroom_left_window
- binary_sensor.bedroom_right_window
- binary_sensor.kitchen_window_contact
- binary_sensor.living_room_right_window_contact
- binary_sensor.bedroom_left_window_contact
- binary_sensor.bedroom_right_window_contact
state: "on"
action:
- service: script.say
@@ -18,229 +18,3 @@ sensor:
- sensor.kitchen_weather_humidity
- sensor.hallway_weather_humidity
- sensor.guest_bedroom_weather_humidity
mqtt:
sensor:
# Bedroom weather sensor
- name: "Bedroom weather temperature"
state_topic: "z2m_deconz/bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value_json.temperature }}"
- name: "Bedroom weather humidity"
state_topic: "z2m_deconz/bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "humidity"
value_template: "{{ value_json.humidity }}"
- name: "Bedroom weather pressure"
state_topic: "z2m_deconz/bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "hPa"
device_class: "pressure"
value_template: "{{ value_json.pressure }}"
- name: "Bedroom weather battery"
state_topic: "z2m_deconz/bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Bedroom weather LQI"
state_topic: "z2m_deconz/bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
# Kitchen weather sensor
- name: "Kitchen weather temperature"
state_topic: "z2m_deconz/kitchen_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value_json.temperature }}"
- name: "Kitchen weather humidity"
state_topic: "z2m_deconz/kitchen_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "humidity"
value_template: "{{ value_json.humidity }}"
- name: "Kitchen weather pressure"
state_topic: "z2m_deconz/kitchen_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "hPa"
device_class: "pressure"
value_template: "{{ value_json.pressure }}"
- name: "Kitchen weather battery"
state_topic: "z2m_deconz/kitchen_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Kitchen weather LQI"
state_topic: "z2m_deconz/kitchen_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
# Bathroom weather sensor
- name: "Bathroom weather temperature"
state_topic: "z2m_deconz/bathroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value_json.temperature }}"
- name: "Bathroom weather humidity"
state_topic: "z2m_deconz/bathroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "humidity"
value_template: "{{ value_json.humidity }}"
- name: "Bathroom weather pressure"
state_topic: "z2m_deconz/bathroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "hPa"
device_class: "pressure"
value_template: "{{ value_json.pressure }}"
- name: "Bathroom weather battery"
state_topic: "z2m_deconz/bathroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Bathroom weather LQI"
state_topic: "z2m_deconz/bathroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
# Hallway weather sensor
- name: "Hallway weather temperature"
state_topic: "z2m_deconz/hallway_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value_json.temperature }}"
- name: "Hallway weather humidity"
state_topic: "z2m_deconz/hallway_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "humidity"
value_template: "{{ value_json.humidity }}"
- name: "Hallway weather pressure"
state_topic: "z2m_deconz/hallway_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "hPa"
device_class: "pressure"
value_template: "{{ value_json.pressure }}"
- name: "Hallway weather battery"
state_topic: "z2m_deconz/hallway_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Hallway weather LQI"
state_topic: "z2m_deconz/hallway_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
# Guest bedroom weather sensor
- name: "Guest bedroom weather temperature"
state_topic: "z2m_deconz/guest_bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value_json.temperature }}"
- name: "Guest bedroom weather humidity"
state_topic: "z2m_deconz/guest_bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "humidity"
value_template: "{{ value_json.humidity }}"
- name: "Guest bedroom weather pressure"
state_topic: "z2m_deconz/guest_bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "hPa"
device_class: "pressure"
value_template: "{{ value_json.pressure }}"
- name: "Guest bedroom weather battery"
state_topic: "z2m_deconz/guest_bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Guest bedroom weather LQI"
state_topic: "z2m_deconz/guest_bedroom_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
# Terrarium weather sensor
- name: "Terrarium weather temperature"
state_topic: "z2m_deconz/terrarium_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value_json.temperature }}"
- name: "Terrarium weather humidity"
state_topic: "z2m_deconz/terrarium_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "humidity"
value_template: "{{ value_json.humidity }}"
- name: "Terrarium weather pressure"
state_topic: "z2m_deconz/terrarium_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "hPa"
device_class: "pressure"
value_template: "{{ value_json.pressure }}"
- name: "Terrarium weather battery"
state_topic: "z2m_deconz/terrarium_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Terrarium weather LQI"
state_topic: "z2m_deconz/terrarium_weather"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
# Terrarium weather sensor
- name: "Aqara TVOC temperature"
state_topic: "z2m_deconz/aqara_tvoc"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "°C"
device_class: "temperature"
value_template: "{{ value_json.temperature }}"
- name: "Aqara TVOC humidity"
state_topic: "z2m_deconz/aqara_tvoc"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "humidity"
value_template: "{{ value_json.humidity }}"
- name: "Aqara TVOC voc"
state_topic: "z2m_deconz/aqara_tvoc"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "ppb"
device_class: "volatile_organic_compounds"
value_template: "{{ value_json.voc }}"
- name: "Aqara TVOC battery"
state_topic: "z2m_deconz/aqara_tvoc"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Aqara TVOC LQI"
state_topic: "z2m_deconz/aqara_tvoc"
availability_topic: "z2m_deconz/bridge/state"
device_class: "signal_strength"
unit_of_measurement: "lqi"
value_template: "{{ value_json.linkquality }}"
+3 -3
View File
@@ -103,12 +103,12 @@ automation:
- alias: Climate · Heating · Link living room radiator to windows
trigger:
- platform: state
entity_id: binary_sensor.living_room_right_window
entity_id: binary_sensor.living_room_right_window_contact
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.living_room_right_window
entity_id: binary_sensor.living_room_right_window_contact
state: "on"
- condition: not
conditions:
@@ -125,7 +125,7 @@ automation:
domain: climate
- conditions:
- condition: state
entity_id: binary_sensor.living_room_right_window
entity_id: binary_sensor.living_room_right_window_contact
state: "off"
- condition: state
entity_id: climate.living_room_radiator_mode
+18 -98
View File
@@ -2,113 +2,33 @@ group:
all_windows:
name: All windows
entities:
- binary_sensor.living_room_right_window
- binary_sensor.bedroom_left_window
- binary_sensor.bedroom_right_window
- binary_sensor.kitchen_window
- binary_sensor.living_room_right_window_contact
- binary_sensor.bedroom_left_window_contact
- binary_sensor.bedroom_right_window_contact
- binary_sensor.kitchen_window_contact
bedroom_windows:
name: Bedroom windows
entities:
- binary_sensor.bedroom_left_window
- binary_sensor.bedroom_right_window
mqtt:
binary_sensor:
- name: "Living room right window"
state_topic: "z2m_deconz/living_room_right_window"
availability_topic: "z2m_deconz/bridge/state"
payload_on: false
payload_off: true
value_template: "{{ value_json.contact }}"
device_class: "window"
- name: "Bedroom left window"
state_topic: "z2m_deconz/bedroom_left_window"
availability_topic: "z2m_deconz/bridge/state"
payload_on: false
payload_off: true
value_template: "{{ value_json.contact }}"
device_class: "window"
- name: "Bedroom right window"
state_topic: "z2m_deconz/bedroom_right_window"
availability_topic: "z2m_deconz/bridge/state"
payload_on: false
payload_off: true
value_template: "{{ value_json.contact }}"
device_class: "window"
- name: "Kitchen window"
state_topic: "z2m_deconz/kitchen_window"
availability_topic: "z2m_deconz/bridge/state"
payload_on: false
payload_off: true
value_template: "{{ value_json.contact }}"
device_class: "window"
sensor:
- name: "Living room right window battery"
state_topic: "z2m_deconz/living_room_right_window"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Living room right window LQI"
state_topic: "z2m_deconz/living_room_right_window"
availability_topic: "z2m_deconz/bridge/state"
icon: "mdi:signal"
unit_of_measurement: "lqi"
value_template: "{{ value_json.linkquality }}"
- name: "Bedroom left window battery"
state_topic: "z2m_deconz/bedroom_left_window"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Bedroom left window LQI"
state_topic: "z2m_deconz/bedroom_left_window"
availability_topic: "z2m_deconz/bridge/state"
icon: "mdi:signal"
unit_of_measurement: "lqi"
value_template: "{{ value_json.linkquality }}"
- name: "Bedroom right window battery"
state_topic: "z2m_deconz/bedroom_right_window"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Bedroom right window LQI"
state_topic: "z2m_deconz/bedroom_right_window"
availability_topic: "z2m_deconz/bridge/state"
icon: "mdi:signal"
unit_of_measurement: "lqi"
value_template: "{{ value_json.linkquality }}"
- name: "Kitchen window battery"
state_topic: "z2m_deconz/kitchen_window"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Kitchen window LQI"
state_topic: "z2m_deconz/kitchen_window"
availability_topic: "z2m_deconz/bridge/state"
icon: "mdi:signal"
unit_of_measurement: "lqi"
value_template: "{{ value_json.linkquality }}"
- binary_sensor.bedroom_left_window_contact
- binary_sensor.bedroom_right_window_contact
sensor:
- platform: template
sensors:
open_window_count:
friendly_name: Open window count
friendly_name: Open windozw count
value_template: >-
{% set entityStates = states | selectattr('entity_id', 'in', state_attr('group.all_windows', 'entity_id')) %}
{{ entityStates | selectattr('state', 'eq', 'on') | list | count | int }}
homeassistant:
customize:
binary_sensor.living_room_right_window_contact:
device_class: window
binary_sensor.bedroom_left_window_contact:
device_class: window
binary_sensor.bedroom_right_window_contact:
device_class: window
binary_sensor.kitchen_window_contact:
device_class: window