Hello guys, i know this is a newbie question but i really can’t understand how to do this. this is the relevant extract of my config:
# Example configuration entry
text_sensor:
- platform: template
id: last_mqtt_message
name: Last mqtt message
mqtt:
broker: broker.host
port: 8883
username: user
password: !secret mqtt_password
discover_ip: false
discovery: false
log_topic: null
topic_prefix: null
birth_message:
topic: ${mqtt_base_topic}/birth
payload: online
will_message:
topic: ${mqtt_base_topic}/will
payload: offline
on_json_message:
topic: ${mqtt_base_topic}/commands
then:
# - lambda: !lambda |-
# serializeJson(x, id("last_mqtt_message")); #don't work
- lambda: !lambda id(last_mqtt_message).publish_state(x); # don't work
how can i simply print all the json string to a text sensor?
Thanks!