Fibaro HC2 Virtual Devices

Hi,
I´m a beginner with home remote and try to design my first dashboard. I use the Fibaro HC2 with some virtual devices. As I can see, they don´t get importet by default. I can see all my scenes and devices but not the virtual devices. Is there any solution for this or is it simply not supported at the moment?

thanks for your help and best regards

daniel

If you are using the Designer, you can manually add them. They are supported however the software will only generate devices for ones it has prebuilt templates for. To add a virtual device, just copy an existing device & update its Id, Capabilities, & Attributes. You’ll probably have to clear the Capabilities field for the device. Add any Attributes you’d like to control & monitor. The Home Remote’s Attributes are Fibaro Properties. Look at the JSON for your virtual device & see which Properties are available. Their API is pretty straight forward. The URL below will get the JSON for a device with Id 1771.

http://192.168.77.80/api/devices/1771

thanks for your fast response, so here is an example device: https://pastebin.com/VRGzU9jd

would be the attribute “ui.dimm.value”? The V Device is 2 simple sliders I want to control

Thanks for your help in advance!

okay if i launch the simulation with a slider now, the slider moves to the value but if I change the slider nothing changes back in my home center. strange

Yes, in this case the Attribute would be ‘ui.dimm.value’. Changing the value may not be possible though. The way custom “Attributes” work with the Fibaro integration is when you try to write to the value it’ll call an action “set” + Attribute Name (capitalizing the 1st letter of attribute). So in this case, when you change the slider in HR, it’s calling “setUi.color.value(VALUE)”. Looking at the “actions” JSON for this device you’ll see it should probably call setSlider instead.

How much freedom does Fibaro give you when it comes to creating a virtual device? For this to work best, your actions & property names should match. Can you rename the Fibaro property “ui.dimm.value” to say, “dimmer1”? Then can you create an “action” for this device named “setDimmer1”? Then create a separate action for your 2nd dimmer. Don’t use the same action to set both of them. For your 2nd slider “ui.color.value” rename to color. Then add an action called “setColor”. Again, I don’t know if this is possible. I’m not an expert on how Fibaro virtual devices work & what you’re allowed to change.

When using virtual devices, the integration has no way of telling exactly which action it needs to call to change a property. That’s why it’s generalizing it & simply calling a “setAttribute” action. The way most real Fibaro devices work is that they have a “value” property & to change the value of this we need to call “setValue”. If there’s anyway to setup these virtual devices to follow a similar set of rules everything should work pretty well. The way your virtual device is currently configured, you are probably going to need to write a Plugin to send the command. If possible, I recommend renaming your virtual device properties & actions.

I think the API Call would be:
http://192.168.100.103/api/callAction?deviceID=17&name=setSlider&arg1=2&arg2=10
arg1= slider ID (first in ui for example)
arg2= value

so without those arguments it will not work I think. for the naming I can only change “dimm1” and the json property would be ui.dimm1.value.
Is there a way to create virtual device with url masks or something? I am willing to use the UI for my customers and I would like to support you with testing and input.

Correct. That is the API call it should call but the Designer is not smart enough to figure that out. There’s no association to that action from the property.

Can you create a virtual device that’s modeled from a real device?

A few other home automation platforms let you do this. That way a virtual dimmer can be controlled just like a real dimmer from the API.

No, there is No way to Set it as a special device. It’s always universal and you can only create buttons and sliders (with script inside). The API structure stays the same

After looking a little closer at the JSON you shared, it does look like it should be possible to improve this & have the apps search the rows->elements to find the control “type” & “id” associated with the property. That way it can determine exactly which action it should use.

Just so I understand correctly, all virtual devices will have a set of actions that look exactly like yours? They’ll all have 1 pressButton action & 1 setSlider action?

"actions": { "pressButton": 1, "setSlider": 2 }

Can you share the JSON for a virtual device that uses a button?

I think it´s more like a generic info for which actions are available via api and maybe the number of arguments needed?
https://pastebin.com/4eTh9CBN
this is a 3 button v-device.
Anmerkung 2020-07-01 082332 Anmerkung 2020-07-01 082400
The first is the view in the editor or detailed. the second is the view in the overview. you can only select one button and one slider or label to display in the overview. but I don´t think that matters

I think you only need to parse the ID of the fild and the “type”. If type is button, then you only need the ID to trigger. if type is slider then you need arg1 for adressing and arg2 for the value. It would help a lot if the virtual devices could be imported this way so you get the button as a trigger and the slider as a trigger.

Yeah, I got it. I worked on this yesterday. It’ll be in the next release. Both your sliders & buttons should send the correct command in the 3.4.0 release. Hoping to start publishing that later today. Just finishing up a few other things.

wow, sounds great. If you need any input or help with HC2 development, feel free to contact me! best regards

The 3.4.0 update has been published. Attached is an example for controlling both virtual sliders & virtual buttons using the data you’ve provided.

Fibaro_VirtualDevice.hrp (83.1 KB)

nice, I will try this later at home and report you back. thank you!

works great so far. this helps a lot to work with HC2 System from Fibaro, thanks again!

1 Like