Page 1 of 2

Web proxy to control Toon remotely

Posted: Sat Mar 03, 2018 3:58 pm
by Martin101010
Hello all,
As you might know we were trying to create an app with secure access to remotely change the settings of Toon. Unfortunately, password authentication and the iPhone where an issue.

We managed to create another solution which is phone manufacturer independent. What you need is a working secure webserver (https and PhP) with external access. I use a Synology NAS. This server must be in the same Lan as your toon.

This website, when logged on, looks like the toon app. An php script is acting as a kind of proxy in the background between the website and the toon. In this way the local Lan is not exposed. And others cannot access Toon without the password.

Just copy the files from GitHub https://github.com/jonkootje/secure-toon-control
to your webserver (sub) folder and change the IP address (of your Toon) and the Password in the api.php script (line 15 and 17)
Point the browser of your phone, pc or tabled to the url or ip address of your webserver and logon with the password and you’re in business.

Sander and Martin

Re: Web proxy to control Toon remotely

Posted: Sat Mar 03, 2018 7:00 pm
by TheHogNL
Nice! Ofcourse you will need to open a portforwarding to your internal webserver so you can connect to the webserver. This opens a port into your home network from everything on the internet.

You could also run this website on a external webserver and open a portforwarding to allow only your external webserver to access your Toon. Now only your webserver has access to your home network. A bit more secure.

Even better is to use the openvpn from Toon to build a own VPN towards the external webserver. Now your webserver is directly connected to your Toon making it even more secure. But then again, it all depends on the security of your webserver :-)

Re: Web proxy to control Toon remotely

Posted: Sat Mar 03, 2018 9:29 pm
by michel30
This works very nice.
Thanks for this nice web page app.

Re: Web proxy to control Toon remotely

Posted: Sun Mar 04, 2018 8:14 pm
by michel30
@Martin101010

Are you also building in this webpage app power now, gas now , energie use etc like the original toon App?

I used this app today a couple of times, works very good..

Thanks.

Re: Web proxy to control Toon remotely

Posted: Mon Mar 05, 2018 12:07 am
by gijsje
It is not working for me
I does say it is connected but no temp displayed.

This is the info from /happ_thermstat?action=getThermostatInfo

Code: Select all

{"result":"ok", "currentTemp":"1979", "currentSetpoint":"2000", "currentInternalBoilerSetpoint":"70", "programState":"0", "activeState":"1", "nextProgram":"-1", "nextState":"-1", "nextTime":"0","nextSetpoint":"0","randomConfigId":"1352600945","errorFound":"255","connection":"0","burnerInfo":"1","otCommError":"0","currentModulationLevel":"99"}
if i do F12 i see this error

Code: Select all

