Re: Toon as a domotica controller?
Posted: Sat Apr 23, 2016 6:23 pm
Just a little spinoff: Can we use vnc or can we recompile QT to include vnc?
Domotica - Home Automation Forum
https://www.domoticaforum.eu/
VNC: possibly, some (not very sophisticated) code is available on github, for framebuffer devices.Can we use vnc or can we recompile QT to include vnc?
Code: Select all
toontje:~# /HCBv2/sbin/qt-gui -platform vnc:mode=websocket
[hxml] libhcb_xml v0.1 r83 (Apr 8 2015 14:03:20) [master#7a8b1c7a52] (ezxml 0.8.6)
[hbxt] libhcb_boxtalk v0.1 r85 (Mar 20 2014 18:55:21) []
[hcom] libhcb_com v0.1 r91 (Apr 4 2012 15:02:48) [] (OpenSSL 0.9.8m)
[hdrv] libhcb_drv v0.1 r272 (Jul 28 2015 15:36:22) [master#5c7df840aa]
[hbas] libhcb_base v0.1 r171 (Aug 26 2014 11:16:40) []
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
This application failed to start because it could not find or load the Qt platform plugin "vnc".
Available platform plugins are: linuxfb.
Reinstalling the application may fix this problem.
Aborted
toontje:~#
Script: almost ready, still need to implement user/passwd.Need to clean up the start-up script, shrink the x11vnc server a little, figure out password handling, make the server persistent, write a short manual and then we're good to go.
For security reasons, I prefer the vnc server not to be run by root. This can be achieved by switching to user 'nobody' immediately after server start-up. Then, the password verification mechanism doesn't work anymore, it relies on /bin/su, and that should be run with root permissions, otherwise it has no access to /etc/passwd. And, equally important, when using -unixpw, x11vnc presents a login screen that's hard to read on a small screen (phone), and then mostly fails to read user:passwd properly (and you would have to type it every time). Not a convenient way to enter your credentials.Ierlandfan wrote:Password: can't you use the CLI option - unixpw of -unixpw_nis ? It uses the "normal" unix usernames and passwords outside VNC.
http://www.karlrunge.com/x11vnc/x11vnc_ ... opt-unixpw
The toon-ketelmodule interface has an unknown, proprietary hardware protocol (24V, with some serial modulation). The communication between the ketelmodule and the boiler is OT (or bang-bang) Also 24V. The module has an Atmel microcontroller (AtMega 328 IIRC), with a 6-pin header next to it. Not sure if this header has a serial port. If so, it could be done, I guess.Ierlandfan wrote:Another hardware idea this time. Find the tx and rx on the keteladapter and hook up an inexpensive ESP8266 WIFI module to it. So we can get rid of the cabled line and place Toon anywhere we want. Or hook it up to a Raspberry Pi or whatever server you have laying around and use Qemu to emulate Toon.
Code: Select all
###############################################################################
Toon on a remote desktop and/or phone
20160501, marcelr, first release.
###############################################################################
Some time ago, cygnusx raised the question on remote control of toon, at the
domoticaforum. Sounded interesting/nifty.
After some googling, x11vnc came out as the best option to run a remote desktop
service: It runs on linux, supports framebuffer devices, touchscreens, and is
open source, therefore possible to implement on toon.
To cut a long story short: I made a stripped-down version of x11vnc for toon,
and a script to start it up.
###############################################################################
What you need
###############################################################################
1: A rooted toon
2: x11vnc installation package for toon: x11vnc_0.9.13-r0_qb2.ipk
3: A VNC client for your remote device (PC, phone, iPad, whatever), supporting
VeNCrypt over SSL. I use TigerVNC on my desktop (linux or windows), and bVNC
on my android phone.
###############################################################################
What you need to do
###############################################################################
1: Download the two parts of the zipped x11vnc package,
rename part two to x11vnc.z01, unpack, and upload x11vnc_0.9.13-r0_qb2.ipk to
toon via scp:
$ scp x11vnc_0.9.13-r0_qb2.ipk root@toon:/root/
2: Install the package:
toon:~# opkg install x11vnc_0.9.13-r0_qb2.ipk
Installing x11vnc (0.9.13-r0) to root...
Configuring x11vnc.
3: Check if the script exists (the binary is called x11vnc-bin):
toon:~# which x11vnc
/usr/bin/x11vnc
4: Run x11vnc. The first time, it will ask for a password, to be used with your
VNC client. Make sure to choose a STRONG password. Check out this list if you
want to know what NOT to choose:
http://www.passwordrandom.com/most-popular-passwords
After entering the same password twice, x11vnc will ask you to save the
password. Choose y.
Then, it will create the server and CA certificates for the TLS protocol.
A typical first-time run session looks like this:
toon:~# x11vnc
Enter VNC password:
Verify password:
Write password to /root/.vnc/passwd? [y]/n y
Password written to: /root/.vnc/passwd
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
bd:32:02:0b:
...
what follows are several pages of text on the generated certificates.
...
-----END CERTIFICATE-----
The SSL VNC desktop is: toon:0
PORT=5900
SSLPORT=5900
toon:~#
5: x11vnc serves on tcp port 5900. This has to be opened on your toon's
firewall.
Add the following line to /etc/default/iptables.conf:
-A HCB-INPUT -p tcp -m tcp --dport 5900 --tcp-flags SYN,RST,ACK SYN -j ACCEPT
(I like to keep these directives more or less tidy, so in my iptables.conf
this line is in between similar directives for ports 22 and 10080).
Restart the firewall:
$ /etc/init.d/iptables restart
###############################################################################
Accessing toon through VNC
###############################################################################
Install a VNC client (as said already: TigerVNC and bVNC are known to work).
Choose "Secure VNC over SSL tunnel" or something along these lines as
connection type, enter your toon's access data (name, IP, port (default 5900) )
and the password set earlier in the first run of x11vnc.
Connect to toon.
You should now have a working VNC connection, with toon's interactive display
on your remote device.
For connections outside your own subnet, forward some unused high-number port
(typically: 10000 < portnumber < 65535) to toon's port 5900 on your router.
Read your router's manual for more info on port forwarding.
###############################################################################
To do
###############################################################################
Lots of testing :-)
Add x11vnc startup to /etc/inittab. x11vnc will not yet start up by itself
after a reboot.
Find a way to keep toon from falling asleep when a VNC connection is active, or
wants access. When toon's screen is black ("Weg", or "Slapen") the VNC
connection is dropped.
Maybe enhance security with dedicated server/client/root certificates.