mirror of
https://github.com/HASwitchPlate/HASPone.git
synced 2025-07-31 07:06:39 +00:00
Add Activate Page on Idle
This commit is contained in:
parent
4c822f1352
commit
9e1e6236f0
114
Home_Assistant/blueprints/hasp_Activate_Page_on_Idle.yaml
Normal file
114
Home_Assistant/blueprints/hasp_Activate_Page_on_Idle.yaml
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
blueprint:
|
||||||
|
name: "HASP p[x].b[y] activates a selected page after a specified period of inactivity"
|
||||||
|
description: |
|
||||||
|
|
||||||
|
# Description
|
||||||
|
|
||||||
|
Activates a selected page after a specified period of inactivity.
|
||||||
|
|
||||||
|
## HASP Page and Button Reference
|
||||||
|
|
||||||
|
The images below show each available HASP page along with the layout of available button objects.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| Page 0 | Pages 1-3 | Pages 4-5 |
|
||||||
|
|--------|-----------|-----------|
|
||||||
|
|  |  |  |
|
||||||
|
|
||||||
|
| Page 6 | Page 7 | Page 8 |
|
||||||
|
|--------|--------|--------|
|
||||||
|
|  |  |  |
|
||||||
|
|
||||||
|
| Page 9 | Page 10 | Page 11 |
|
||||||
|
|--------|---------|---------|
|
||||||
|
|  |  | 
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
source_url: "https://github.com/HASwitchPlate/Blueprints/blob/main/hasp_Activate_Page_on_Idle.yaml"
|
||||||
|
domain: automation
|
||||||
|
input:
|
||||||
|
haspdevice:
|
||||||
|
name: "HASP Device"
|
||||||
|
description: "Select the HASP device"
|
||||||
|
selector:
|
||||||
|
device:
|
||||||
|
integration: mqtt
|
||||||
|
manufacturer: "HASwitchPlate"
|
||||||
|
model: "HASPone v1.0.0"
|
||||||
|
targetpage:
|
||||||
|
name: "Page to activate"
|
||||||
|
description: "Select a destination page for this button to activate."
|
||||||
|
default: 1
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 1
|
||||||
|
max: 11
|
||||||
|
mode: slider
|
||||||
|
unit_of_measurement: page
|
||||||
|
idletime:
|
||||||
|
name: "Idle Time"
|
||||||
|
description: "Idle time in seconds"
|
||||||
|
default: 30
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 5
|
||||||
|
max: 900
|
||||||
|
step: 5
|
||||||
|
mode: slider
|
||||||
|
unit_of_measurement: seconds
|
||||||
|
|
||||||
|
mode: restart
|
||||||
|
max_exceeded: silent
|
||||||
|
|
||||||
|
variables:
|
||||||
|
haspdevice: !input haspdevice
|
||||||
|
haspname: >-
|
||||||
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
|
{%- if entity|regex_search("^sensor\.") -%}
|
||||||
|
{{- entity|regex_replace(find="^sensor\.", replace="", ignorecase=true)|regex_replace(find="_sensor(?:_\d+|)$", replace="", ignorecase=true) -}}
|
||||||
|
{{ break }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
targetpage: !input targetpage
|
||||||
|
idletime: !input idletime
|
||||||
|
pagecommandtopic: '{{ "hasp/" ~ haspname ~ "/command/page" }}'
|
||||||
|
|
||||||
|
trigger_variables:
|
||||||
|
haspdevice: !input haspdevice
|
||||||
|
haspname: >-
|
||||||
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
|
{%- if entity|regex_search("^sensor\.") -%}
|
||||||
|
{{- entity|regex_replace(find="^sensor\.", replace="", ignorecase=true)|regex_replace(find="_sensor(?:_\d+|)$", replace="", ignorecase=true) -}}
|
||||||
|
{{ break }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
haspsensor: >-
|
||||||
|
{%- for entity in device_entities(haspdevice) -%}
|
||||||
|
{%- if entity|regex_search("^sensor\..+_sensor(?:_\d+|)$") -%}
|
||||||
|
{{ entity }}
|
||||||
|
{{ break }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
jsontopic: '{{ "hasp/" ~ haspname ~ "/state/json" }}'
|
||||||
|
targetpage: !input targetpage
|
||||||
|
pagejsonpayload: '{"event":"page","value":{{targetpage}}}'
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
- platform: mqtt
|
||||||
|
topic: "{{jsontopic}}"
|
||||||
|
|
||||||
|
condition:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ is_state(haspsensor, 'ON') }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ not( (trigger.payload_json.event is defined) and (trigger.payload_json.event == 'page') and (trigger.payload_json.value is defined) and (trigger.payload_json.value == targetpage) ) }}"
|
||||||
|
|
||||||
|
action:
|
||||||
|
- delay:
|
||||||
|
seconds: "{{idletime|int}}"
|
||||||
|
- service: mqtt.publish
|
||||||
|
data:
|
||||||
|
topic: "{{pagecommandtopic}}"
|
||||||
|
payload: "{{targetpage}}"
|
Loading…
x
Reference in New Issue
Block a user