I need some help on an automation. My blinds wake up every 30 minutes and send an MQTT message with two parameters: state and flux_value. I have an automation that looks for the topic and sends me a message to my phone. Everything works fine, however I would like to format the message I receive.
This is my automation:
#BLINDS MESSAGE
- alias: message from blinds
initial_state: true
trigger:
- platform: mqtt
topic: house/ha/+
action:
- service: notify.ios_iphonex
data_template:
title: "Blind"
message: >-
{% set blind_var = trigger.topic|replace('house/ha/', '') %}
{% set blind_val = trigger.payload %}
{{ blind_var }} value {{blind_val}}
The message that I am receiving looks like this:
blind3 value{"state":"closed","flux_value":"368"}
Is there a way I can parse or just get one of the values? I would like the message to be:
blind3 is closed.
Thanks in advance for your help.