Konfigurace balíčku může zahrnovat: switch, light, automation, groupsnebo většinu dalších integrací Home Assistant včetně hardwarových platforem.
Lze jej zadat přímo nebo v samostatném souboru YAML pomocí !include.
Využívám hojně možnost pomocí souboru konkretni_balicek.yaml
Pro většinu integraci mám vlastní soubor balíčku který obsahuje všechny helpery, sensory, skupiny, automatizace, atd.
Například balíček pro vysavač, pro měření el. energie, topení, atp.
V adresáři config jsem vytvořil složku s názvem all_package do které vkládám jednotlivé soubory.yaml balíčků.
V configuration.yaml mám jen odkaz na tuto složku:
Kód: Vybrat vše
homeassistant:
packages: !include_dir_named all_package
Ukázka balíčku pro integraci aroma difuzeru:
Kód: Vybrat vše
mqtt:
fan:
name: "Difuzér"
icon: "mdi:smoke"
state_topic: "stat/aroma_difuzer/RESULT"
state_value_template: "{% if value_json.POWER1 is defined %}{{ value_json.POWER1 }}{% endif%}"
command_topic: "cmnd/aroma_difuzer/POWER1"
preset_modes:
- "2h timer"
- "4h timer"
- "timer off"
preset_mode_state_topic: "stat/aroma_difuzer/timer"
preset_mode_command_topic: "cmnd/aroma_difuzer/tuyaenum2"
preset_mode_command_template: >-
{% if value == "2h timer" %}
{{ 0 }}
{% elif value == "4h timer" %}
{{ 1 }}
{% else %}
{{ 2 }}
{% endif %}
percentage_state_topic: "stat/aroma_difuzer/fanmode"
percentage_value_template: >-
{% if value == "low" %}
{{ 1 }}
{% elif value == "medium" %}
{{ 2 }}
{% elif value == "high" %}
{{ 3 }}
{% else %}
{{ 0 }}
{% endif %}
percentage_command_topic: "cmnd/aroma_difuzer/event"
percentage_command_template: >-
{% if value == 1 %}
{{ 'fanmode=1' }}
{% elif value == 2 %}
{{ 'fanmode=0' }}
{% elif value == 3 %}
{{ 'fanmode=2' }}
{% else %}
{{ 'fanmode=-1' }}
{% endif %}
speed_range_max: 3
availability_topic: "tele/aroma_difuzer/LWT"
payload_available: "Online"
payload_not_available: "Offline"
unique_id: "fan-diffuser"
select:
name: "Diffuser Color Mode"
command_topic: "cmnd/aroma_difuzer/event"
state_topic: "stat/aroma_difuzer/colormode"
options:
- "solid"
- "cycle"
availability:
- payload_available: "Online"
payload_not_available: "Offline"
topic: "tele/aroma_difuzer/LWT"
unique_id: "select-livingroom-diffueser-color-mode"
binary_sensor:
name: "Difuser Error"
state_topic: "stat/aroma_difuzer/error"
value_template: "{{ 'ON' if value != '0X00' else 'OFF' }}"
device_class: problem
availability_topic: "tele/aroma_difuzer/LWT"
payload_available: "Online"
payload_not_available: "Offline"
unique_id: "binary-diffueser-error"
######
### timers
######
timer:
difuzer_2h_timer:
duration: "1:59:55"
name: Difuzér 2h timer
icon: mdi:timer-sand
difuzer_4h_timer:
duration: "3:59:55"
name: Difuzér 4h timer
icon: mdi:timer-sand-full
#####
### Automatizace
#####
# automation:
# - alias: Aroma Difuzér - časovače
# description: ''
# trigger:
# - platform: mqtt
# topic: stat/aroma_difuzer/timer
# id: 2h timer
# payload: 2h timer
# - platform: mqtt
# topic: stat/aroma_difuzer/timer
# id: 4h timer
# payload: 4h timer
# - platform: mqtt
# topic: stat/aroma_difuzer/timer
# id: Timer off
# payload: timer off
# condition: []
# action:
# - choose:
# - conditions:
# - condition: trigger
# id: 2h timer
# sequence:
# - service: timer.start
# data:
# duration: '0'
# target:
# entity_id: timer.difuzer_2h_timer
# - service: timer.finish
# target:
# entity_id: timer.difuzer_4h_timer
# - conditions:
# - condition: trigger
# id: 4h timer
# sequence:
# - service: timer.start
# data:
# duration: '0'
# target:
# entity_id: timer.difuzer_4h_timer
# - service: timer.finish
# target:
# entity_id: timer.difuzer_2h_timer
# - conditions:
# - condition: trigger
# id: Timer off
# sequence:
# - service: timer.finish
# target:
# entity_id:
# - timer.difuzer_2h_timer
# - timer.difuzer_4h_timer
# default: []
# mode: single
## Card:
## V HACS nutno doinstalovat:
##..!!!
## fan-mode-button-row
## fan-percent-button-row
## timer-bar-card
# type: vertical-stack
# cards:
# - shorten_cards: false
# consolidate_entities: false
# child_card: false
# hide_header: true
# header: LED efekty Aroma Difuzér
# color_wheel: true
# persist_features: true
# brightness: true
# color_temp: true
# white_value: true
# color_picker: true
# smooth_color_wheel: false
# show_slider_percent: false
# full_width_sliders: false
# brightness_icon: weather-sunny
# white_icon: file-word-box
# temperature_icon: thermometer
# type: custom:light-entity-card
# entity: light.led_rgb
# effects_list: true
# - type: custom:fan-percent-button-row
# entity: fan.difuzer
# name: Aroma
# reverseButtons: true
# customTheme: true
# isOnLowColor: rgb(204, 255, 153)
# isOnMedColor: rgb(51, 255, 51)
# isOnHiColor: rgb(0, 53, 0)
# buttonInactiveColor: '#202020'
# isOffColor: RED
# customHiText: SILNÉ
# customLowText: SLABÉ
# customMedText: STŘEDNÍ
# customOffText: 'OFF'
# width: 55px
# height: 45px
# - type: custom:fan-mode-button-row
# entity: fan.difuzer
# name: Časovač
# twoModeFan: false
# reverseButtons: true
# customTheme: true
# isOnModeOneColor: '#FF99FF'
# isOnModeTwoColor: '#FF33FF'
# isOnModeThreeColor: '#CC00CC'
# buttonInactiveColor: '#202020'
# isOffColor: red
# customModes: true
# modeOff: 'OFF'
# modeOne: 2h timer
# modeTwo: 4h timer
# modeThree: timer off
# customText: true
# customOffText: 'OFF'
# customModeOneText: 2 HOD
# customModeTwoText: 4 HOD
# customModeThreeText: ∞ HOD
# width: 55px
# height: 45px
# - type: entity-filter
# entities:
# - entity: timer.difuzer_2h_timer
# name: 2 hodiny
# - entity: timer.difuzer_4h_timer
# name: 4 hodiny
# state_filter:
# - active
# card:
# type: custom:timer-bar-card
# entities:
# - entity: timer.difuzer_2h_timer
# name: Aroma 2 hodiny
# - entity: timer.difuzer_4h_timer
# name: 4 hodiny
# bar_direction: rtl
# bar_foreground: '#eee'
# bar_background: 'var(--mdc-theme-primary, #6200ee)'
mqtt:
fan:
name: "Difuzér"
icon: "mdi:smoke"
state_topic: "stat/aroma_difuzer/RESULT"
state_value_template: "{% if value_json.POWER1 is defined %}{{ value_json.POWER1 }}{% endif%}"
command_topic: "cmnd/aroma_difuzer/POWER1"
preset_modes:
- "2h timer"
- "4h timer"
- "timer off"
preset_mode_state_topic: "stat/aroma_difuzer/timer"
preset_mode_command_topic: "cmnd/aroma_difuzer/tuyaenum2"
preset_mode_command_template: >-
{% if value == "2h timer" %}
{{ 0 }}
{% elif value == "4h timer" %}
{{ 1 }}
{% else %}
{{ 2 }}
{% endif %}
percentage_state_topic: "stat/aroma_difuzer/fanmode"
percentage_value_template: >-
{% if value == "low" %}
{{ 1 }}
{% elif value == "medium" %}
{{ 2 }}
{% elif value == "high" %}
{{ 3 }}
{% else %}
{{ 0 }}
{% endif %}
percentage_command_topic: "cmnd/aroma_difuzer/event"
percentage_command_template: >-
{% if value == 1 %}
{{ 'fanmode=1' }}
{% elif value == 2 %}
{{ 'fanmode=0' }}
{% elif value == 3 %}
{{ 'fanmode=2' }}
{% else %}
{{ 'fanmode=-1' }}
{% endif %}
speed_range_max: 3
availability_topic: "tele/aroma_difuzer/LWT"
payload_available: "Online"
payload_not_available: "Offline"
unique_id: "fan-diffuser"
select:
name: "Diffuser Color Mode"
command_topic: "cmnd/aroma_difuzer/event"
state_topic: "stat/aroma_difuzer/colormode"
options:
- "solid"
- "cycle"
availability:
- payload_available: "Online"
payload_not_available: "Offline"
topic: "tele/aroma_difuzer/LWT"
unique_id: "select-livingroom-diffueser-color-mode"
binary_sensor:
name: "Difuser Error"
state_topic: "stat/aroma_difuzer/error"
value_template: "{{ 'ON' if value != '0X00' else 'OFF' }}"
device_class: problem
availability_topic: "tele/aroma_difuzer/LWT"
payload_available: "Online"
payload_not_available: "Offline"
unique_id: "binary-diffueser-error"
######
### timers
######
timer:
difuzer_2h_timer:
duration: "1:59:55"
name: Difuzér 2h timer
icon: mdi:timer-sand
difuzer_4h_timer:
duration: "3:59:55"
name: Difuzér 4h timer
icon: mdi:timer-sand-full
#####
### Automatizace
#####
# automation:
# - alias: Aroma Difuzér - časovače
# description: ''
# trigger:
# - platform: mqtt
# topic: stat/aroma_difuzer/timer
# id: 2h timer
# payload: 2h timer
# - platform: mqtt
# topic: stat/aroma_difuzer/timer
# id: 4h timer
# payload: 4h timer
# - platform: mqtt
# topic: stat/aroma_difuzer/timer
# id: Timer off
# payload: timer off
# condition: []
# action:
# - choose:
# - conditions:
# - condition: trigger
# id: 2h timer
# sequence:
# - service: timer.start
# data:
# duration: '0'
# target:
# entity_id: timer.difuzer_2h_timer
# - service: timer.finish
# target:
# entity_id: timer.difuzer_4h_timer
# - conditions:
# - condition: trigger
# id: 4h timer
# sequence:
# - service: timer.start
# data:
# duration: '0'
# target:
# entity_id: timer.difuzer_4h_timer
# - service: timer.finish
# target:
# entity_id: timer.difuzer_2h_timer
# - conditions:
# - condition: trigger
# id: Timer off
# sequence:
# - service: timer.finish
# target:
# entity_id:
# - timer.difuzer_2h_timer
# - timer.difuzer_4h_timer
# default: []
# mode: single
## Card:
## V HACS nutno doinstalovat:
##..!!!
## fan-mode-button-row
## fan-percent-button-row
## timer-bar-card
# type: vertical-stack
# cards:
# - shorten_cards: false
# consolidate_entities: false
# child_card: false
# hide_header: true
# header: LED efekty Aroma Difuzér
# color_wheel: true
# persist_features: true
# brightness: true
# color_temp: true
# white_value: true
# color_picker: true
# smooth_color_wheel: false
# show_slider_percent: false
# full_width_sliders: false
# brightness_icon: weather-sunny
# white_icon: file-word-box
# temperature_icon: thermometer
# type: custom:light-entity-card
# entity: light.led_rgb
# effects_list: true
# - type: custom:fan-percent-button-row
# entity: fan.difuzer
# name: Aroma
# reverseButtons: true
# customTheme: true
# isOnLowColor: rgb(204, 255, 153)
# isOnMedColor: rgb(51, 255, 51)
# isOnHiColor: rgb(0, 53, 0)
# buttonInactiveColor: '#202020'
# isOffColor: RED
# customHiText: SILNÉ
# customLowText: SLABÉ
# customMedText: STŘEDNÍ
# customOffText: 'OFF'
# width: 55px
# height: 45px
# - type: custom:fan-mode-button-row
# entity: fan.difuzer
# name: Časovač
# twoModeFan: false
# reverseButtons: true
# customTheme: true
# isOnModeOneColor: '#FF99FF'
# isOnModeTwoColor: '#FF33FF'
# isOnModeThreeColor: '#CC00CC'
# buttonInactiveColor: '#202020'
# isOffColor: red
# customModes: true
# modeOff: 'OFF'
# modeOne: 2h timer
# modeTwo: 4h timer
# modeThree: timer off
# customText: true
# customOffText: 'OFF'
# customModeOneText: 2 HOD
# customModeTwoText: 4 HOD
# customModeThreeText: ∞ HOD
# width: 55px
# height: 45px
# - type: entity-filter
# entities:
# - entity: timer.difuzer_2h_timer
# name: 2 hodiny
# - entity: timer.difuzer_4h_timer
# name: 4 hodiny
# state_filter:
# - active
# card:
# type: custom:timer-bar-card
# entities:
# - entity: timer.difuzer_2h_timer
# name: Aroma 2 hodiny
# - entity: timer.difuzer_4h_timer
# name: 4 hodiny
# bar_direction: rtl
# bar_foreground: '#eee'
# bar_background: 'var(--mdc-theme-primary, #6200ee)'