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
+1 -17
View File
@@ -1,25 +1,9 @@
mqtt:
sensor:
- name: "Desk switch battery"
state_topic: "z2m_deconz/desk_switch"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Desk switch LQI"
state_topic: "z2m_deconz/desk_switch"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
automation:
- alias: Living room · Desk switch
use_blueprint:
path: aqara_switch.yaml
input:
z2m_topic: "z2m_deconz/desk_switch/action"
action_entity: sensor.desk_switch_action
click:
- service: light.toggle
data_template:
@@ -1,29 +1,10 @@
mqtt:
sensor:
- name: "Living room Opple action"
state_topic: "z2m_deconz/opple_2/action"
availability_topic: "z2m_deconz/bridge/state"
icon: "mdi:gesture-double-tap"
- name: "Living room Opple battery"
state_topic: "z2m_deconz/opple_2"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "%"
device_class: "battery"
value_template: "{{ value_json.battery }}"
- name: "Living room Opple LQI"
state_topic: "z2m_deconz/opple_2"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
automation:
- alias: Living room · Opple
id: living_room_opple
use_blueprint:
path: oppo_6_btn_switch.yaml
input:
opple_z2m_name: "z2m_deconz/opple_2"
action_sensor: sensor.living_room_opple_action
action_sensor: sensor.opple_2_action
button_1_single:
- service: light.turn_off
+6 -6
View File
@@ -73,8 +73,8 @@ template:
{% set temp_matching = states('sensor.multisensor_6_temperature')|float >= states('input_number.toshiba_trigger_temp')|float %}
{% set outside_temp_high = states('sensor.dark_sky_apparent_temperature')|float + 2 >= states('input_number.toshiba_trigger_temp')|float %}
{% set someone_home = is_state('binary_sensor.someone_home', 'on') %}
{% set bedroom_ready = is_state('group.bedroom_windows', 'off') or is_state('binary_sensor.bedroom_door', 'off') %}
{% set kitchen_ready = is_state('binary_sensor.kitchen_window', 'off') or is_state('binary_sensor.kitchen_door', 'off') %}
{% set bedroom_ready = is_state('group.bedroom_windows', 'off') or is_state('binary_sensor.bedroom_door_contact', 'off') %}
{% set kitchen_ready = is_state('binary_sensor.kitchen_window_contact', 'off') or is_state('binary_sensor.kitchen_door_contact', 'off') %}
{% set ac_off = is_state('climate.toshiba_ac', 'off') %}
{{ temp_matching and outside_temp_high and someone_home and bedroom_ready and kitchen_ready and ac_off }}
@@ -157,10 +157,10 @@ automation:
for: "00:05:00"
- platform: state
entity_id:
- binary_sensor.living_room_right_window
- binary_sensor.living_room_right_window_contact
- group.bedroom_windows
- binary_sensor.kitchen_window
- binary_sensor.kitchen_door
- binary_sensor.kitchen_window_contact
- binary_sensor.kitchen_door_contact
from: "on"
to: "off"
action:
@@ -178,7 +178,7 @@ automation:
- platform: state
entity_id:
- binary_sensor.living_room_right_window
- binary_sensor.living_room_right_window_contact
- group.bedroom_windows
from: "off"
to: "on"
+6 -76
View File
@@ -1,41 +1,22 @@
mqtt:
sensor:
- name: "Trust remote action"
state_topic: "z2m_deconz/trust_remote"
availability_topic: "z2m_deconz/bridge/state"
icon: "mdi:gesture-double-tap"
value_template: "{{ value_json.action }}"
- name: "Trust remote group"
state_topic: "z2m_deconz/trust_remote"
availability_topic: "z2m_deconz/bridge/state"
icon: "mdi:lightbulb-group"
value_template: "{{ value_json.action_group }}"
- name: "Trust remote LQI"
state_topic: "z2m_deconz/trust_remote"
availability_topic: "z2m_deconz/bridge/state"
unit_of_measurement: "lqi"
device_class: "signal_strength"
value_template: "{{ value_json.linkquality }}"
automation:
- alias: Trust remote · Guest bedroom
trigger:
- platform: mqtt
topic: z2m_deconz/trust_remote
- platform: state
entity_id: sensor.trust_remote_action
action:
- choose:
- conditions: "{{ trigger.payload_json.action == 'up-press' }}"
- conditions: "{{ trigger.to_state.state == 'up-press' }}"
sequence:
- service: light.turn_on
entity_id: light.tradfri_large
data_template:
brightness_pct: "{{ is_state('input_select.guest_bedroom_mode', 'day') | iif(100, 10) }}"
color_temp: "{{ states('input_number.guest_bedroom_light_temp') }}"
- conditions: "{{ trigger.payload_json.action == 'down-press' }}"
- conditions: "{{ trigger.to_state.state == 'down-press' }}"
sequence:
- service: light.turn_off
entity_id: light.tradfri_large
- conditions: "{{ trigger.payload_json.action == 'on' or trigger.payload_json.action == 'off' }}"
- conditions: "{{ trigger.to_state.state == 'on' or trigger.to_state.state == 'off' }}"
sequence:
- service: script.guest_bedroom_bedside_confirm
- service: input_select.select_next
@@ -59,7 +40,7 @@ automation:
{% elif groupId == 0 %}
{% set entityId = 'light.living_room_main' %}
{% elif groupId == 1 %}
{% set entityId = 'light.pc' %}
{% set entityId = 'light.hue_ambiance_7' %}
{% elif groupId == 2 %}
{% set entityId = 'light.living_room_ambient' %}
{% elif groupId == 3 %}
@@ -76,54 +57,3 @@ automation:
{% else %}
-20
{% endif %}
- alias: Trust remote · Turn on
trigger:
- platform: mqtt
topic: z2m_deconz/trust_remote
condition: "{{ trigger.payload_json.action == 'on' }}"
action:
- service: light.turn_on
data_template:
entity_id: >-
{% set groupId = (trigger.payload_json.action_group % 10) %}
{% if groupId == 5 %}
light.living_room
{% elif groupId == 0 %}
light.living_room_main
{% elif groupId == 1 %}
light.pc
{% elif groupId == 2 %}
light.living_room_ambient
{% elif groupId == 3 %}
light.living_room_ambient_main
{% elif groupId == 4 %}
light.light_lohas_2
{% endif %}
brightness_pct: 100
- alias: Trust remote · Turn off
trigger:
- platform: mqtt
topic: z2m_deconz/trust_remote
condition: "{{ trigger.payload_json.action == 'off' }}"
action:
- service: light.turn_off
data_template:
entity_id: >-
{% set groupId = (trigger.payload_json.action_group % 10) %}
{% if groupId == 5 %}
{% set entityId = 'light.living_room' %}
{% elif groupId == 0 %}
{% set entityId = 'light.living_room_main' %}
{% elif groupId == 1 %}
{% set entityId = 'light.pc' %}
{% elif groupId == 2 %}
{% set entityId = 'light.living_room_ambient' %}
{% elif groupId == 3 %}
{% set entityId = 'light.living_room_ambient_main' %}
{% elif groupId == 4 %}
{% set entityId = 'light.light_lohas_2' %}
{% endif %}
{{ entityId }}
+2 -2
View File
@@ -23,7 +23,7 @@ automation:
property_key: "001"
action:
- service: light.toggle
entity_id: light.pc
entity_id: light.hue_ambiance_7
- alias: Wallmote · Living room · 2 · Tap · Toggle Music
trigger:
@@ -62,7 +62,7 @@ automation:
- service: light.toggle
entity_id:
- light.living_room_main
- light.pc
- light.hue_ambiance_7
- alias: Wallmote · Living room · 3 · Hold · Toggle Ambient lights
trigger: