Home Assistant Git Exporter
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
blueprint:
|
||||
name: HASPone activates a selected page after a specified period of inactivity
|
||||
description: '
|
||||
|
||||
## Blueprint Version: `1.05.00`
|
||||
|
||||
|
||||
# Description
|
||||
|
||||
|
||||
Activates a selected page after a specified period of inactivity.
|
||||
|
||||
|
||||
## HASPone Page and Button Reference
|
||||
|
||||
|
||||
The images below show each available HASPone 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>
|
||||
|
||||
'
|
||||
domain: automation
|
||||
input:
|
||||
haspdevice:
|
||||
name: HASPone Device
|
||||
description: Select the HASPone device
|
||||
selector:
|
||||
device:
|
||||
integration: mqtt
|
||||
manufacturer: HASwitchPlate
|
||||
model: HASPone v1.0.0
|
||||
multiple: false
|
||||
targetpage:
|
||||
name: Page to activate
|
||||
description: Select a destination page for this button to activate.
|
||||
default: 1
|
||||
selector:
|
||||
number:
|
||||
min: 1.0
|
||||
max: 11.0
|
||||
mode: slider
|
||||
unit_of_measurement: page
|
||||
step: 1.0
|
||||
idletime:
|
||||
name: Idle Time
|
||||
description: Idle time in seconds
|
||||
default: 30
|
||||
selector:
|
||||
number:
|
||||
min: 5.0
|
||||
max: 900.0
|
||||
step: 5.0
|
||||
mode: slider
|
||||
unit_of_measurement: seconds
|
||||
source_url: https://github.com/HASwitchPlate/HASPone/blob/main/Home_Assistant/blueprints/hasp_Activate_Page_on_Idle.yaml
|
||||
mode: restart
|
||||
max_exceeded: silent
|
||||
variables:
|
||||
haspdevice: !input haspdevice
|
||||
haspname: "{%- for entity in device_entities(haspdevice) -%}\n {%- if entity|regex_search(\"^sensor\\..+_sensor(?:_\\d+|)$\")
|
||||
-%}\n {{- entity|regex_replace(find=\"^sensor\\.\", replace=\"\", ignorecase=true)|regex_replace(find=\"_sensor(?:_\\d+|)$\",
|
||||
replace=\"\", ignorecase=true) -}}\n {%- endif -%}\n{%- endfor -%}"
|
||||
targetpage: !input targetpage
|
||||
idletime: !input idletime
|
||||
pagecommandtopic: '{{ "hasp/" ~ haspname ~ "/command/page" }}'
|
||||
activepage: "{%- set activepage = namespace() -%} {%- for entity in device_entities(haspdevice)
|
||||
-%}\n {%- if entity|regex_search(\"^number\\..*_active_page(?:_\\d+|)$\") -%}\n
|
||||
\ {%- set activepage.entity=entity -%}\n {%- endif -%}\n{%- endfor -%} {{ states(activepage.entity)
|
||||
| int(default=-1) }}"
|
||||
trigger_variables:
|
||||
haspdevice: !input haspdevice
|
||||
haspname: "{%- for entity in device_entities(haspdevice) -%}\n {%- if entity|regex_search(\"^sensor\\..+_sensor(?:_\\d+|)$\")
|
||||
-%}\n {{- entity|regex_replace(find=\"^sensor\\.\", replace=\"\", ignorecase=true)|regex_replace(find=\"_sensor(?:_\\d+|)$\",
|
||||
replace=\"\", ignorecase=true) -}}\n {%- endif -%}\n{%- endfor -%}"
|
||||
haspsensor: "{%- for entity in device_entities(haspdevice) -%}\n {%- if entity|regex_search(\"^sensor\\..+_sensor(?:_\\d+|)$\")
|
||||
-%}\n {{ entity }}\n {%- endif -%}\n{%- 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: "{{-\n (trigger.payload_json.event is defined)\nand\n (trigger.payload_json.event
|
||||
== 'page')\nand\n (trigger.payload_json.value is defined)\nand\n (trigger.payload_json.value
|
||||
!= targetpage)\n-}}"
|
||||
action:
|
||||
- delay:
|
||||
seconds: '{{idletime|int}}'
|
||||
- condition: template
|
||||
value_template: "{%- set currentpage = namespace() -%} {%- for entity in device_entities(haspdevice)
|
||||
-%}\n {%- if entity|regex_search(\"^number\\..*_active_page(?:_\\d+|)$\") -%}\n
|
||||
\ {%- set currentpage.entity=entity -%}\n {%- endif -%}\n{%- endfor -%} {%-
|
||||
if states(currentpage.entity) == targetpage -%}\n {{false}}\n{%- else -%}\n {{true}}\n{%-
|
||||
endif -%}"
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: '{{pagecommandtopic}}'
|
||||
payload: '{{targetpage}}'
|
||||
retain: true
|
||||
Reference in New Issue
Block a user