How to detect if http connection fails

If the http connection fails when device is offline, how can I create a rule to detect this situation?

I know of no direct way to detect this. You can add some code to see if the data you are querying for is expected to change frequently you can set a timer and if the value doesn’t actually change after a certain period of time generate an alert or the like.