# Connect any API as a virtual device

**URL:** <https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013>\
**Category:** Questions & Help\
**Created:** [March 23, 2022, 11:46pm UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013 "2022-03-23T23:46:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ulfkri](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ulfkri/32/52450_2.png) [@ulfkri](https://community.homey.app/u/ulfkri)\
**Post date:** [March 23, 2022, 11:46pm UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013/1 "2022-03-23T23:46:36Z")

</div>

I’m looking for an app like OpenWeather, but for any API. I’m new to Homey btw, so have patience 🙂

Say I have a thermostat that is not supported by Athom, but has it’s own api. I would like to add a virtual device and pull the temperature from the online api every five minutes.

I’m sure I could achieve this somehow with the http app in combination with the virtual devices app and probably better logic and a flow for each pull, but I’m surprised I’m unable to find a standalone app for it.

It should behave just like OpenWeather, but with the option to map some json value to some property on the virtual device.

Is there anything like this or is it just wishful thinking?

Btw, if it does not exists and someone wants to make it I believe a good name for it would be External Device.

---

<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:** [March 24, 2022, 12:22am UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013/2 "2022-03-24T00:22:08Z")

</div>

You can try to use Webhooks, no App needed, it’s buildin (logic).

---

<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:** [March 24, 2022, 4:00pm UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013/3 "2022-03-24T16:00:54Z")

</div>

Yup. An example.

Webhook tado temperature sent to Pro

Screenshot of unreadable action card:

 ![Screenshot_20220324-170309_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/f/2fd0f2c3520f8f37e8a1f6c5017c3428f86c2a10.jpeg)

.  
Webhook received by Pro

.  
View the contents of `[tag]`

 ![Screenshot_20220324-165523_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/6/f68d2ddb48114b41a0fdce9744eca55b3ea6f564.jpeg)

---

<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:** [March 24, 2022, 6:55pm UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013/4 "2022-03-24T18:55:24Z")

</div>

I think you might like these topics, Ulf.

> [@Setting up simple GET request and storing value as numeric logic object](https://community.homey.app/t/setting-up-simple-get-request-and-storing-value-as-numeric-logic-object/48614):
>
> Hi everyone. Hope someone more familiar with GET requests can help me out here, as I’m new to the syntax required to setup GET responses. I’m trying to setup a logic GET-request in one of my flows in order to periodically collect data on currency exchange rate USD\_NOK. I’ve found several websites that offer free API’s for this. As an example: [https://free.currconv.com/api/v7/convert?q=USD\_NOK&compact=ultra&apiKey=ab47037514ac4157626c](https://free.currconv.com/api/v7/convert?q=USD_NOK&compact=ultra&apiKey=ab47037514ac4157626c) This url returns a simple response like the example below: {…

> [@Weatherdata in variables (openweather and meteoserver) with Homeyscript](https://community.homey.app/t/weatherdata-in-variables-openweather-and-meteoserver-with-homeyscript/36890):
>
> When making a api call for weather data I experienced that I had to make many flows to get the weatherdata for the upcoming 24 hours. 24 flows for a call every hour and 24 flows for processing the json data. And this is only for 1 forecast e.g rain. Therefore I made a little script to get the weatherdata from openweather and meteoserver. Special thx to @robertklep for his great help. Just make 1 flow running this script with Homeyscript. Run it e.g every hour. Do not exceed your maximum of api …

---

<div class="post-metadata">

**Author:** ![ulfkri](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ulfkri/32/52450_2.png) [@ulfkri](https://community.homey.app/u/ulfkri)\
**Post date:** [March 24, 2022, 8:28pm UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013/5 "2022-03-24T20:28:35Z")

</div>

Thank you 🙂

I have 13 unsupported devices with a total of 33 sensors, so I believe a solution with webhooks would require 33 flows. I will look into using scripts in stead since they are easier to copy. I should be able to map the json values to virtual device properties so they are propagated with MQTT, same as non-virtual devices.

If I was better with javascript I would try to build a generic app for it. OpenWeather is a good starting point, it’s just a matter of mapping the json values to virtual devices. I’m thinking one virtual device per endpoint…

---

<div class="post-metadata">

**Author:** ![Techniman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/techniman/32/8654_2.png) [@Techniman](https://community.homey.app/u/Techniman)\
**Post date:** [March 28, 2022, 2:31pm UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013/6 "2022-03-28T14:31:43Z")

</div>

> [@ulfkri](#):
>
> matter of mapping the json val

While its certainly possible to do this through homey/homeyscript, it might be quicker&nicer to use node-red for the API-\>MQTT…  
I went the same route for basically everything so I’m flexible if anything needs to change, e.g. I’ve moved my trash collection to MQTT and have Homey setup to check the MQTT topic for its triggers, this also reduces the number of apps needed… send me a PM if you need some help (though i’m not checking this site daily)…

---

<div class="post-metadata">

**Author:** ![ulfkri](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ulfkri/32/52450_2.png) [@ulfkri](https://community.homey.app/u/ulfkri)\
**Post date:** [March 31, 2022, 10:46pm UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013/7 "2022-03-31T22:46:00Z")

</div>

Thanks for the input, I will look into node-red.

I discovered I’m not any good with JavaScript, so now I’m thinking I might have a custom built service running on a local computer pulling device values from remote api’s and pushing them to Homey via MQTT to virtual devices on the MQTT Hub…

---

<div class="post-metadata">

**Author:** ![Techniman](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/techniman/32/8654_2.png) [@Techniman](https://community.homey.app/u/Techniman)\
**Post date:** [April 2, 2022, 10:30am UTC](https://community.homey.app/t/connect-any-api-as-a-virtual-device/62013/8 "2022-04-02T10:30:15Z")

</div>

Node-red (NR) is a visual workflow tool that does the work for you, no need to write JS if you don’t want to, but it is possible. It would still be running on a local computer (RPi, Nas etc) but it’s scalable and very easy
