Homey Community

How should I expose my device to Homey?


#1

Hi there developers,

I have a Wohler CDL-210 monitor that is not “connected” in any way. It does, however, have a USB connector that can be used to read the current measurement values. I’ve written a small exporter program to read these values from the device, but now the question is: how do I expose this device in a way that I can use with Homey?

I plan on running the exporter program on a Raspberry Pi Zero W which will set beside the device and be connected to it via USB at all times. So I’ve got network access and can reach Homey (and Homey can reach the Pi). However, I’m unsure how to connect the two. I could write my own Homey app, but that seems like overkill for something relatively simple. Also, other users could then install my app, but would first have to replicate my Pi setup before they got anything working, which seems against the “spirit” of how apps should work (ie you just need the app, the device and Homey).

I’ve tried to find other options that might work, but nothing seems quite fit for what I want to do (virtual devices looked promising but the docs leave me unsure as to whether it can do what I want).

So my question is: what is the best way to expose the values I’ll be reading in with my code to Homey so that I can graph them with insights, trigger flows with them and have Homey treat it as a “device”?

Ideally the solution would be flexible enough to also support a scenario where, sometime in the future, I’ll replace the raspberry pi setup with an Arduino that does more or less the same thing.

Thanks in advance!


#2

A simple solution would be to use the HTTP Request Flow Cards app.

Inside a flow, you’d have a “Incoming GET” trigger card and you combine that with a virtual device that has the measure_co2 capability (“CO2 waarde”).

From your RPi, you make a periodic HTTP request to http://<LocalIP>/api/app/com.internet/co2niveau/:value:, where :value: would be the currently measured value.

The string “co2niveau” (just an example, you can pick your own event name) would match the “event naam” in the flow trigger.


#3

Thanks! Let me give that a try.