New hardware connection

Post Reply
Posts: 2
Joined: Fri Oct 30, 2020 6:41 pm

Fri Oct 30, 2020 7:07 pm

I'm running all the basic stuff - RPi with dockered cloud, Arduino with LED output and an app controlling the LED. is there somewhere a brief overview of what should I do to smoothly use Supla at my own hardware design?

My device will measure the water flow in the pipe with connection to controlling some GPIOs and display some stuff. So from a design point of view - 2-3 analog signals with "continuous" measurement, 5 GPIOs and exchanging String for the display.

If I understood correctly it should go like this:
Hardware: In case I will have to create a new class, it has to inherit the Element. Then I will create instances of all usable devices in my main method like: new Supla::Sensor::DS18B20 or new My::OutdoorDisplay.

App: Here I should create new layout for my device inheriting DetailLayout and new xml layout description. I saw some constants fetched from SuplaConst and I think that it is somehow important. I think that I have to somehow register new kind of device that the cloud understands it's not a simple thermometer.

Cloud: I'm running the cloud at my RPi from docker but I don't have any idea how to tell the cloud that I have a device with those specific inputs and be able to connect my phone with a device thru this cloud layer.

Can someone please point me to some kind of tutorial where I can read more about implementing such a device? Or can you please point me to the methods or classes which are important to notice? Otherwise it's several thousand lines of code which are difficult to go thru.

Thank you very much,
User avatar
Posts: 1550
Joined: Thu Jun 27, 2019 12:16 pm

Mon Nov 02, 2020 9:38 am

MJs wrote:
Fri Oct 30, 2020 7:07 pm
You can start by reading readme in SuplaDevice libraray (either develop branch from official github repo or from my repo: ). It is not a complete and finished document, but it should give some idea how it works.

Current version of library doesn't have implemented channels/elements that allow to read analog values from GPIO. This is because current version of Supla infrastructure (server, cloud, mobile app), doesn't support proper channel where it could be presented. You can always read the data and use thermometer channel to pass value, but it is kind of a dirty hack. I'll add such channels/elements to the librarary when Supla 2.4 will be published with a support of "general purpose measurment" channel.
However, if you don't want to wait, you can pass this data with thermometer channel. Here is example code of Element in SuplaDevice that will read analog value from a given GPIO: viewtopic.php?p=78970#p78970 (post is in Polish, however code example should be understandable) - it will perform read every 5 s. If you need other interval, please let me know, I'll explain how to change it.

SuplaDevice doesn't have any kind of dispaly supported. However you can add your own. It doesn't have to inherit from Element class (however it can - depending on how you want to implement it). You can put updates of display in main program loop, as long as it won't block exeuction of the loop (don't use delays and it shouldn't cause any problems).

Server/cloud - your device will register to server and it will tell it how many channels it has, so you don't have to do anything special here, as long as you use supported channel types.
On Cloud you can edit channel name, change it's icon, etc, to meet your needs.

App - Here I have no idea :). Is icon change and channel name enough? Or do you want to do something more?
Posts: 2
Joined: Fri Oct 30, 2020 6:41 pm

Thu Nov 05, 2020 7:27 pm

Thank you very much for your reply :-). I am trying to go thru all the information provided but it's tough. The system is really complicated for a newbie.

When I have additional questions I will ask in this thread. But again - thank you very much for your time and explanation :-)
Post Reply

Return to “Help”