ThaNerd
(Turbo Tronix)
1
I have a sensor that outputs 3 numbers split with a “,”
sensor.coordination_168d0003a4cb54
state sample: 93,92,-682
I want to create an automation based on the number at the 3rd place (in this example -682).
Is there a way to retrieve only that number from the state?
finity
2
So the state of the sensor is “sample: 93,92,-682”?
if so then you can create a template sensor and use the split method to get what you want:
{{ state(‘sensor.coordination_168d0003a4cb54).split(’,’)[2] }}
EDIT:
It’s been kindly pointed out that I forgot an ‘s’:
{{ states('sensor.coordination_168d0003a4cb54).split(',')[2] }}