Feedback from Alexa to Hubitat

I am trying to control my Alexa enabled switches from Hubitat. it is "almost" working, but I have one issue/question.

What is working:

  • I created a virtual contact sensor in Hubitat, and exposed it to Alexa
  • In Alexa, I created two routines - 1) If virtual contact is open, turn on the alexa plug. 2) If virtual contact is closed, turn off alexa plug
  • The above is allowing my Hubitat to open or close the lights connected to my plug

Question:

  1. If somebody closes the alexa switch from Alexa(and not via Hubitat), then the virtual switch in Hubitat naturally gets out of sync. Is there a way where when Alexa changes turns the switch on or off, it also updates the virtual switch back in Hubitat?
  2. Instead of me having to create 4 routines (if contact is open then turn on plug, if contact is closed turn off plug, if plug is turned on update contact status, if plug is turned off update contact status), is there some way to make more efficient routine? If I have 5-6 alexa plugs, I want to avoid 20-30 routines just so they can be controlled with Hubitat.

The way I have dealt with this in the past is to rename the Alexa switch to "Real " and rename the virtual switch to "" so the real switch is only control via Hubitat.

On the question on making it more efficient I use EchoSpeaks voiceCmdAsText to do things. This means you can clone the rule and just swap out the switch name.
--update
or simpler

If your current Alexa enabled switches can be controlled directly by Hubitat, I would recommend that you set them up that way. Alexa can still control the devices through the Alexa Skill.

If you have some devices that cannot be controlled by Hubitat, you can go the virtual device route, but it can get pretty complicated. I tried to do that with two Hunter SimpleConnect fans and lights that use WiFi. They can be controlled by Alexa, but not directly by Hubitat. I tried to set up the virtual devices, but finally gave up; it was not worth the effort.