Repository navigation
feat: optional last_seen state per device - #3051
Closed
Schimi1983 wants to merge 1 commit into
Closed
Schimi1983 wants to merge 1 commit into
Schimi1983 wants to merge 1 commit into
Conversation
New option "Save the time of the last message per device (last_seen)" (Settings tab, default off). When set, every incoming message writes the timestamp (device.lastSeen from herdsman) to <device>.last_seen (type number, role value.time) - like zigbee2mqtt's advanced.last_seen. The state is lazy: it is only created for devices that send a message while the option is on. Option off (default) = no change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Q82LhA9wBMqm1L1powvy6
Collaborator
|
I see no value in this state. It generates additional traffic for every state that is being set, without generating additional usable info. The functionality is already available checking the As such, i would need further justification to merge this PR. |
Contributor
Author
|
Fair point – the timestamp of Thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New option on the Settings tab: Save the time of the last message per device (last_seen) – default off, so nothing changes for existing installations.
When switched on, every incoming message writes the time of that message (
device.lastSeenfrom herdsman) to<device>.last_seen(typenumber, rolevalue.time, read-only). Same idea as zigbee2mqtt'sadvanced.last_seen. Users can use it in scripts/visualisations to see when a device was last heard of, e.g. to detect a battery device that stopped reporting.lazy: true: it is not created bysyncDevStates, only when a device sends a message while the option is on. Option off → no new states.words.js/ 11i18n/*.jsonA follow-up PR uses
last_seenfor "last seen" in the device manager (currently taken from the timestamp ofmsg_from_zigbee) and makesmsg_from_zigbeeoptional (#3037).Tested on my installation (42 devices):
last_seenstate at alllast_seen(number,value.time), value = time of their last message; no warnings/errors in the logmsg_from_zigbeekeeps updating,last_seenis not written any moreInstall for testing:
https://github.com/Schimi1983/ioBroker.zigbee/tarball/feat/last-seen🤖 Generated with Claude Code
https://claude.ai/code/session_013Q82LhA9wBMqm1L1powvy6