Konfigurace
MQTT konfigurace pro centrální systém Home Assistant. Logiku pro jiný systém odvodíte.
SWITCHLIGHTFANSENSORAIR
mqtt:
# SPÍNAČE
switch:
# SPÍNAČE PŘEPÍNACÍ oba spínače slouží jako přepínač
- name: "Rolety"
unique_id: "pyramidak_rolety"
state_topic: "rolety/switch1/state"
command_topic: "rolety/switch1/command"
# SPÍNAČE SPÍNACÍ každý spínač ovládá jiný spotřebič
- name: "Topení obývák"
unique_id: "pyramidak_topeni_obyvak"
state_topic: "topeni/switch1/state"
command_topic: "topeni/switch1/command"
- name: "Repra zadní"
unique_id: "pyramidak_repra_zadni"
state_topic: "topeni/switch2/state"
command_topic: "topeni/switch2/command"
# SPÍNAČE SPOJENÉ oba spínače spínají jako jeden
- name: "Repra přední a basové"
unique_id: "pyramidak_repra"
state_topic: "repra/switch/state"
command_topic: "repra/switch/command"
mqtt:
# SVĚTLA
light:
# SVĚTLO STMÍVACÍ ovládání výkonu světla
- name: "Kuchyně"
unique_id: "pyramidak_kuchyne"
state_topic: "kuchyne/switch1/state"
command_topic: "kuchyne/switch1/command"
brightness_state_topic: "kuchyne/brightness/state"
brightness_command_topic: "kuchyne/brightness/command"
# SVĚTLO SPÍNACÍ druhý spínač je světlo, první je větrák
- name: "Koupelna"
unique_id: "pyramidak_koupelna_svetlo"
state_topic: "koupelna/switch2/state"
command_topic: "koupelna/switch2/command"
mqtt:
# VĚTRÁKY
fan:
- name: "Koupelna"
unique_id: "pyramidak_koupelna_vetrak"
state_topic: "koupelna/switch1/state"
command_topic: "koupelna/switch1/command"
mqtt:
# SENZORY
sensor:
# SENZOR DVEŘÍ
- name: "Dveře záchod"
unique_id: "pyramidak_zachod_dvere"
state_topic: "zachod/analog/state"
# SENZOR SPÍNAČE
- name: "Spínač světla"
unique_id: "pyramidak_zachod_spinac"
state_topic: "zachod/digital/state"
# SENZOR POHYBU
- name: "Pohyb chodba"
unique_id: "pyramidak_chodba_pohyb"
state_topic: "chodba/digital/state"
# SENZOR TEPLOTY a VLHKOSTI
- name: "Teplota koupelna"
unique_id: "pyramidak_zrcadlo_teplota"
state_topic: "zrcadlo/digital/state"
device_class: temperature
unit_of_measurement: '°C'
- name: "Vlhkost koupelna"
unique_id: "pyramidak_zrcadlo_vlhkost"
state_topic: "zrcadlo/digital2/state"
device_class: humidity
unit_of_measurement: '%'
# SENZOR SVĚTLA
- name: "Světlo koupelna"
unique_id: "pyramidak_zrcadlo_svetlo"
state_topic: "zrcadlo/analog/state"
# SENZOR PROUDU
- name: "Proud pračka"
unique_id: "pyramidak_pracka_proud"
state_topic: "pracka/analog/state"
# ONLINE
- name: "chodba"
state_topic: "chodba/status"
unique_id: "pyramidak_chodba_status"
expire_after: 90
# FIRMWARE
- name: "chodba"
state_topic: "chodba/update/state"
unique_id: "pyramidak_chodba_update"
# IP ADRESA
- name: "chodba"
state_topic: "chodba/ip/state"
unique_id: "pyramidak_chodba_ip"
mqtt:
# SENZORY
sensor:
# KVALITA VZDUCHU
- name: "Doma skóre vzduchu"
unique_id: "pyramidak_doma_score"
state_topic: "doma/quality/number"
device_class: aqi
- name: "Doma kvalita vzduchu"
unique_id: "pyramidak_doma_word"
state_topic: "doma/quality/word"
# SVĚTLO
- name: "Doma světlo"
unique_id: "pyramidak_doma_light"
state_topic: "doma/light"
device_class: illuminance
unit_of_measurement: 'lx'
# OXID UHLIČITÝ
- name: "Doma oxid uhličitý"
unique_id: "pyramidak_doma_co2"
state_topic: "doma/co2"
device_class: carbon_dioxide
unit_of_measurement: 'ppm'
# TĚKAVÉ LÁTKY
- name: "Doma těkavé látky"
unique_id: "pyramidak_doma_tvoc"
state_topic: "doma/tvoc"
device_class: volatile_organic_compounds
unit_of_measurement: 'ppb'
# TEPLOTA
- name: "Doma teplota"
unique_id: "pyramidak_doma_temperature"
state_topic: "doma/temperature"
device_class: temperature
unit_of_measurement: '°C'
# VLHKOST
- name: "Doma vlhkost"
unique_id: "pyramidak_doma_humidity"
state_topic: "doma/humidity"
device_class: humidity
unit_of_measurement: '%'
# ATMOSFERICKÝ TLAK
- name: "Tlak"
unique_id: "pyramidak_venku_pressure"
state_topic: "venku/pressure"
device_class: atmospheric_pressure
unit_of_measurement: 'hPa'
# RYCHLOST VĚTRU
- name: "Vítr"
unique_id: "pyramidak_venku_wind"
state_topic: "venku/logic/analog"
device_class: wind_speed
unit_of_measurement: 'km/h'
# KAPKY DEŠTĚ
- name: "Déšť"
unique_id: "pyramidak_venku_raindrops"
state_topic: "venku/logic/digital"
# nebo
state_topic: "venku/logic/analog"
# HOME ASSISTANT LAYOUT SENZORŮ
type: grid
title: Obývák
cards:
- type: gauge
entity: sensor.doma_teplota
min: 19
severity:
green: 22
yellow: 25
red: 28
name: Teplota
unit: ' '
needle: true
max: 31
- type: gauge
entity: sensor.doma_vlhkost
min: 20
max: 100
severity:
green: 40
yellow: 60
red: 80
name: Vlhkost
needle: true
- type: gauge
entity: sensor.doma_tlak
min: 985
max: 1040
severity:
green: 1003
yellow: 1023
red: 0
unit: ' '
needle: true
name: Tlak
- type: gauge
entity: sensor.doma_oxid_uhlicity
min: 0
severity:
green: 0
yellow: 1000
red: 2000
max: 3000
name: Oxid uhličitý
unit: ' '
needle: true
- type: gauge
entity: sensor.doma_tekave_latky
min: 0
severity:
green: 0
yellow: 100
red: 200
name: Těkavé látky
unit: ' '
needle: true
max: 300
- type: gauge
min: 1
max: 4
entity: sensor.doma_skore_vzduchu
name: Stav ovzduší
severity:
green: 1
yellow: 2
red: 3
needle: true
# PRACHOVÉ ČÁSTICE hmotnostní koncentrace
- name: "Venku PM1.0 hmotnost"
unique_id: "pyramidak_venku_mass_pm1"
state_topic: "venku/particles/mass"
value_template: "{{ value_json.PM1 }}"
device_class: pm1
unit_of_measurement: 'µg/m³'
- name: "Venku PM2.5 hmotnost"
unique_id: "pyramidak_venku_mass_pm25"
state_topic: "venku/particles/mass"
value_template: "{{ value_json.PM25 }}"
device_class: pm25
unit_of_measurement: 'µg/m³'
- name: "Venku PM4.0 hmotnost"
unique_id: "pyramidak_venku_mass_pm4"
state_topic: "venku/particles/mass"
value_template: "{{ value_json.PM4 }}"
device_class: pm10
unit_of_measurement: 'µg/m³'
- name: "Venku PM10 hmotnost"
unique_id: "pyramidak_venku_mass_pm10"
state_topic: "venku/particles/mass"
value_template: "{{ value_json.PM10 }}"
device_class: pm10
unit_of_measurement: 'µg/m³'
# PRACHOVÉ ČÁSTICE početní koncentrace
- name: "Venku PM1.0 počet"
unique_id: "pyramidak_venku_number_pm1"
state_topic: "venku/particles/number"
value_template: "{{ value_json.PM1 }}"
device_class: pm1
unit_of_measurement: '#/cm³'
- name: "Venku PM2.5 počet"
unique_id: "pyramidak_venku_number_pm25"
state_topic: "venku/particles/number"
value_template: "{{ value_json.PM25 }}"
device_class: pm25
unit_of_measurement: '#/cm³'
- name: "Venku PM4.0 počet"
unique_id: "pyramidak_venku_number_pm4"
state_topic: "venku/particles/number"
value_template: "{{ value_json.PM4 }}"
device_class: pm10
unit_of_measurement: '#/cm³'
- name: "Venku PM10 počet"
unique_id: "pyramidak_venku_number_pm10"
state_topic: "venku/particles/number"
value_template: "{{ value_json.PM10 }}"
device_class: pm10
unit_of_measurement: '#/cm³'
# HOME ASSISTANT LAYOUT PRACHOVÝCH ČÁSTIC
type: grid
title: Venku prachové částice
cards:
- type: gauge
entity: sensor.venku_pm2_5_hmotnost
min: 0
max: 125
severity:
green: 0
yellow: 30
red: 70
needle: false
name: PM2.5 µg/m³
unit: ' '
- type: gauge
entity: sensor.venku_pm4_hmotnost
min: 0
max: 150
severity:
green: 0
yellow: 40
red: 85
unit: ' '
needle: false
name: PM4 µg/m³
- type: gauge
entity: sensor.venku_pm10_hmotnost
min: 0
max: 175
unit: ' '
severity:
green: 0
yellow: 50
red: 100
name: PM10 µg/m³
- type: gauge
entity: sensor.venku_pm2_5_pocet
min: 0
severity:
green: 0
yellow: 5
red: 15
max: 25
needle: false
name: 'PM2.5 #/cm³'
unit: ' '
- type: gauge
entity: sensor.venku_pm4_pocet
min: 0
severity:
green: 0
yellow: 5
red: 15
max: 25
needle: false
name: 'PM4 #/cm³'
unit: ' '
- type: gauge
entity: sensor.venku_pm10_pocet
name: 'PM10 #/cm³'
unit: ' '
severity:
green: 0
yellow: 5
red: 15
min: 0
max: 25
Automatizace
Automatizace a scripty pro centrální systém Home Assistant. Logiku pro jiný systém odvodíte.
System StartStates ReloadDevices ReloadMass UpdateSun State
alias: HA_start
description: ""
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: script.pyramidak_reload
data: {}
mode: single
alias: pyramidak_reload
sequence:
- service: mqtt.publish
data:
qos: 0
retain: false
topic: pyramidak/brightness/command
- service: mqtt.publish
data:
qos: 0
retain: false
topic: pyramidak/switch/command
- service: mqtt.publish
data:
qos: 0
retain: false
topic: pyramidak/sensor/command
mode: single
icon: mdi:reload
alias: MQTT_reload
sequence:
- service: mqtt.reload
data: {}
- service: script.pyramidak_reload
data: {}
mode: single
icon: mdi:reload-alert
alias: pyramidak_update
sequence:
- service: mqtt.publish
data:
qos: 0
retain: false
topic: pyramidak/update/command
mode: single
icon: mdi:auto-download
alias: sun_state
description: ""
trigger:
- platform: mqtt
topic: pyramidak/sun/command
- platform: state
entity_id:
- sun.sun
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: sun.sun
state: above_horizon
sequence:
- service: mqtt.publish
data:
topic: pyramidak/sun/state
payload: above_horizon
qos: 0
retain: false
default:
- service: mqtt.publish
data:
topic: pyramidak/sun/state
payload: below_horizon
qos: 0
retain: false
mode: single