# \[Howto\] set a value to a virtual device

**URL:** <https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883>\
**Category:** Tutorials\
**Tags:** virtual-device\
**Created:** [April 7, 2021, 4:09pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883 "2021-04-07T16:09:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rocodamelshekima](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocodamelshekima/32/8209_2.png) [@Rocodamelshekima](https://community.homey.app/u/Rocodamelshekima)\
**Post date:** [April 7, 2021, 4:09pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/1 "2021-04-07T16:09:20Z")

</div>

**How to set a value to a virtual device.**

There is a lot of questions about the virtual sensors and a lot of peeps don’t get it to work so here’s a little tutorial on how to set a value on a virtual sensor.

**Add the device.**

When making the virtual device be sure to pick the correct capabilities. In this example i took a virtual thermostat and used the "[Virtual devices" app](https://homey.app/nl-nl/app/com.arjankranenburg.virtual/Virtuele-Apparaten/) from Arjan.

So we add a new device, pick “Virtual devices” and then click “Device”. Hit “connect” in the next screen. In the next screen u give the new device a name of ur choise and hit next.

In the next screen u can pick an icon or upload ur own. I picked one from the list.  
Then we hit “Thermostat” because that’s the device i choose to make in this example.

In the next screen u can select the capabilities u need. I chose “Target Temperature” and “Measure temperature”. This is important for every other device so make the correct choises! Then we hit next and the device is added.

 ![chrome_2021-04-07_18-05-24](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/4/942224e5034f6c7f87947dec9c0ea3c9b5cfc6db.png)

Then we go set a value for the Virtual thermostat we just created. In this example i wanna show the temperature of the bed from my 3D printer.

**Make the flow.**

We make a flow. The trigger part and the AND part is free to pick, the THEN part is important in this case so am gonna show u just the AND part.

For the AND part we pick the Virtual Devices app and pick the Virtual thermostat u just created, then hit “Set a virtual sensor value”.

**And here is the most important part where it goes wrong every time…**

In the first field (sensor) we wright down “measure\_temperature”. We don’t use tags here or anything other then the capabilitie we need. And we need to type them!  
All capabilities are found [here](https://apps-sdk-v3.developer.homey.app/tutorial-device-capabilities.html).

In this example i wanna show the temperature so i picked “measure\_temperature”. When u wanna show other things like power or gas or something else then look at the link and pick the correct capability.

**Do not fill in anything else then a capability here!!**

 ![chrome_2021-04-07_17-51-51](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/6/96dc4d1f0da9a1e0977bdcd09e1ac05026aca583.png)

In the next field u can pick a tag from a device which u wanna show the temperature of. In this case my 3D printer. Hit the little tag on the right side of that field and search for the tag u need.

 ![chrome_2021-04-07_17-52-32](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/5/5582277af7114942f4905965cce175f3cbc5f306.png)

Ur AND part of ur flow should look like this now:

 ![chrome_2021-04-07_17-52-47](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/7/b7aa53c60681abb0c9f4c31814ecf6afe6e96e33.png)

When u run ur flow the temp will be shown on ur virtual device now.  
U can add the device to ur favorites and show them on [Homeydash.com](http://Homeydash.com) for example.

A [tutorial in Dutch](https://community.homey.app/t/hoe-dan-zet-de-waarde-van-een-virtuele-sensor/46108).

**Disclaimer.**  
Please don’t react with “better pick the virtual devices native in Homey” or something like that, this tutorial is just to help peeps getting their virtual devices up and running.

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [April 8, 2021, 3:42pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/2 "2021-04-08T15:42:54Z")

</div>

Love this!

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/3/f3020fff082a1ee70eeda6da214dd56663e1bc76.jpeg)

---

<div class="post-metadata">

**Author:** ![Daniel\_Weber](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/daniel_weber/32/16401_2.png) [@Daniel\_Weber](https://community.homey.app/u/Daniel_Weber)\
**Post date:** [April 9, 2021, 7:04am UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/3 "2021-04-09T07:04:25Z")

</div>

Hi,

thx for the tutorial.

Any idea what is wrong here?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/9/19b7efcfbc6c9d0df09a00cfbd5556581bf026eb.jpeg)  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/8/c8ba131051dd8d96715400a68d7e115bd0a34a34.jpeg)

The flow can read the real temp out of the sensor but isn’t able to set this value.

thx  
Daniel

---

<div class="post-metadata">

**Author:** ![Rocodamelshekima](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocodamelshekima/32/8209_2.png) [@Rocodamelshekima](https://community.homey.app/u/Rocodamelshekima)\
**Post date:** [April 9, 2021, 10:56am UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/4 "2021-04-09T10:56:27Z")

</div>

And what is the actual temperature from that tag? Because it looks like something with 26.31275432 or something like that.

---

<div class="post-metadata">

**Author:** ![Daniel\_Weber](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/daniel_weber/32/16401_2.png) [@Daniel\_Weber](https://community.homey.app/u/Daniel_Weber)\
**Post date:** [April 9, 2021, 11:20am UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/5 "2021-04-09T11:20:20Z")

</div>

The Tag is 14.1

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [April 9, 2021, 11:37am UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/6 "2021-04-09T11:37:07Z")

</div>

You need to change your step size during pairing, by default this is only 0.5, measure temperature uses 0.01 usually

~~Not sure the step is changeable for the virtual target temperature.~~

~~if not then:  
Normally (regular) thermostats target temperature need to be rounded to \*.5 or round numbers, so you’ll have to calculate your value(s) (`{{ round(value * 2) / 2}}`) first, then send it to the thermostat.~~

---

<div class="post-metadata">

**Author:** ![Jolink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jolink/32/3559_2.png) [@Jolink](https://community.homey.app/u/Jolink)\
**Post date:** [April 9, 2021, 11:41am UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/7 "2021-04-09T11:41:51Z")

</div>

question to @Martijn_Hoogenbosch - how do you get the temp value shown in the icon/device? I get it working but not shown in the icon (only shows the value/temp when I long press the icon in my homey app).

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/5/056e92639ac7386b537720a4ea2ba0e4f3541725.png)

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [April 9, 2021, 11:55am UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/8 "2021-04-09T11:55:05Z")

</div>

my flow looks like:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/a/7a15404a05dd72f3669fa8795301a47c2264be93.png)

If: Temp changed  
And: empty  
Then: see screenshot

And I do have the 0.5 rounding. I don’t believe 0.1 works. At least I can’t get it working during the adding of the virtual device.

---

<div class="post-metadata">

**Author:** ![apps](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/apps/32/30000_2.png) [@apps](https://community.homey.app/u/apps)\
**Post date:** [April 9, 2021, 11:57am UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/9 "2021-04-09T11:57:19Z")

</div>

target\_temperature

![target_temperature](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/2/c2f324d00e768a364787baac3a4eed37dfb032c7.jpeg)

---

<div class="post-metadata">

**Author:** ![Jolink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jolink/32/3559_2.png) [@Jolink](https://community.homey.app/u/Jolink)\
**Post date:** [April 9, 2021, 1:08pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/10 "2021-04-09T13:08:59Z")

</div>

Unfortunately something still is not working properly. I am using a Aqara temp sensor outside (not a thermostat). My flow below:  
first issue is an execution error on target\_temperature. I saw in the capabilities that UI component is Thermostat and not sensor (will this work on a Aqara sensor?)  
second issue: no value still shown on the device (like in the screenshot of Martijn H), only after long pressing the device. This is my goal - get the value/temp shown in the device without having to long press it.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/3/93a3eed1bdbe054223274d70440e0ce3d0f3e503.jpeg)

---

<div class="post-metadata">

**Author:** ![Rocodamelshekima](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocodamelshekima/32/8209_2.png) [@Rocodamelshekima](https://community.homey.app/u/Rocodamelshekima)\
**Post date:** [April 9, 2021, 1:12pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/12 "2021-04-09T13:12:41Z")

</div>

Don’t think u can set a temperature on a sensor.

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [April 9, 2021, 1:22pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/13 "2021-04-09T13:22:35Z")

</div>

Please check if there are no spaces around the calculation. Should do the check with the webapp

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [April 9, 2021, 1:25pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/14 "2021-04-09T13:25:24Z")

</div>

Well, that depends on the way he has created the virtual sensor. It should at least have the following capabilities as you have mentioned:

- Targettemperature
- Measured temperature

And on top of that the minimum and maximum should be altered. Hes measuring an outside temp, you will probably want to change the minimum temp to -15 and max to 50 or so.

---

<div class="post-metadata">

**Author:** ![Jolink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jolink/32/3559_2.png) [@Jolink](https://community.homey.app/u/Jolink)\
**Post date:** [April 9, 2021, 1:35pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/15 "2021-04-09T13:35:45Z")

</div>

there was a space, removed it. Error stays the same

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/1/c1da06c933fb380d6e08425f2296f4c9567777fb.jpeg)  
If I look at the capabilities below it seems like target\_temperature is not applicable to a sensor, only thermostat!?  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/5/b5d748b913b3b0971e69eec79e8d35f51339c10a.png)

---

<div class="post-metadata">

**Author:** ![Martijn\_Hoogenbosch](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_hoogenbosch/32/10647_2.png) [@Martijn\_Hoogenbosch](https://community.homey.app/u/Martijn_Hoogenbosch)\
**Post date:** [April 9, 2021, 1:37pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/16 "2021-04-09T13:37:07Z")

</div>

Right, then that’s what @Rocodamelshekima means! I’m using thermostats indeed! My apologies to both, didn’t notice that. But the virtual device should be a thermostat for the view I’ve created.

---

<div class="post-metadata">

**Author:** ![Jolink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jolink/32/3559_2.png) [@Jolink](https://community.homey.app/u/Jolink)\
**Post date:** [April 9, 2021, 1:38pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/17 "2021-04-09T13:38:58Z")

</div>

thnx! made a new Virt Device with thermosat instead of Sensor, now see another device with temp indication. Will recreate the flows…  
update: got it working, thnx @Martijn_Hoogenbosch 👌

---

<div class="post-metadata">

**Author:** ![Peter\_Peter](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_peter/32/10563_2.png) [@Peter\_Peter](https://community.homey.app/u/Peter_Peter)\
**Post date:** [April 11, 2021, 3:43pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/18 "2021-04-11T15:43:46Z")

</div>

Geniaal dank je wel!!

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [April 11, 2021, 4:30pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/19 "2021-04-11T16:30:21Z")

</div>

> [@Jolink](#):
>
> Error stays the same

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/b/7b8e0ab0a8e663825b9f1ebdff6f8c3a3bc45a9c.png)  
You missed a **(** after round, these things always come in pairs 😉

---

<div class="post-metadata">

**Author:** ![John\_Stelten](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_stelten/32/18095_2.png) [@John\_Stelten](https://community.homey.app/u/John_Stelten)\
**Post date:** [November 10, 2022, 10:36am UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/21 "2022-11-10T10:36:17Z")

</div>

Hi, I want to add a virtual device based on a cost calculation. Is this possible within the virtual device app?

Thanks, John

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [November 10, 2022, 5:13pm UTC](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883/22 "2022-11-10T17:13:18Z")

</div>

I think you should take a look at it’s ‘big brother’ [Device Capabilities](https://homey.app/a/nl.qluster-it.DeviceCapabilities/).  
U can add any value unit you like, f.i. $ or €

> [@\[APP\]\[Pro\] Advanced Virtual Device (Device Capabilities App) with Unique Text Status Indicator](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198):
>
> If you have questions about the App Device Capabilities or seek help with an Flow or with the Flow Exchanger, please see the [Device Capabilities Topic](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287). [German](https://community.homey.app/t/the-flow-exchange-r-helfen-und-fragen-stellen/69807)[Another German topic](https://community.homey.app/t/device-capabilities/67934)[English](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287) If you have questions about the Advanced Virtual Device or seek help with the Exchanger File, please see the [Advanced Virtual Devices Topic](https://community.homey.app/t/app-pro-device-capabilities-addendum-fully-customisable-advanced-virtual-device-with-unique-text-status-indicator/68198). This topic! [German](https://community.homey.app/t/teilen-sie-ihr-gerat-erweiterte-virtuelle-gerate-aus-den-geratefahigkeiten/69583)[English](https://community.homey.app/t/app-pro-device-capabilities-addendum-fully-customisable-advanced-virtual-device-with-unique-text-status-indicator/68198) If you want to post a AVD as a Template for others to use, please post it on [Share Your Device! - Advanced Virtual Devices](https://community.homey.app/t/share-your-device-advanced-virtual-devices-from-device-capabilities/68676). [Germa…](https://community.homey.app/t/teilen-sie-ihr-gerat-erweiterte-virtuelle-gerate-aus-den-geratefahigkeiten/69583)

 ![Screenshot 2022-11-10 at 18-14-47 1.HomeyPro Peter](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/d/7dc108aee67c0298756109ea7d1d7d1b24fc021c.png)

### Flow:

[Next page](https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883.md?page=2)
