How Do You Check Device State

Had a fairly significant snafu recently, and I’m trying to come up with a battle plan.

Background: after a power outage, Vera rebooted and the Internet wasn’t there. This hosed the time clock and, unluckily, all my timers started firing at the wrong time of day (although Vera was acting properly, if that makes sense.) I’ve now installed NTPD on Vera and have a local time server running. I’ll be adding UPS to add further time protection. Many thanks to the folks here for helping with this.

But it got me to thinking, I should have a way to periodically poll my devices to ensure that they’re all in the proper state for that time of day. I understand that there’s a fair bit of this built in, but I want to start thinking about a suspenders and belt kind of approach. If I’m going to rely on Vera while I’m away, I’d like some additional insurance. I haven’t been having much luck with the forum archive or the wiki and I’d really appreciate hearing opinions on the best way to do this.

How do you ensure that your (timer’d) devices are in the proper state for that time of day?
How often to you do this?

A look at the dashboard will show you the states of the devices. The buttons in green show the state. Even with scenes, if the Run button is green, the devices all match the states as set by that scene.

I generally check my system daily, although I have the unit on a UPS along with the network gear so Vera rarely reboots.

[quote=“wscannell, post:2, topic:168774”]A look at the dashboard will show you the states of the devices. The buttons in green show the state. Even with scenes, if the Run button is green, the devices all match the states as set by that scene.

I generally check my system daily, although I have the unit on a UPS along with the network gear so Vera rarely reboots.[/quote]

Thanks, but I’m thinking automation. I’m looking to configure the system so that Vera is able to poll itself periodically, and confirm that everything is as it should be. In my mind, this gets complex really quickly:

For example, I have a scene to turn on the porch lights at dusk, and another to turn them back off at midnight. Theoretically, these lights should not be on the remainder of the day. However, if a user turns the lights on manually (presumably rationally) I don’t want the automation to turn them right back off again. Further, you might have an “all lights on” event for security; you wouldn’t want Vera to overwrite that event either. I’m looking for a method to get Vera back on track on it’s own, without having to wait until the next scene cycle or overwrite other (perfectly reasonable) conditions.

Maybe this isn’t possible, but I’d like to have more confidence that everything is on cycle.

One problem is you’re asking a system to monitor itself after a case where it’s had a fault. Consider the problem if the fault reoccurs and time goes back to midnight of June 2010: it’ll try really hard to make sure your night scenes come on, even though they’re inappropriate for the middle of the day. You’ve just moved the problem to a different scenario, but you still have a problem.

The bigger problem is the difference between “state” and “events”. A time-of-day happening is an event. Event handlers (such as the timed events defined in your scenes) respond to the event and alter state by sending commands to the devices to change their state (i.e. switching lights on or off.) The state is kept in the devices themselves (only the switch knows if it’s on or off). Vera doesn’t keep track of the state they’re supposed to be in, it just monitors the devices and reports what it sees. And it’s good that Vera doesn’t try to keep track of state, because if you have state defined in two places, which one is the source of truth? The one kept in Vera and set by an event handler, or the one in the switch set by the person who turned on the light via the button? Rather than try to create a poor design with duplicate information, Mi Casa Verde wisely chose to let the state remain in the device.

The much simpler approach is to address the real problem, which is that Vera loses track of time, and you’ve already taken good steps there. I recommend you monitor the situation for a while and see if it’s still a problem. You’ll probably find out having a reliable time source is a much easier solution than trying to violate the One Definition Rule.

@Jaded:

This is very helpful, thanks for taking the time to post such a thorough reply.

I’ll take your advice and keep an eye on things for the time being. If I can rely on Vera to “make things right”, that would be fantastic. Almost as if by magic, we had a power outage today and things were as they should be. I just wonder what will happen if the power drops while a scene is active… Here’s hoping.

Thanks again.
Dave