Software: modifications and extensions Toon

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

Moderators: marcelr, TheHogNL, Toonz

Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Hi all,

last week I received my rfxcom interface for the klikaanklikuit lights I have in two bedrooms.
I installed Domoticz on my raspberry and all is working fine.
My next step was to create an app on Toon to show the status of the lights on a tile and with a screen where you can switch the lights.
I started with the app from adjego and expanded that further.
Had to draw some new icons for the Dimstate/non-dim state.

All working fine but still some stuff to do:
- current list of devices is not retrieved from Domoticz, listed devices are hardcoded in DomoticzApp (idx variable in http request).
- currently the status of the lights is refreshed every 10 seconds. Which means that after switching a light on or off it takes 0-10 seconds before the status is shown on Toon but the lights are actually switched realtime via domoticz. I still need to figure out how I can trigger the status update on Toon after switching a light on Toon (calling a function in another QML file)
- Initially I had active buttons on the tile as well but it didn't look nice in Dim state, will see if I can add this back in later

I'm quite busy coming week, expect a clean version somewhere next weekend.
Consider this as work in progress and a source of inspiration :-)

EDIT: attachment removed, see next post
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Hi all,

'final' version on my app to control the two klikaanklikuit lights via domotics. Don't worry, no April 1st joke. :D

changelog:
- you can now click on the light icons on the tile as well to switch the lights on or off
- the new status of the lights is shown directly on the tiles as well as on the main screen.
Only the 'last seen' date-time on the main screen will be updated during the regular refresh cycle via domoticz every xx seconds (timer in DomoticzApp.qml)

Todo (at some time, not very soon):
- Implement a mechanism for Domoticz to trigger a screen refresh at Toon when lights are switched by Domoticz or the klikaanklikuit switches

Regards,

Toonz
Attachments
domoticzLights_V1.0.zip
(12.65 KiB) Downloaded 480 times
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Hi all,

a small note regarding the buienradar app:
As you might have noticed the small colored weather icons are not shown anymore on the tile (non-Dim state) and the details screen for the 5 days forecast
Reason: the buienradar website is now redirecting http requests for these images to https which is not supported by Toon.

I will download all images manually and include these in the drawable folder.
As I will be busy this week, I am not sure about the eta.

Regards,

Toonz
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

that was easier than I thought. New Buienradar release.
Changelog:
- small icons for 5 days forecast and tile in non-dim state now included in the drawables folder and shown correctly.

Kind regards,

Toonz
Attachments
ToonBuienradar_V7.2.zip
(64.84 KiB) Downloaded 401 times
member of the Toon Software Collective
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Software: modifications and extensions Toon

Post by marcelr »

Will copy it to the downloads section.
BrainHunt
Starting Member
Starting Member
Posts: 23
Joined: Thu Jun 30, 2016 11:37 am

Re: Software: modifications and extensions Toon

Post by BrainHunt »

Short question: I seem to have the same issue that QuasaR described end of February: I can't start x11vnc anymore (same error message).

The only fixes I see, seem to refer to the startup script which I didn't create in the first place. Probably I am missing something but can anyone help me get it back to work? I would like to share a tile that I'm working on but it would be nice to add a picture 8)

Thanks in advance
QuasaR
Starting Member
Starting Member
Posts: 23
Joined: Wed Feb 08, 2017 1:06 pm

Re: Software: modifications and extensions Toon

Post by QuasaR »

BrainHunt wrote:Short question: I seem to have the same issue that QuasaR described end of February: I can't start x11vnc anymore (same error message).

The only fixes I see, seem to refer to the startup script which I didn't create in the first place. Probably I am missing something but can anyone help me get it back to work? I would like to share a tile that I'm working on but it would be nice to add a picture 8)

Thanks in advance
If you run the command: which x11vnc
Do you get the following result : /usr/bin/x11vnc

If so, try starting it manually (it may give error's and refuse to start).
If that 'works' you need a startup script, I am using the following:

place this in /etc/init.d

Code: Select all

#!/bin/sh
#
# Start the server, with ssl support, VeNCrypt, and standard VNC password authentication.
# Accept multiple clients simultaneously. Run quietly, in the background.
#
# http://www.karlrunge.com/x11vnc/x11vnc_opts.html
#
# add to startup sequence with:    /usr/sbin/update-rc.d -v x11vnc start 60 5 . stop 60 0 1 6 .


DAEMON=/usr/bin/x11vnc
DAEMON_NAME=x11vnc
PasswDir=/.vnc
PasswFile=/.vnc/passwd
test -x $DAEMON || exit 0

start_x11vnc () {
        if [ -L $PasswDir ] && [ -d $PasswDir ]; then
                if [ -e $PasswFile ]; then
                        $DAEMON -shared \
                                -rawfb map:/dev/fb0@800x480x32 \
                                -forever \
                                -pipeinput UINPUT:touch,touch_always=1,abs,pressure=128,tslib_cal=/etc/pointercal,direct_abs=/dev/input/event0,direct_btn=/dev/input/event0,direct_rel=/dev/input/event0,direct_key=/dev/input/event0,nouinput \
                                -cursor arrow \
                                -usepw \
                                -quiet -bg
                else
                        echo -e \n
                        echo "The password file doesn't exist yet. Create one before using the startup script."
                fi
        else
                echo -e \n
                echo "a symlink from /.vnc to /root/.vnc seems to be missing. Add it with 'ln -s /root/.vnc /.vnc' "
        fi
}

stop_x11vnc () {
        killall $DAEMON_NAME
}

case "$1" in
start)
        echo -n "Starting x11vnc"
        start_x11vnc
        ;;

