Hi,
I like to set up my system so that there is some kind of “subsystem”, that manages the complete control for 8 window blinds/covers. It controls the switches, calculates positions and so on.
This subsystem shall communicate to my HA instance.
It will report the position of all 8 covers in one single MQTT message as a string where the individual positions are separated by a separator character (’;’ for example).
This means the position message sent by the subsystem to my HA instance will look like this:
home/windows/covers/positions/[12;87;100;69;0;47;78;55]
Now my python skills are less than limited. I think I can extract the position for the individual covers by a template. But I just don’t know how.
This is my current config for 2 of the 8 covers:
- platform: mqtt
name: "first"
command_topic: "first/window/cover/position/set/"
position_topic: "home/windows/covers/positions/"
set_position_topic: "first/window/cover/position/set/"
payload_open: "100"
payload_close: "0"
payload_stop: "-1"
state_open: "100"
state_closed: "0"
position_template: |-
{ here is where I don't know how to extract the FIRST position (12) from the payload }
- platform: mqtt
name: "second"
command_topic: "second/window/cover/position/set/"
position_topic: "home/windows/covers/positions/"
set_position_topic: "second/window/cover/position/set/"
payload_open: "100"
payload_close: "0"
payload_stop: "-1"
state_open: "100"
state_closed: "0"
position_template: |-
{ here is where I don't know how to extract the SECOND position (87) from the payload }
Might be just a single python line - but currently still beyond my knowledge…
Thanks and greetings!