-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmiot-multiplexer.yaml
39 lines (30 loc) · 1.15 KB
/
miot-multiplexer.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
blueprint:
name: 'Tasmota: Smartmi Multiplexer'
description: |
Take the MiOT combined properties_changed payload from MQTT and convert it into a proper JSON array: `{"s<siid>p<piid>":"value",...}`
Requires some rules configured in Tasmota. See your device template page for rules:
- [SmartMi Fan Heater (ZNNFJ07ZM)](https://templates.blakadder.com/smartmi_ZNNFJ07ZM.html)
domain: automation
input:
topic:
name: Tasmota MQTT Topic
description: "Found in Information tab of the webUI."
selector:
text:
mode: parallel
max: 10
max_exceeded: silent
variables:
topic: !input topic
payload: >-
{% set stripped = trigger.payload | replace("PROPERTIES_CHANGED ","") | replace(" R","") | lower %} { {%- for row in stripped.split(" ")|batch(3) -%}"s{{ row[0] }}p{{ row[1] }}":"{{ row[2] }}"{{ "," if not loop.last else "" }}{% endfor %}}
trigger_variables:
topic: !input topic
trigger:
- platform: mqtt
topic: "{{ topic }}/changed_properties"
action:
- service: mqtt.publish
data:
topic: "{{ topic }}/properties"
payload: "{{ payload }}"