Tutorial adding HUE Motion sensor (Lux,Temp and Motion)

I think the solution is to have a sensor for the ‘lastupdated’, then if that changes query the button state.

I do something similar for detecting changes of my external IP (Detect if IP changes?), however currently have hard coded the current IP. Is there a nice way to keep local variables in HASS? I suppose I could create a template sensor and write the current value to it, then over-write when new value is detected.

UPDATE: use Event state_changed