Upload files to "Blueprints"

This commit is contained in:
2026-07-31 17:54:44 +02:00
parent b4a685562c
commit a22699baeb
4 changed files with 764 additions and 0 deletions

320
Blueprints/PTM_21xZ_ZE.yaml Normal file
View File

@@ -0,0 +1,320 @@
blueprint:
homeassistant:
min_version: 2024.10.0
name: EnOcean PTM 21xZ/ZE (MQTT trigger)
description: "Controller automation for executing **press/hold/release** actions
triggered by EnOcean PTM 21xZ/ZE switch.\n\n**PTM216Z**\nMake sure to manually
create a separate **Text Helper** and define its entity in the automation. It
is used to store the last controller event to filter and handle `button hold`
actions.\n\n**SETTINGS**\nIn this tab, there is the possibility to change different
parameters.\n - **Base topic**\n - **Hold delay**\n - **PTM216Z - Specific
settings**\n\nℹ️ Version 2025.12.13\n"
domain: automation
input:
controller:
name: Controller Name
description: The name of the controller as defined in Z2M (e.g. Livingroom_Switch)
default: []
selector:
text:
type: text
multiple: true
multiline: false
settings_section:
name: Settings
icon: mdi:cog-outline
collapsed: true
input:
base_topic:
name: Base topic (MQTT)
description: The base topic as configured in z2m
default: zigbee2mqtt
hold_delay:
name: Hold delay
description: If the button has been held more than the configured Hold delay,
the corresponding held action is triggered.
default: 500
selector:
number:
min: 100.0
max: 1000.0
unit_of_measurement: milliseconds
mode: box
step: 10.0
ptm216z_selector:
name: PTM216Z
description: Turn **On** only if using a PTM216Z
default: false
selector:
boolean: {}
helper_last_controller_event:
name: PTM216Z - Last Controller Event
description: 'Input Text used to store the last event fired by the controller.
You will need to manually create a text input Helper entity for this.
'
default: []
selector:
entity:
domain:
- input_text
multiple: false
reorder: false
ptm21xz_ze_actions:
name: PTM21xZ/ZE - Actions
icon: mdi:gesture-tap
collapsed: true
input:
button_1_pressed:
name: Button 1 Pressed
description: Action to run when button 1 is pressed.
default: []
selector:
action: {}
button_1_held:
name: Button 1 Held
description: Action to run when the button 1 is held.
default: []
selector:
action: {}
button_1_released:
name: Button 1 Released
description: Action to run when the button 1 is released after long press.
default: []
selector:
action: {}
button_2_pressed:
name: Button 2 Pressed
description: Action to run when the button 2 pressed.
default: []
selector:
action: {}
button_2_held:
name: Button 2 Held
description: Action to run when the button 2 is held.
default: []
selector:
action: {}
button_2_released:
name: Button 2 Released
description: Action to run when the button 2 is released after long press.
default: []
selector:
action: {}
button_3_pressed:
name: Button 3 Pressed
description: Action to run when the button 3 is pressed.
default: []
selector:
action: {}
button_3_held:
name: Button 3 Held
description: Action to run when the button 3 is held.
default: []
selector:
action: {}
button_3_released:
name: Button 3 Released
description: Action to run when the button 3 is released after long press.
default: []
selector:
action: {}
button_4_pressed:
name: Button 4 Pressed
description: Action to run when the button 4 is pressed.
default: []
selector:
action: {}
button_4_held:
name: Button 4 Held
description: Action to run when the button 4 is held.
default: []
selector:
action: {}
button_4_released:
name: Button 4 Released
description: Action to run when the button 4 is released after long press.
default: []
selector:
action: {}
button_1_and_3_pressed:
name: Buttons 1 and 3 Pressed
description: Action to run when buttons 1 and 3 are pressed.
default: []
selector:
action: {}
button_1_and_3_held:
name: Buttons 1 and 3 Held
description: Action to run when buttons 1 and 3 are held.
default: []
selector:
action: {}
button_1_and_3_released:
name: Buttons 1 and 3 Released
description: Action to run when buttons 1 and 3 are released after long
press.
default: []
selector:
action: {}
button_2_and_4_pressed:
name: Buttons 2 and 4 Pressed
description: Action to run when buttons 2 and 4 are pressed.
default: []
selector:
action: {}
button_2_and_4_held:
name: Buttons 2 and 4 Held
description: Action to run when buttons 2 and 4 are held.
default: []
selector:
action: {}
button_2_and_4_released:
name: Buttons 2 and 4 Released
description: Action to run when buttons 2 and 4 are released after long
press.
default: []
selector:
action: {}
ptm21xz_ze_two_fingers_actions:
name: PTM215ZE / PTM216Z - Two fingers actions
icon: mdi:gesture-two-tap
collapsed: true
input:
button_1_and_4_pressed:
name: Buttons 1 and 4 Pressed
description: Action to run when buttons 1 and 4 are pressed.
default: []
selector:
action: {}
button_1_and_4_held:
name: Buttons 1 and 4 Held
description: Action to run when buttons 1 and 4 are held.
default: []
selector:
action: {}
button_1_and_4_released:
name: Button 1 and 4 Released
description: Action to run when buttons 1 and 4 are released after long
press.
default: []
selector:
action: {}
button_2_and_3_pressed:
name: Buttons 2 and 3 Pressed
description: Action to run when buttons 2 and 3 are pressed.
default: []
selector:
action: {}
button_2_and_3_held:
name: Buttons 2 and 3 Held
description: Action to run when buttons 2 and 3 are held.
default: []
selector:
action: {}
button_2_and_3_released:
name: Buttons 2 and 3 Released
description: Action to run when buttons 2 and 3 are released after long
press.
default: []
selector:
action: {}
source_url: https://github.com/chris-1243/HA---Blueprint/blob/main/PTM_21xZ_ZE.yaml
mode: single
max_exceeded: silent
trigger_variables:
base_topic: !input base_topic
triggers:
- trigger: mqtt
topic: '{{ base_topic ~ "/+" ~ "/action" }}'
variables:
command: '{{ trigger.payload }}'
controller: !input controller
mqtt_topic: '{{ trigger.topic }}'
conditions:
and:
- '{{ mqtt_topic.split("/")[1] in controller }}'
- '{{ command.split("_", 1)[0] in ("press", "release") }}'
actions:
- variables:
helper_last_controller_event: !input helper_last_controller_event
ptm216z: !input ptm216z_selector
prev_command: '{% if ptm216z %} {{ states(helper_last_controller_event) }} {%
else %} none {% endif %}'
- sequence:
- if: '{{ ptm216z }}'
then:
- action: input_text.set_value
data:
entity_id: '{{ helper_last_controller_event }}'
value: '{{ command }}'
- choose:
- conditions: '{{ "release" in command }}'
sequence:
- choose:
- conditions: '{{ command == "release_1" or prev_command == "press_1" }}'
sequence: !input button_1_released
- conditions: '{{ command == "release_2" or prev_command == "press_2" }}'
sequence: !input button_2_released
- conditions: '{{ command == "release_3" or prev_command == "press_3" }}'
sequence: !input button_3_released
- conditions: '{{ command == "release_4" or prev_command == "press_4" }}'
sequence: !input button_4_released
- conditions: '{{ command == "release_1_and_3" or prev_command == "press_1_and_3"
}}'
sequence: !input button_1_and_3_released
- conditions: '{{ command == "release_2_and_4" or prev_command == "press_2_and_4"
}}'
sequence: !input button_2_and_4_released
- conditions: '{{ command == "release_1_and_4" or prev_command == "press_1_and_4"
}}'
sequence: !input button_1_and_4_released
- conditions: '{{ command == "release_2_and_3" or prev_command == "press_2_and_3"
}}'
sequence: !input button_2_and_3_released
- conditions: '{{ "press" in command }}'
sequence:
- wait_for_trigger:
- trigger: mqtt
topic: '{{ mqtt_topic }}'
payload: release
value_template: '{{ value.split("_", 1)[0] }}'
timeout:
milliseconds: !input hold_delay
- if: '{{ wait.trigger != None }}'
then:
- choose:
- conditions: '{{ command == "press_1" }}'
sequence: !input button_1_pressed
- conditions: '{{ command == "press_2" }}'
sequence: !input button_2_pressed
- conditions: '{{ command == "press_3" }}'
sequence: !input button_3_pressed
- conditions: '{{ command == "press_4" }}'
sequence: !input button_4_pressed
- conditions: '{{ command == "press_1_and_3" }}'
sequence: !input button_1_and_3_pressed
- conditions: '{{ command == "press_2_and_4" }}'
sequence: !input button_2_and_4_pressed
- conditions: '{{ command == "press_1_and_4" }}'
sequence: !input button_1_and_4_pressed
- conditions: '{{ command == "press_2_and_3" }}'
sequence: !input button_2_and_3_pressed
else:
- choose:
- conditions: '{{ command == "press_1" }}'
sequence: !input button_1_held
- conditions: '{{ command == "press_2" }}'
sequence: !input button_2_held
- conditions: '{{ command == "press_3" }}'
sequence: !input button_3_held
- conditions: '{{ command == "press_4" }}'
sequence: !input button_4_held
- conditions: '{{ command == "press_1_and_3" }}'
sequence: !input button_1_and_3_held
- conditions: '{{ command == "press_2_and_4" }}'
sequence: !input button_2_and_4_held
- conditions: '{{ command == "press_1_and_4" }}'
sequence: !input button_1_and_4_held
- conditions: '{{ command == "press_2_and_3" }}'
sequence: !input button_2_and_3_held

View File

@@ -0,0 +1,167 @@
blueprint:
name: MOES Presence Light (Lux + Delay)
description: >
Tænder lys ved registreret occupancy hvis lux er under den valgte grænse.
Slukker igen efter valgt forsinkelse når occupancy er væk.
domain: automation
input:
presence_sensor:
name: Presence sensor
description: MOES ZSS-QY-HP occupancy sensor
selector:
entity:
domain: binary_sensor
device_class: occupancy
illuminance_sensor:
name: Illuminance sensor
selector:
entity:
domain: sensor
lights:
name: Lys
selector:
target:
entity:
domain: light
lux_limit:
name: Maksimum lux
description: Lyset tænder kun under denne værdi.
default: 500
selector:
number:
min: 0
max: 5000
step: 1
unit_of_measurement: lx
mode: box
brightness:
name: Lysstyrke
default: 50
selector:
number:
min: 1
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
transition:
name: Transition
default: 0
selector:
number:
min: 0
max: 30
step: 1
unit_of_measurement: s
mode: slider
off_delay:
name: Vent før sluk
description: Hvor længe occupancy skal være væk før lyset slukker.
default: 30
selector:
number:
min: 0
max: 600
step: 1
unit_of_measurement: s
mode: slider
enable_time:
name: Begræns til tidspunkt?
default: false
selector:
boolean:
start_time:
name: Starttid
default: "00:00:00"
selector:
time:
end_time:
name: Sluttid
default: "23:59:59"
selector:
time:
mode: restart
trigger:
- platform: state
entity_id: !input presence_sensor
to: "on"
id: detected
- platform: state
entity_id: !input presence_sensor
to: "off"
for:
seconds: !input off_delay
id: cleared
variables:
enable_time: !input enable_time
condition: []
action:
- choose:
##############################################################
## Presence detected
##############################################################
- conditions:
- condition: trigger
id: detected
- condition: numeric_state
entity_id: !input illuminance_sensor
below: !input lux_limit
- condition: or
conditions:
- condition: template
value_template: "{{ not enable_time }}"
- condition: time
after: !input start_time
before: !input end_time
sequence:
- service: light.turn_on
target: !input lights
data:
brightness_pct: !input brightness
transition: !input transition
##############################################################
## Presence cleared
##############################################################
- conditions:
- condition: trigger
id: cleared
sequence:
- service: light.turn_off
target: !input lights
data:
transition: !input transition

106
Blueprints/nad.yaml Normal file
View File

@@ -0,0 +1,106 @@
blueprint:
name: NAD M12 - Smart Power Follow
description: >
Tænder NAD-forstærkeren når én eller flere media_players bliver aktive,
og slukker først når alle er slukkede.
domain: automation
input:
media_players:
name: Media Players
description: >
Vælg alle de media_players som skal kunne tænde NAD.
selector:
entity:
domain: media_player
multiple: true
amplifier:
name: NAD M12
selector:
entity:
domain: media_player
power_on_delay:
name: Forsinkelse før tænd
default: 0
selector:
number:
min: 0
max: 60
unit_of_measurement: sek
mode: box
power_off_delay:
name: Forsinkelse før sluk
default: 30
selector:
number:
min: 0
max: 600
unit_of_measurement: sek
mode: box
mode: restart
trigger:
- platform: state
entity_id: !input media_players
variables:
players: !input media_players
action:
- variables:
active_players: >
{{
expand(players)
| rejectattr('state','in',
['off','unknown','unavailable'])
| list
}}
- choose:
###################################################
## Min. én enhed er aktiv -> Tænd NAD
###################################################
- conditions:
- condition: template
value_template: "{{ active_players | count > 0 }}"
sequence:
- delay:
seconds: !input power_on_delay
- service: media_player.turn_on
target:
entity_id: !input amplifier
###################################################
## Alle enheder er OFF -> Sluk NAD
###################################################
default:
- delay:
seconds: !input power_off_delay
- variables:
active_players: >
{{
expand(players)
| rejectattr('state','in',
['off','unknown','unavailable'])
| list
}}
- condition: template
value_template: "{{ active_players | count == 0 }}"
- service: media_player.turn_off
target:
entity_id: !input amplifier