app.js:248 Uncaught TypeError: Cannot read property 'currentTemp' of null
    at Object.fillData (app.js:248)
    at Object.success (app.js:201)
    at i (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at A (jquery.js:4)
    at XMLHttpRequest.<anonymous> (jquery.js:4)

Re: Web proxy to control Toon remotely

Posted: Mon Mar 05, 2018 9:40 am
by gielie
gijsje wrote:It is not working for me
I does say it is connected but no temp displayed.

This is the info from /happ_thermstat?action=getThermostatInfo

Code: Select all

{"result":"ok", "currentTemp":"1979", "currentSetpoint":"2000", "currentInternalBoilerSetpoint":"70", "programState":"0", "activeState":"1", "nextProgram":"-1", "nextState":"-1", "nextTime":"0","nextSetpoint":"0","randomConfigId":"1352600945","errorFound":"255","connection":"0","burnerInfo":"1","otCommError":"0","currentModulationLevel":"99"}
if i do F12 i see this error

Code: Select all

app.js:248 Uncaught TypeError: Cannot read property 'currentTemp' of null
    at Object.fillData (app.js:248)
    at Object.success (app.js:201)
    at i (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at A (jquery.js:4)
    at XMLHttpRequest.<anonymous> (jquery.js:4)
I have the same problem, What version is your toon on, mine is 4.9

Version 4.9 support & Gas and Energy feature

Posted: Mon Mar 05, 2018 6:41 pm
by Martin101010
@Gijsje & @Gielie:
Thanks for reporting that bug. From now on the application also supports version 4.9. The Toon URL is different in 4.8 (Instead of happ_thermstat it was happ_thermostat), thats why the application could not get the data from the Toon device.

To get this working:

You can either get the fixed version on the GitHub repository (https://github.com/jonkootje/secure-toon-control) and change the new made variable $VERSION to '4.9'.
OR
You can manually edit the URL in php/api.php. Directly after the settings section you can find the URL builder, there you see that the request goes to /happ_thermostat, in your case you have to change that to /happ_thermstat and everything should work!

@Michel30:
For that I need the http request that gives the gas and energy usage information. I can't find that anywhere. Does anyone here know that?

Re: Web proxy to control Toon remotely

Posted: Mon Mar 05, 2018 7:40 pm
by michel30
Hello,

I think it is here:

http://TOON_IP/happ_pwrusage?action=GetCurrentUsage

This is live use of you power and gas. but the scrip must say refresh ... every 10 sec to receive new data.

Total you can find here: http://TOON_IP/hdrv_zwave?action=getDevices.json

Re: Version 4.9 support & Gas and Energy feature

Posted: Mon Mar 05, 2018 9:23 pm
by gijsje
Martin101010 wrote:@Gijsje & @Gielie:
Thanks for reporting that bug. From now on the application also supports version 4.9. The Toon URL is different in 4.8 (Instead of happ_thermstat it was happ_thermostat), thats why the application could not get the data from the Toon device.
Thanks now it works

Re: Web proxy to control Toon remotely

Posted: Mon Mar 05, 2018 10:20 pm
by Martin101010
@Michel30

Thanks for the URL. I made a GitHub branch with a version that shows the Power and Gass usage (https://github.com/jonkootje/secure-too ... er-support). I'm not able to test it currently so if you can do it for me that would be great. Also i don't know in what unit the Gass usage is given. I put Liters for now because i saw that on other screenshots but i'm not sure if that's the right one.

When i get confirmation that everything works well, i will merge the branch with the master branch on GitHub.

Sander

Re: Web proxy to control Toon remotely

Posted: Mon Mar 05, 2018 11:59 pm
by michel30
@Martin101010

Unfortunately it does not work, in the bottom it stays on orange Loading...

I changed my IP plus version number.

Code: Select all


// SETTINGS - CHANGE THESE \/\/\/\/\/\/\/\/\/

$ADRESS = 'MY IP'; // LOCAL IP ADRESS OF TOON SERVER
$VERSION = '4.9'; // TOON VERSION (SUPPORTED: 4.8 / 4.9)

Could you load your TOON settings? without the power use?

Re: Web proxy to control Toon remotely

Posted: Thu Mar 08, 2018 9:21 am
by Martin101010
@Michel30

I updated the branch with a fix in the php/api.php. I hope it will work now: https://github.com/jonkootje/secure-too ... er-support

Sander

Re: Web proxy to control Toon remotely

Posted: Thu Mar 08, 2018 4:04 pm
by gielie
The latest version doesn't work at all, i get a screen without any data, the first version works fine..

btw i can't git clone the latest version

Code: Select all

admin@Endor:/volume1/web/Toon2$ /opt/bin/git clone https://github.com/jonkootje/secure-toon-control.git
Cloning into 'secure-toon-control'...
fatal: unable to access 'https://github.com/jonkootje/secure-toon-control.git/': error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

Re: Web proxy to control Toon remotely

Posted: Thu Mar 08, 2018 10:11 pm
by Rudolf
The power-branch shows a page for me.
The number for gas and power is 0.
(And the gas-icon looks like a water droplet to me)

Pages shows this php-error on both branches

Code: Select all

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/index.php:1) in /var/www/html/index.php on line 5
Running the site in docker with this command:

Code: Select all

 docker run -p 80:80 -d -e 'GIT_REPO=https://github.com/jonkootje/secure-toon-control.git' richarvey/nginx-php-fpm:latest
I'm no web-dev, so I don't know what php is complaining about.... :P
Nice project. This allows my household to control Toon without pre-installing an app first. Keep up the good work.

Re: Web proxy to control Toon remotely

Posted: Sun Apr 15, 2018 10:56 am
by aabre
@Martin101010

Tks Martin101010 is works great, installed te files on a Vimexx hosting website (PHP) for 0,45 euro a month give my router NAT only acces from the web server and it works perfect.

Ik have 4 Toons in my house so I have to figure out to controle them separatedly.

perhaps it is possible to add a port number variable or can I use $ADRESS = 'xxx.xxx.xxx.xxx:45000'; // LOCAL IP ADRESS OF TOON SERVER AND PORT NUMBER 45000 ?


Great work Martin