Bob_NL
(Bob Visser)
November 12, 2017, 3:01pm
1
Hi there,
I’m having trouble extracting a certain attribute from a sensor.
I can see the attribute “No motion since” in teh dev-tool:
.
I want to use this value (300 in the example) but can’t find the proper syntax.
{{ states.binary_sensor.motion_sensor_158d00016db13b.attributes.no_motion_since }}
does nothing.
I also tried {{ states.binary_sensor.motion_sensor_158d00016db13b.attributes.last_motion }}
and {{ states.binary_sensor.motion_sensor_158d00016db13b.attributes.last_trigerred }}
without any luck. There are also no errors in the dev-tool.
Can anyone help me out?
1 Like
ashwin
(Ashwin Van Dijk)
November 12, 2017, 3:22pm
2
Have you tried {{ states.binary_sensor.motion_sensor_158d00016db13b.attributes.No_motion_since }}, with an uppercase N for “No_motion_since”?
Bob_NL
(Bob Visser)
November 12, 2017, 3:26pm
3
Yes I did, same result (which is none)
arsaboo
(Arsaboo)
November 12, 2017, 3:26pm
4
Bob_NL:
no_motion_since
Use {{states.binary_sensor.motion_sensor_158d00016db13b.attributes['No motion since']}}
Bob_NL
(Bob Visser)
November 12, 2017, 3:27pm
5
@arsaboo that works, thanks for the prompt reply!
Stewface
(Stewart)
July 15, 2018, 1:35am
6
What does no motion since “300” mean? My one says that but I can interpret
Bob_NL
(Bob Visser)
July 15, 2018, 7:58am
7
300 seconds (so 5 minutes).
Stewface
(Stewart)
July 15, 2018, 9:47pm
8
Thanks @Bob_NL
Does it max out at 300 seconds?
Is there anyway to do last motion 6:45pm Wednesday for example? That would be really nice to see!
hentes
March 27, 2019, 6:44am
9
If you want to display the last motion event date and time you could use this is your configuration.yaml:
platform: template
sensors:
last_motion:
friendly_name: “Last motion date-time”
value_template: >-
{{(as_timestamp(now()) - states.binary_sensor.motion_sensor_xxxxxxxxxxx.attributes[‘No motion since’] | int) | timestamp_custom(’%Y-%m-%d %H:%M’)}}
This will take the current timestamp then substract the “No motion since” value from it and format the result to “2019-03-27 16:48” date&time format.