View File

@@ -0,0 +1,171 @@
blueprint:
name: Outdoor Light - Sunset, Night Off, Morning On
description: >
Turns outdoor lights on when it gets dark, turns them off at a configured
night time, optionally turns them back on in the morning if it is still dark,
and finally turns them off again when daylight returns.
domain: automation
input:
light_target:
name: Light(s)
selector:
target:
entity:
domain: light
enable_entity:
name: Enable Entity (optional)
description: >
Automation only runs while this entity is ON.
default:
selector:
entity:
evening_elevation:
name: Evening elevation
description: Turn lights on below this sun elevation.
default: -4
selector:
number:
min: -12
max: 5
step: 0.5
mode: slider
unit_of_measurement: "°"
morning_elevation:
name: Morning elevation
description: Turn lights off above this sun elevation.
default: -4
selector:
number:
min: -12
max: 5
step: 0.5
mode: slider
unit_of_measurement: "°"
night_off_enabled:
name: Enable Night Off
default: true
selector:
boolean:
night_off_time:
name: Night Off Time
default: "23:00:00"
selector:
time:
morning_on_enabled:
name: Enable Morning On
default: true
selector:
boolean:
morning_on_time:
name: Morning On Time
default: "05:30:00"
selector:
time:
mode: single
variables:
enable_entity: !input enable_entity
night_off_enabled: !input night_off_enabled
morning_on_enabled: !input morning_on_enabled
trigger:
- id: evening
platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: !input evening_elevation
- id: morning
platform: numeric_state
entity_id: sun.sun
attribute: elevation
above: !input morning_elevation
- id: night_off
platform: time
at: !input night_off_time
- id: morning_on
platform: time
at: !input morning_on_time
condition:
- condition: template
value_template: >
{% if enable_entity is none %}
true
{% elif enable_entity == '' %}
true
{% else %}
{{ is_state(enable_entity, 'on') }}
{% endif %}
action:
- choose:
#
# Evening
#
- conditions:
- condition: trigger
id: evening
sequence:
- service: light.turn_on
target: !input light_target
#
# Morning
#
- conditions:
- condition: trigger
id: morning
sequence:
- service: light.turn_off
target: !input light_target
#
# Night Off
#
- conditions:
- condition: trigger
id: night_off
- condition: template
value_template: "{{ night_off_enabled }}"
sequence:
- service: light.turn_off
target: !input light_target
#
# Morning On
#
- conditions:
- condition: trigger
id: morning_on
- condition: template
value_template: "{{ morning_on_enabled }}"
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: !input morning_elevation
sequence:
- service: light.turn_on
target: !input light_target