QT websockets

Everything about software tools, new software development and toolchains. For developers, mostly.

Moderators: marcelr, TheHogNL, Toonz

TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

QT websockets

Post by TheHogNL »

From firmware 5.0.4 the original Toon resources also include libraries for QT5 websockets!

To use the libraries install them when having the VPN running with "opkg install libqt5websockets5" (I will probably add an option to the update-script to install this for you soon).

After this you can use the library in your qml code with "import QtWebSockets 1.0"
From there just use the docs at https://doc.qt.io/qt-5/qtwebsockets-qmlmodule.html and the examples at https://doc.qt.io/qt-5/qtwebsockets-examples.html

Using websockets in your qml code would allow your Toon to be externally controlled. Much more possibilities then the current ones using the /happ_thermstat (and other) urls which only supports a few commands.

For example, the use case where a forum members wants to put a doorbell-camera picture on the Toon when someone is ringing the phone could now be implemented easily. Much more ideas are welcome!
Member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: QT websockets

Post by Toonz »

I can now finally have a realtime status on Toon of the status of the klikaan/klikuit lights in the bedrooms (controlled via domoticz on a raspberry Pi)
No need for sending http requests to domoticz anymore every 5 seconds to query the status of the lights.
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: QT websockets

Post by Toonz »

It is also a perfect solution for someone to write a comprehensive mobile app to control the Toon remotely (using a companion app on Toon itself).
Basically everything is possible now, far beyond the options of the official mobile app from Quby :-)
Develop our own API?
member of the Toon Software Collective
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: QT websockets

Post by hvxl »

Works like a charm. And it avoids my web server logs from filling up with all those poll requests!
Schelte
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: QT websockets

Post by Toonz »

great stuff. By any change, did they also complie an UdpSocket class?
handy for sending discovery packets
member of the Toon Software Collective
WickedMaster
Member
Member
Posts: 76
Joined: Wed Nov 07, 2018 1:53 pm

Re: QT websockets

Post by WickedMaster »

Toonz wrote:It is also a perfect solution for someone to write a comprehensive mobile app to control the Toon remotely (using a companion app on Toon itself).
Basically everything is possible now, far beyond the options of the official mobile app from Quby :-)
Develop our own API?
Me and RoadXY are trying to make use of QT websockets for the app we're currently working on. Any help is welcome!
RoadXY
Member
Member
Posts: 111
Joined: Wed Oct 21, 2015 8:11 am

Re: QT websockets

Post by RoadXY »

Yes, any help is appreciated
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: QT websockets

Post by Toonz »

a lot you can find in the QT documentation : https://doc.qt.io/qt-5/qml-qtwebsockets-websocket.html including sample code.
The WebSockets allow you to receive/send from/to a Toon QML app directly without making user of the lighttpd webserver.
Do you have already ideas about functionality you want to build?
Exactly what type of help is requested?
member of the Toon Software Collective
WickedMaster
Member
Member
Posts: 76
Joined: Wed Nov 07, 2018 1:53 pm

Re: QT websockets

Post by WickedMaster »

At this point we're looking for a possibility to change/add programs from the app. Eventually we want to do everything with websockets in the app. So, also changing the temperature, fetching information etc.. This is currently done by using HTTP requests. But, changing/adding programs, doesn't seem to be able by using HTTP post/requests.

It would be helpful if someone can assist us with setting up a new QML app/module for the Toon, so that we have a base to lean on. We've got no experience with developing apps for the Toon itself.
RoadXY
Member
Member
Posts: 111
Joined: Wed Oct 21, 2015 8:11 am

Re: QT websockets

Post by RoadXY »

By programs we mean the heating schedule
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: QT websockets

Post by Toonz »

That is not so straight forward. We can also look into modifying the quby schedule programming app for this (use websockets there)
member of the Toon Software Collective
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: QT websockets

Post by oepi-loepi »

Toonz wrote:I can now finally have a realtime status on Toon of the status of the klikaan/klikuit lights in the bedrooms (controlled via domoticz on a raspberry Pi)
No need for sending http requests to domoticz anymore every 5 seconds to query the status of the lights.
Did you manage to use the Websockets for this and could you share the Toon and Domoticz code? I now have the doorbell camera, my Onkyo receiver control, washing dryer status and waching machine status on the Toon but all by pulling Domoticz status. Websockets will be much neater.
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: QT websockets

Post by Toonz »

oepi-loepi wrote:Did you manage to use the Websockets for this and could you share the Toon and Domoticz code? I now have the doorbell camera, my Onkyo receiver control, washing dryer status and waching machine status on the Toon but all by pulling Domoticz status. Websockets will be much neater.
Ha, good call, I completely forgot about this. Current domoticzboard app is not using it.
I will have a look at it after I finished the new Fileinfo app (is almost finished on a Toon 2 but I still have to check the gui elements and performance on a Toon 1).
member of the Toon Software Collective
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: QT websockets

Post by oepi-loepi »

Toonz wrote:Ha, good call, I completely forgot about this. Current domoticzboard app is not using it.
I will have a look at it after I finished the new Fileinfo app (is almost finished on a Toon 2 but I still have to check the gui elements and performance on a Toon 1).
Well it seems it should be integrated in the newest beta of Domoticz https://github.com/domoticz/domoticz/co ... 34ca617dc0. However i have newer worked with it so a good example would be very nice. Maybe some other forum member has tried?
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: QT websockets

Post by oepi-loepi »

TheHogNL wrote:From firmware 5.0.4 the original Toon resources also include libraries for QT5 websockets!

To use the libraries install them when having the VPN running with "opkg install libqt5websockets5" (I will probably add an option to the update-script to install this for you soon).
if i run opkg list-installed then libqt5websockets5 is not in the list and when i run "opkg install libqt5websockets5" it throws an error. Even when i open the VPN (in inittab and then init q)

Code: Select all

Installing libqt5websockets5 (5.11.2+git0+e71467cb56-r0) on root.
Downloading http://feed.hae.int/feeds/nxt/oe/angelica-1.7.0-master-kernel-4.9.88/cortexa9hf-vfp-neon/libqt5websockets5_5.11.2+git0+e71467cb56-r0_cortexa9hf-vfp-neon.ipk.
Collected errors:
 * opkg_download: Failed to download http://feed.hae.int/feeds/nxt/oe/angelica-1.7.0-master-kernel-4.9.88/cortexa9hf-vfp-neon/libqt5websockets5_5.11.2+git0+e71467cb56-r0_cortexa9hf-vfp-neon.ipk: Couldn't connect to server.
 * opkg_install_pkg: Failed to download libqt5websockets5. Perhaps you need to run 'opkg update'?
Do I do something wrong or would it be possible to post the .ipk package in the files section?
Post Reply

Return to “Toon software development”