Help modifying an app code

I am not sure this is what you will want to do... depending on what the rest of the app does to handle innacitvity (I'll admit I haven't read all the code). If power or connectivity to a device is lost, the Current States or Attributes will not normally be updated to reflect this, they are often only updated when the device reports back to HE, i.e. when connectivity is available, so during periods where connectivity is lost, the current state will remain as the last state that was reported.

I could be misinterpretting the code or your intentions here...

I suspect what you may be after is an app like @bertabcd1234 's Device Activity Check:

1 Like