[APP][Pro] Virtual Devices - Virtual Devices to simulate 1 or more real devices

Thank you for this :smiley:

Thanks very much for this information and test, this is very helpful for me :+1:

Definitely not the case, just checked one of my virtual sensors, that definitely has the class “sensor”, not other, a lot can be done during pairing of a device:

Property Value
ID 9a934819-caad-4666-889d-5932f05f3bc0
Class sensor
Driver homey:app:com.arjankranenburg.virtual — virtual_switch

But you can also lower the step by defining the “step” in the capabilitiesOptions (like the min/max).

Here‘s the solution without Homeyscript for the rounding of the temperature values:

2020-12-01 flow updated/optimized:

3 Likes

Let’s start off by saying this app is very helpful!

Still there is a thing I run in to:

I added a virtual sensor, which functions as a power meter. I would like to be able to stop the power consumption from showing up in the total power consumption which is showed in the app.

For instance the HomeWizard Energy app made by Jeroen Tebbens has an option to not show the consumption in the totals. Could this option maybe be added to the VD app?

I have a power measure related question too:

My ventilation is switched by a Shelly relay. Since Shelly can not measure power used by the ventilation (power is drawn from a third powerline), I would like to use a virtual device for hving it shown up in Homey Energy.
(Since the Shelly has power metering capabilities, I cannot “overrule” this by manually entering values for on/off)
If I am correct, this should be possible from VD app v.0.9.0 onwards.

So what I did was:
Create a Virtual Device with (only) power measure capabilities.
Then I made the following flow to write the power value (I read that off my smart meter) to the virtual device when the ventilation was turned on.

Unfortunately, nothing is being written to the VD and the VD is not showing up in Homey Energy too…

What am I doing wrong?

Maybe it also needs the on/off capability?

Tried that, but no luck unfortunately

Set value=measure_power.

chrome_2021-01-01_14-56-20

1 Like

Thx @Rocodamelshekima!
So, had to manually type in “measure_power” in the first field and a numeric value in the second.
(this might clearify it a bit more to other users)

I selected the power tag of the VD there.

1 Like

Hi,

It has been asked before, but unfortunately I couldn’t find an explanation. My apologies if I overlooked the answer.

Could somebody please explain the difference between “turn mode off” and “turn off”?

Hi @Arie_Laxed
could you please make a divice for garage door with option to use signal from a contact to show if the door is open or closed?

Tommy

Has anyone been able to set Capability values on Virtual Devices with homeyscript?

// Get all devices
const devices = await Homey.devices.getDevices();

// Loop over all devices and find the device the data belongs to based on mqttTopic
for (const device of Object.values(devices)) {
  if (device.class === 'sensor' ) {
  //console.log('Found a sensor ' + device.name );

if (device.name.includes(mqttTopic) ) {
    console.log(`Found device match '${device.name}', updating data.`);
    // update measurements
    await device.setCapabilityValue('measure_temperature', sensorData.t)
        .then(() => log('OK')) .catch(error => log(`Error:`, error));
    await device.setCapabilityValue('measure_humidity', sensorData.rh)
        .then(() => log('OK')) .catch(error => log(`Error:`, error));
    await device.setCapabilityValue('measure_pressure', sensorData.ap)
        .then(() => log('OK')) .catch(error => log(`Error:`, error));
    await device.setCapabilityValue('measure_battery', sensorData.bu)
        .then(() => log('OK')) .catch(error => log(`Error:`, error));
}

Those however result in an error with “not_setable”.

That aligns with the documentation:

They are only setable from within the app itself (in other words, through the SDK, not through the Web API which Homeyscript uses).

Perhaps the Virtual Devices app offers an API to set capability values.

That is actually a shame.

Could somebody please explain the difference between “turn mode off” and “turn off”?

I can try:
‘Turn mode on/off’ is defined in the VD app.
‘Turn on/off’ is defined by Athom and is available because the capability is ‘onoff’.

I vaguely remember that Athom at first did not provide this default flow-card, probably because the class is ‘other’. Otherwise I wouldn’t have created specific flow-cards. I advise to use the default (‘Turn on/off’).

There is a bug report on 1 of those cards, but as soon as I’ve checked that ‘Turn on/off’ is working correctly, I will deprecate the other.

BTW: There are similar duplications in the trigger- and condition-flowcards.

I have a problem setting up virtual sensor values. I know the issue has been raised in the forum but I don’t see clear answers to the problem. ¿Could someone help me?

Use case: I want to get alerted when I receive new letters, just having 2 sensors controlling when a letter is coming and when I take the letters off the mail box (a combination of the 2). Then I want to create a virtual sensor raising an alert (triggered through a flow) when I get letters and switching it off automatically when I take the letters off the box.

When I create a sensor and I use it in a flow, I see the possibility to select “Set a virtual sensor value” with 2 fields, Sensor (-> I select the sensor tag) and the value (I have tried unsuccessfully setting up Yes/Si/On/1 but the sensor state doesn’t change).

All clear, thanks a lot!

If I understand you right, you want to use the Virtual-Device, to display if there is a new letter in your letter-box. In this case it’s better you don’t use a virtual-sensor but a virtual-device that has two states (on/off) like a lamp. You can switch it on when the “letter-in” is detected and switch it off when “letter-out” is detected.

Thank you for your reply.

The challenge I see if I use it as a virtual device is that I can manually change the state of the device, something I would like to avoid if possible (due to the design of Homey APP it seems to me that it is very easy to switch on/off a device unintentionally).

Is it possible to set it up the virtual device in a way where the state cannot be changed manually? (So far I am using a flow that changes back the state of the device if pushed but I would prefer to avoid workarounds and creating additional complexity in the system unless strictly necessary).