Dimson
(Dmitry)
March 25, 2025, 9:55am
1
Good day to all,
I can’t figure out how to use logbook entries as a trigger condition.
I need to get the time of the last state change for the Object ID (states.device_tracker.phone.state).
description: ""
mode: single
triggers:
- trigger: state
entity_id:
- binary_sensor.h_outside_camera_motion_alarm
to: "on"
conditions:
- condition: template
value_template: "{{ (now() - xxx) < 300 }}"
actions:
Thanks in advance for any ideas.
Can you get what you need out of a logbook entry event?
1 Like
NathanCu
(Nathan Curtis)
March 25, 2025, 11:05am
3
Why does it havvrto come out of the log if you need that data just look at it directly. Why does the logbook need to be involved?
Explain what you’re trying to get done not how you think you want to do it?
2 Likes
Dimson
(Dmitry)
March 25, 2025, 12:11pm
4
I want to perform some action if the binary sensor was triggered and my phone was registered in the wifi network no later than 5 minutes ago.
How about a different condition?
conditions:
- condition: state
entity_id: sensor.your_phone_wifi_connection
state: your_SSID
for:
hours: 0
minutes: 5
seconds: 0
Edit: Sorry, I think I’ve got that the wrong way round. But you see what I mean.
Dimson
(Dmitry)
March 25, 2025, 12:38pm
6
I need time item in yellow block
Dimson
(Dmitry)
March 25, 2025, 12:44pm
7
Thank you, but I use Nmap analog of integration (TPlink deco). Amd I dont have this sensor
My Nmap entities have a “last time reachable” attribute, is that any help?
NathanCu
(Nathan Curtis)
March 25, 2025, 12:59pm
9
That device tracker entity responsible will have a home or not_home state. You can access the last changed state from there.
The logbook is just logging things - go back to what generates the log in this case the entity change. Which last changed time is logged in the state.
You don’t need the logbook you need the source of the event.
state: >
{{ states.[thing].last_changed | as_local | as_timestamp | timestamp_custom('%D %-I:%M %p') }}
1 Like
Dimson
(Dmitry)
March 25, 2025, 1:17pm
10
Thank you!
I forgot abouot it and triying used state.last_updated