Hello HA Community,
I’m trying to make an automation that will take an input_select
value that is a single sensor selected from a group and set the state of that sensor when a button is pressed. I have an idea on how to get all of that to work except for the fact that the input_select
is built of Friendly Names and the value I need in the automation to publish the MQTT message needs to be the state_topic
. For example:
This is one of my sensors, notice that the Friendly Name is different than the state_topic:
- name: 'Sensor near Kitchen Sink'
state_topic: '433/Kitchen_Sink_Moisture'
device_class: moisture
When I use the Developer Tools–>Template feature of Home Assistant it looks like this.
INPUT: {{ states.binary_sensor.sensor_near_kitchen_sink.attributes }}
OUTPUT: {'device_class': 'moisture', 'friendly_name': 'Sensor near Kitchen Sink'}
The attribute list doesn’t contain the state_topic
. How do I go about getting a handle on the state_topic
value given the sensor name in Jinja2??