I have a battery-powered thermostat in a deep freeze that I want to check for being offline on a daily basis. I know that I get an alert when it goes offline the first time, but unfortunately, I’ve learned that depending on what’s going on, that can get forgotten.
My best guess to achieve this is to have Luup routine that runs daily and checks the device’s status. What variable do I check? I see “PollOK” and “CommFailure”, but I have no idea what values are stored there. Any help would be appreciated.
To perform a daily check on your battery-powered thermostat’s status, you can use a Lua script in a scene. The key variable to monitor is:
CommFailure: Indicates communication failure.
0: Device is online.
1: Device is offline.
Here’s a Lua script you can include in your daily scene to check the status and send a notification if the thermostat is offline:
local device_id = [Your_Device_ID_Here]
local user_id = [Your_User_ID_Here]
local comm_failure = luup.variable_get("urn:micasaverde-com:serviceId:HaDevice1", "CommFailure", device_id)
if comm_failure == "1" then
local description = "Thermostat is offline. Please check the device."
local url = string.format("http://127.0.0.1:3480/data_request?id=add_alert&device=%d&type=3&source=3&description=%s&users=%s", device_id, luup.url_encode(description), user_id)
luup.inet.wget(url)
end
What to do:
Replace [Your_Device_ID_Here] with your thermostat’s device ID.
Replace [Your_User_ID_Here] with your Vera user ID.
Add this script to a scene set to run daily.
This script checks if CommFailure equals 1 (device offline). If it is, it sends a notification to your Vera account using the add_alert API.
I finally have some time to do this. Where do I get the “User ID” from? Is that an email address or a numerical value? I can’t see a User ID in any of the settings.
I was getting an error that luup.url_encode(description) was returning nil, so I simplified this to return true or false and then had the scene notify me (which it only does if the luup code returns true). Works fine.
We’re really glad to hear that it worked for you! If possible, could you share the full solution here? It would be incredibly helpful for other users who might encounter the same requeriment in the future.
Your contribution could make a big difference for the community.
Thank you, and let us know if there’s anything else we can assist you with!
Best Home Automation shopping experience. Shop at Ezlo!