[SOLVED] Nest Binding does not always fire changed event for changed snapshot url

Tags: #<Tag:0x00007f616ea8ee50>

I am using openHAB 2.4.0 (also had the issue in 2.3.0) with a Nest Hello.

Over all, the binding works. But often, the snapshot url changes, the binding has the new url (I can check that in PaperUI’s control page), but it did not fire an event.
The result is that I see no entry in the mysql database (records all changes) and habpanel does not update the image until I reload the browser page.
There is also no change event entry in the events.log.

Anyone knows how to debug and/or fix that?

Edit:
Just made the observation that the binding only fires changed events for the snapshot url when the camera reports a motion event. The timestamps of the motion events and the snapshot url changes are identical.
I do not think that this is the correct behavior. Snapshots and motion events do not have anything to do with each other IMHO.

AFAIK the data shown in Paper UI is based on the state of items. The item state is based on the channel state updates sent by the binding. So if your observations are correct it would more likely be some kind of issue in the framework.

Do you see the right item state when you query the state using the Console?

E.g. for an item named Cam_Streaming you’d use:

openhab> items list Cam_Streaming
Cam_Streaming (Type=SwitchItem, State=ON, Label=Streaming, Category=null)

Another way to check the item state is using the REST API:

https://openhab-hostname/rest/items/Cam_Streaming

Seems like I cannot reproduce the difference between PaperUI and last database entry at the moment.

Right now, my last snapshot URL is one hour old and is the same in database, REST API and PaperUI.

Also, it has the same timestamp like the last motion event. So, it really looks like the snapshot url is only updated when a motion event occurs.

So, my issue is more like “why is the snapshot url not updated regularly?” I would think once per minute or so would be great. Even better if it would be configurable.

All the binding does is providing the latest available snapshot_url value through the streaming Nest API.

You could check if there is an issue in the binding by increasing the log level on the Console so the received JSON data is logged:

log:set debug org.openhab.binding.nest.internal.rest.NestStreamingRestClient

But why do you want to store each URL and why is it important that they are regularly updated?

You can reuse the same snapshot URL for fetching another live image (snapshot) from the camera until its validity expires. Then you’d need another (valid) snapshot URL.

I’d actually be more happy if there were fewer snapshot URL updates. That would result in fewer events and less load. :smile:

Thanks, I understand now my mistake. I was under the assumption that each snapshot url represents a unique timestamp.
I don’t necessarily want to store all urls to the database, but I am a openHAB beginner and so I am recording all state changes in the db for now.
The use case is an image widget in Habpanel where I want to see a new image every 60 seconds.
With the information from you, I turned my attention to Habpanel and discovered that the auto image refresh does not work.
So, it’s a bug there, not in the Nest binding.

Thanks for your help!

Great that it’s clear where the issue is! I’m not a big HABPanel user myself. :wink: I see you created an issue for it: :+1: