homeassistant: Automatically add shellies to mqtt
This commit is contained in:
parent
ec1b8cb9e6
commit
e2fdee682d
2 changed files with 23 additions and 0 deletions
13
roles/homeassistant/templates/mqtt.yaml.j2
Normal file
13
roles/homeassistant/templates/mqtt.yaml.j2
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
sensor:
|
||||
{% for shelly in shellies | selectattr("name", "match", "^shellyplug-s-") | list %}
|
||||
- name: Power Usage
|
||||
state_topic: home/{{ shelly["room"] }}/{{ shelly["device"] }}/relay/0/power
|
||||
unique_id: {{ shelly["name"] }}
|
||||
unit_of_measurement: W
|
||||
device:
|
||||
name: {{ shelly["device"] | capitalize }}
|
||||
suggested_area: {{ shelly["room"] | replace("_", " ") | capitalize }}
|
||||
identifiers:
|
||||
- {{ shelly["name"] }}
|
||||
{% endfor %}
|
Loading…
Add table
Add a link
Reference in a new issue