Connect any API as a virtual device

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

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.

1 Like

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

2 Likes

Yup. An example.

Webhook tado temperature sent to Pro

Screenshot of unreadable action card:

.
Webhook received by Pro

.
View the contents of [tag]

3 Likes

I think you might like these topics, Ulf.

1 Like

Thank you :slight_smile:

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…

1 Like

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)…

1 Like

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…

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