App suggestion - virtual switches for state communication with Homekit

Hi there -

I have been trying to work out how to add a virtual switch to my Hue setup - and ended up deep into APIs and CLIs trying to add a CLIPGenericFlag device….and it’s all above my head so i have given up!

However, i have bought your app, and think it would be a great addition to allow adding virtual switches - my use case is:

I have friends of hue switches (actually the reason i bought your app, the homekit and Hue config for these is so limited!) and i want to have the HOLD action on one of them run a homekit shortcut. Homekit only sees the PRESS actions on the switches and i need those for the actual lights, so i can’t just do this directly.

Since your app allows configuring the HOLD actions of the switch, it seems that if i had a virtual switch on the Hue bridge i could have that as the intermediary that both the app and Homekit can “see”. What do you think? Similar things exist for homekit (via homebridge dummy switch plugin) but i need the switch to be on the Hue bridge.

1 Like

Great idea! I made a similar suggestion before. We have a number of CLIPGenericFlag virtual switches used to activate or deactivate rooms (where off doesn’t mean completely off, just motion triggered presence light).

We use the Hue Essentials app with Deconz to control all lights, heating in our home. It works really well for the most part. Would be a shame to have to create a custom page somewhere else to control just these virtual switches.

We have a number of CLIPGenericFlag virtual switches

How did you create your CLIPGenericFlag switches? I’m still interested in this, my suggestion was for an easy way to create them in the app as I don’t know how to via the API. I am able to use the web debug console to log in to my Hue bridge but get stuck with how to proceed :frowning:

Sorry for the delay, I wanted to open source the project I was working on first. I create the virtual switches, and other automations, using a command line tool. Point it at a folder of resources defined as YAML and it will make the API calls required to create/update them.

Note: It’s only been tested on deCONZ so far, so your mileage may vary.

The challenge I now have is how to turn the virtual switches on/off easily from out mobile phones. Have it wired up to physical Aqara switches, but they’re the only thing we can’t easily turn on/off via Hue Essentials. Not sure how to at-mention the maintainer. :joy:

Hey thanks for that! Looking now…

I wonder if you could help a n00b out…

I have installed the package, and can communicate with my bridge. I created a YAML dri and file that I was hoping would give me a virtual switch i can see from Hue/Hue Essentials/HomeKit but I do not see the newly created switch…

Am I misunderstanding what should happen, or more likely I am just not using the tool correctly …?

My only YAML file contains:

resources:
  - kind: sensor
    name: virtual-switch-1
    type: CLIPGenericFlag

I left out the rule part in your example above as it seems like it extends the switch with a rule that I don’t want, I just want a virtual switch to appear which i will then use as a condition from other actions like using Hue Essentials to turn on something IF the switch is on etc.

The challenge I now have is how to turn the virtual switches on/off easily from out mobile phones.

This makes me think i might be misunderstanding - I thought the virtual switches would appear in the Home app, Hue Essentials etc just like other devices…anyway:

I added it seemingly successfully:

deploy from directory hue-deploy-yaml/
Update diff:
{“manufacturername”:“hue-deploy”,“modelid”:“virtual-switch-1”,“name”:“virtual-switch-1”,“recycle”:false,“swversion”:“1.0”,“type”:“CLIPGenericFlag”,“uniqueid”:“hue-deploy::sensor::virtual-switch-1”}
{“manufacturername”:“hue-deploy”,“modelid”:“virtual-switch-1”,“name”:“virtual-switch-1”,“swversion”:“1.0”,“type”:“CLIPGenericFlag”,“uniqueid”:“hue-deploy::sensor::virtual-switch-1”}
Updated /sensors/virtual-switch-1
Done

Wondering if you have time to help out?

Ahh… I downloaded the “all4Hue” app and can see the virtual flag…but I think I have misunderstood and it’s not going to do what I want, which is state tracking accessible from Hue, Home.app, and so on just like a Hue bulb would be, but without using a real device.

Will keep investigating, but suggestions would be gratefully recieved!

@EBee Did you find a way to manage virtual switches from an app in the end?

Sorry for not responding two years ago, I didn’t get any notifications :sweat_smile:. As I’m sure you now know, hue-deploy will create the virtual switch, but hue-essentials doesn’t show them. @Thomas - would still love to see virtual switches in the app. I understand they exist on the original hue bridge and compatible bridges, so it would be a very nice add.

Hi - luckily i did get a notification on this :slight_smile:

I used an actual Hue bulb in a closet as a virtual switch for a while, yes it actually turned on and off but was a hidden way to have a totally HomeKit way to trigger things and track the state of seomthign in an automation and trigger between automations. Then I found HomeSpan. …

This is an Arduino library that lets you create HomeKit devices, limited only by your drive to build your own and it’s amazing! I have made several custom devices for my home.

So it’s not a completely virtual switch because there is hardware, but that hardware is a tiny ESP32 board plugged in to USB somewhere that you can then forget about.

If you have made any Arduino projects you should find it pretty easy, and if not maybe get an arduino board and start some small examples like flashing an LED…but basically example 01 in the HomeSpan library will work unmodified as a virtual switch. Example 01 creates a lightbulb that you can turn on and off form HomeKit but it doesn’t actually do anything in hardware. So you can add this virtual lightbulb and turn it on or off from other automations, use it to trigger automations when somethign else switches it on or off and so on.

Of course, you can modify the example to make it a switch rather than lightbulb, or make it multiple virtual bulbs/switches and so on but if nothing else, an ESP32 board and the unmodified example will give you a single virtual switch … HTH