Created
May 12, 2024 11:35
-
-
Save richardpolzer/d194432e3e367475f8cff4f1658ccba8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: KNX Select | |
description: "# \U0001F3E0 KNX Select Exposure\nConnect a Home Assistant Select or Input Select to a knx decimal value\n | |
The selected Entity will be exposed to the knx bus. Read requests will be processed on the state address and to change the | |
value of the select, you can send a write telegram to the select address. The adresses should use DPT 5.005 and the index | |
of the select will be used to set the value. No further translation will be done." | |
author: richardpolzer | |
domain: automation | |
input: | |
select_entity: | |
name: Select entity | |
description: > | |
Select to publish to KNX | |
selector: | |
entity: | |
filter: | |
domain: | |
- select | |
- input_select | |
select_address: | |
name: Select group address | |
description: > | |
Group address for the select. DPT 5.005 | |
Example: '1/0/1' | |
select_state_address: | |
name: Select state group address | |
description: > | |
Group address for publishing the state to. DPT 5.005 | |
Example: '1/0/1' (leave empty if unused) | |
default: "" | |
mode: parallel | |
max_exceeded: silent | |
variables: | |
select_entity: !input select_entity | |
select_address: !input select_address | |
select_state_address: !input select_state_address | |
trigger: | |
- platform: homeassistant | |
event: start | |
id: "initialize" | |
- platform: event | |
event_type: automation_reloaded | |
id: "initialize" | |
- platform: event | |
event_type: event_knx_reloaded | |
id: "initialize" | |
- platform: event | |
event_type: service_registered | |
event_data: | |
domain: knx | |
service: event_register | |
id: "initialize" | |
- platform: event | |
event_type: knx_event | |
event_data: | |
destination: !input select_address | |
telegramtype: GroupValueWrite | |
direction: Incoming | |
id: "select_address" | |
- platform: event | |
event_type: knx_event | |
event_data: | |
destination: !input select_state_address | |
telegramtype: GroupValueRead | |
direction: Incoming | |
id: "select_state_address" | |
- platform: state | |
entity_id: | |
- !input select_entity | |
id: "state_change" | |
action: | |
- choose: | |
- conditions: | |
- condition: trigger | |
id: "initialize" | |
sequence: | |
- if: | |
- condition: template | |
value_template: "{{ select_address != '' }}" | |
then: | |
- service: knx.event_register | |
data: | |
address: "{{ select_address }}" | |
type: decimal_factor | |
- if: | |
- condition: template | |
value_template: "{{ select_state_address != '' }}" | |
then: | |
- service: knx.event_register | |
data: | |
address: "{{ select_state_address }}" | |
- conditions: | |
- condition: trigger | |
id: "select_address" | |
- condition: template | |
value_template: "{{ select_address != '' }}" | |
sequence: | |
# change the input select here HA | |
- service: "{{select_entity.split('.')[0]}}.select_option" | |
target: | |
entity_id: !input select_entity | |
data: | |
option: "{{ state_attr(select_entity,'options')[trigger.event.data.value | int(default=0)] }}" | |
- conditions: | |
- condition: or | |
conditions: | |
- condition: trigger | |
id: "select_state_address" | |
- condition: trigger | |
id: "state_change" | |
- condition: template | |
value_template: "{{ select_state_address != '' }}" | |
sequence: | |
#report the current value here | |
- service: knx.send | |
data: | |
address: "{{ select_state_address }}" | |
payload: "{{state_attr(select_entity,'options').index(states(select_entity))}}" | |
type: decimal_factor | |
response: "{{trigger.id == 'select_state_address'}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment