Virtual switch communication

Love the local virtual device feature. One comment, they do not seem to communicate state. So I turn on a light manually, but the switch still says its off. This becomes a problem when you have another light automation that says to the switch, turn on, but the switch doesn’t know what’s up and so nothing happens. I think the virtual switches need to know the state of the devices they are controlling so that i can link apps to the switch, instead of the 10 lights that switch controls. It works fine if I manually toggle the switch on and off and back on but it would be nice if it kept in sync. Awesome work though I migrated everything over last night and am learning the groovy and dashboard stuff which is exciting.

Not all devices are good at reporting their state. For example, there are some models of GE Z-wave switches that don’t report state changes (I have a couple). Hubitat (or any other controller) won’t know that the switch has changed state unless the controller asks. In these cases, the Hubitat solution is to setup a polling rule using Rule Machine that will periodically (every 10 seconds seems to be popular) refresh the switch’s state. Basically, Hubitat will ask the switch if it’s on or off every 10 seconds.

Hubitat also supports truly virtual devices. These are devices that aren’t associated with any piece of hardware. They can be controlled programmatically and used in Hubitat as if they were real devices. For example, I have virtual switches that I can toggle with Amazon Alexa that will cause other lights to turn on or off (the virtual switch sets a scene).

Lots of good information here, including how to schedule Device Refresh() commands periodically (but not too frequently!)

This is true, but it can be done in a round about way. i have several Insteon lights for which there is no Hubitat integration at this time, but both Insteon and Hubitat have Homebridge plugins. So by creating two automations in HomeKit, I can keep lights in sync with the virtual switches in Hubitat.

For example…

HomeKit Automation 1: Hubitat virtual switch turns on > Turn on the Insteon light
HomeKit Automation 2: Insteon light turns on > Turn on Hubitat virtual switch

This allows me to continue to use devices such as Alexa to control Insteon devices outside of Hubitat, and yet Hubitat maintains synchronization with the devices state.