stop)
        echo -n "Stopping x11vnc"
        stop_x11vnc
        ;;

restart)
        $0 stop
        sleep 1
        $0 start
        ;;

*)
        echo "Usage: $0 {start|stop|restart}" >&2
        exit 1
        ;;
esac

exit 0
Please note! In the original script here on the forum, there is extra encryption enabled ( on the -usepw \ line). I removed it because the iOS clients can't handle it and I am using a VPN connection to my house before I can access Toon through VNC.
klaphekje
Starting Member
Starting Member
Posts: 36
Joined: Sat Oct 08, 2016 10:05 pm

Re: Software: modifications and extensions Toon

Post by klaphekje »

Hi Toonz,

As usual, very nice work and thanks for the update. Now i dont have to put out the trash every single day ;)

Í have tried to get your version of DomoticzLights working but it just does not show up when added to Globals.qml

Do you have any idea how that is possible? Your other apps all work fine!
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

klaphekje wrote:Hi Toonz,

As usual, very nice work and thanks for the update. Now i dont have to put out the trash every single day ;)

Í have tried to get your version of DomoticzLights working but it just does not show up when added to Globals.qml

Do you have any idea how that is possible? Your other apps all work fine!
Can you try to rename the folder to domoticz instead of domoticzLight (and the same in Globals.qml)?
member of the Toon Software Collective
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Software: modifications and extensions Toon

Post by Ierlandfan »

You seem to know your way around in QT so I have a question

You think something like this will work?

property int boilerDataRequestId: 1
var requestId = p.boilerDataRequestId++; // This does 2, 3, 4, 5, 6,7, 8 etc.

function parseDataId{
requestId; // parse the request and scan all ID's
return requestId; // Output of the parsed data
//dump to file
}

Since in the new happ_thermstat version the printTableInfo is disabled this could be a nice workaround
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Hi all,

I found a zero-day bug in the buienradar app. The function determineNight() in buienradar.js wasn't giving the correct result between 00:00 and 09:59 because of a missing leading zero. The impact was that the icon on the buienradar tile in dim state was showing a moon instead of a sun till 10:00.

I found this while implementing the following tweak:
I was not happy with the screen brightness in dim state: either too bright for the evening or to dark during a sunny day.
I therefore created this small tweak which will lower the brightness in dim state after sunset and increases it again after sunrise.
Change will be visible at the first time the buienradar timer is fired (within 10 minutes after sunrise/sunset).
The sunrise/sunset times are already retrieved from the buienradar.xml file.
This functionality is currently commented out because I am not sure all users want it.
Remove the comment // in line 363-367 in BuienradarApp.qml if you want to use it (I really like it personally)

Replace the values 10 (brightness dim state after sunset) and/or value 30 (brightness dim state after sunrise) to the values you prefer personally.
Note that this will overwrite the dim state brightness setting value from the 'instellingenmenu' every 10 minutes.

By the way: I also found the color array used in dim/non-dim state, which can be manipulated to implement something like f.lux to reduce 'blue' light after sunset.
For later maybe (after the holidays :-) )


Changelog:
- fix determineNight() function in Buienradar.js
- added dormant code in BuienradarApp.qml to control screen brightness in dim state
Attachments
ToonBuienradar_V7.2.1.zip
(64.98 KiB) Downloaded 426 times
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Ierlandfan wrote:You seem to know your way around in QT so I have a question
Since in the new happ_thermstat version the printTableInfo is disabled this could be a nice workaround
Will have a look after my holiday
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Hi all,

back from leave. Hereby a new version of the Buienradar app. The oldest to-do item is finally implemented: save the selected weather station and lon/lat coordinates for the rain tile and load at startup. The trick was not to read the default values at the very start (init function) but after the user interface has loaded via the onCompleted functionality (learned about this when doing the homescreen mod above).
Files written to the buienradar folder: selectedStation.txt, selectedLongitude.txt and selectedLatitude.txt

If these files don't exists the default values from the BuienradarApp.qml are used at startup.
These text files are written when changing the weather station or rain coordinates via the screens

No other change request pending for this app anymore.

EDIT, marcelr: Thanks, Toonz, moved the attached file to the downloads thread.
member of the Toon Software Collective
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Software: modifications and extensions Toon

Post by Toonz »

Ierlandfan wrote:You seem to know your way around in QT so I have a question

You think something like this will work?
...
Since in the new happ_thermstat version the printTableInfo is disabled this could be a nice workaround
Hi Ierlandfan,

I don't have an Eneco subscription and therefor cannot config my boiler in the app (tries to retrieve the list of boilers from Eneco which fails of course).
I haven't found any QML code asking for this level of detailed info from the boiler.
Will keep it on my to-do list, first the trash collecting stuff....;-)

Regardz,

Toonz
member of the Toon Software Collective
TerrorSource
Administrator
Administrator
Posts: 494
Joined: Thu May 04, 2017 9:28 pm

Re: Software: modifications and extensions Toon

Post by TerrorSource »

Toonz wrote:Added my final version, changelog:
- big Buienradar image enlarged as before
- added some clarifying text in the lon/lat entry screen

Happy to take any change requests but currently my to-do list is empty.
Probably will move on to the traffic app.

Many thanks to all who contributed: RomMom, hvxl, Marcelr and Brainhunt (apologies if I forgot someone).
It was a steep learning curve into Javascript and QML for me.
P.S. Marcel, your solution for redirecting the console output has been a life saver a couple of times, thanks for that

EDIT (marcelr): Moved attachment to the downloads thread.
Some traffic websites offer a free xml service.
Here's an example for fileindex.nl: https://pastebin.com/vzCvLnR2
Post Reply

Return to “Toon software development”