Toon app: Home Assistant controller

Forum about forum-provided applications on Toon

Moderators: marcelr, TheHogNL, Toonz

TerrorSource
Administrator
Administrator
Posts: 494
Joined: Thu May 04, 2017 9:28 pm

Re: Toon app: Home Assistant controller

Post by TerrorSource »

I've installed Home Assistant Controller as a test on my Toon and the icon in the Tile stays blue-colored in dim-state.
Maybe you can change that into a grey toned one? like Sonos-app has?
Luc_S
Starting Member
Starting Member
Posts: 45
Joined: Tue Jun 05, 2018 6:57 pm

Re: Toon app: Home Assistant controller

Post by Luc_S »

TerrorSource wrote:I've installed Home Assistant Controller as a test on my Toon and the icon in the Tile stays blue-colored in dim-state.
Maybe you can change that into a grey toned one? like Sonos-app has?
I'm not familiar with the Sonos-app dim-state icon but I did create a grey-style Home Assistant icon and added this to the latest update on GitHub :)
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: Home Assistant controller

Post by Toonz »

Luc_S wrote:I'm not familiar with the Sonos-app dim-state icon but I did create a grey-style Home Assistant icon and added this to the latest update on GitHub :)
you basically have to create two versions of each icon, one coloured one for normal state and one for the dim state (grey).
In your tile you can test whether you are in dim state or not (see other apps for examples).
member of the Toon Software Collective
Rudolf
Member
Member
Posts: 136
Joined: Mon Dec 04, 2017 8:50 pm

Re: Toon app: Home Assistant controller

Post by Rudolf »

Thanks for putting this together, I'm using emulated_hue to control (switches in) HASS, but this looks neat. Very promising development, impressive work for a non-coder.

Will try this when an updated version hits the stores. (or maybe even sooner :D )

As an alternative for using a Tile to open the app, may I suggest using an icon in the notification bar (as ToonStore and DashTicz do)

Here's an example in code:
https://github.com/Dashticz/dashticz_to ... czTray.qml
*App.xml seems to refer to it too:
https://github.com/Dashticz/dashticz_to ... iczApp.qml
Don't know if any other modifications are required.
michel30 wrote:Hello,

This looks nice,

Does it also works with domoticz? or do you need the real home assistant program?
Isn't DashTicz for Toon what you're looking for:
viewtopic.php?f=87&t=11882
Luc_S
Starting Member
Starting Member
Posts: 45
Joined: Tue Jun 05, 2018 6:57 pm

Re: Toon app: Home Assistant controller

Post by Luc_S »

Rudolf wrote:As an alternative for using a Tile to open the app, may I suggest using an icon in the notification bar (as ToonStore and DashTicz do)
I'll put it on the wishlist. I was hoping to be able to add some sensor info to the tile so you didn't have to open the app for some key values, that's why I started with a tile :)


Atm I'm trying to make it communicate with Home Assistant on SSL. For some reason I'm unable to make it work. Home Assistant is running on a valid certificate (using Let's encrypt combined with DuckDNS). The generated fullchain certificate is added to my Toon but it's still giving me 'Unable to locally verify the issuer's authority.'.

This is what I did:
1. Copied the generated fullchain.pem to Toon's directories as files:
  • a. /etc/ssl/certs/fullchain.pem
    b. /usr/share/ca-certificates/fullchain.crt
Yes they both are exactly the same files.

2. Then I added 'fullchain.crt' to the bottom of file '/etc/ca-certificates.conf'
3. Ran command 'update-ca-certificates'.

Now I see the .pem and .crt files linked:

Code: Select all

lrwxrwxrwx    1 root     root            40 Jun 15 18:28 fullchain.pem -> /usr/share/ca-certificates/fullchain.crt
When trying to wget the main Home Assistant api XML I get the error 'Unable to locally verify the issuer's authority.'. In the custom app I get no responseText whatsoever.

Anyone an idea what's going wrong here?
Toonz
Forum Moderator
Forum Moderator
Posts: 1873
Joined: Mon Dec 19, 2016 1:58 pm

Re: Toon app: Home Assistant controller

Post by Toonz »

Luc_S wrote:Anyone an idea what's going wrong here?
have you used all ssl options in the wget call (see wget --help for help)?
member of the Toon Software Collective
Luc_S
Starting Member
Starting Member
Posts: 45
Joined: Tue Jun 05, 2018 6:57 pm

Re: Toon app: Home Assistant controller

Post by Luc_S »

Toonz wrote:
Luc_S wrote:Anyone an idea what's going wrong here?
have you used all ssl options in the wget call (see wget --help for help)?
Not all but I did try the following:

wget --ca-directory=/etc/ssl/certs https://xxx.duckdns.org/api/states?api_password=xxx
Resolving xxx.duckdns.org... x.x.x.x
Connecting to xxx.duckdns.org|x.x.x.x|:443... connected.
ERROR: cannot verify xxx.duckdns.org's certificate, issued by `/C=US/O=Let\'s Encrypt/CN=Let\'s Encrypt Authority X3':
Unable to locally verify the issuer's authority.
To connect to xxx.duckdns.org insecurely, use `--no-check-certificate'.

wget --ca-directory=/usr/share/ca-certificates https://xxx.duckdns.org/api/states?api_password=xxx
Resolving xxx.duckdns.org... x.x.x.x
Connecting to xxx.duckdns.org|x.x.x.x|:443... connected.
ERROR: cannot verify xxx.duckdns.org's certificate, issued by `/C=US/O=Let\'s Encrypt/CN=Let\'s Encrypt Authority X3':
Unable to locally verify the issuer's authority.
To connect to xxx.duckdns.org insecurely, use `--no-check-certificate'.

wget --certificate=/etc/ssl/certs/fullchain.pem https://xxx.duckdns.org/api/states?api_password=xxx
OpenSSL: error:0906D06C:PEM routines:PEM_read_bio:no start line
OpenSSL: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib
Disabling SSL due to encountered errors.

wget --certificate=/usr/share/ca-certificates/fullchain.crt https://xxx.duckdns.org/api/states?api_password=xxx
OpenSSL: error:0906D06C:PEM routines:PEM_read_bio:no start line
OpenSSL: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib
Disabling SSL due to encountered errors.

wget --certificate=/etc/ssl/certs/fullchain.pem --certificate-type=PEM --private-key=/etc/ssl/certs/fullchain_key.pem --private-key-type=PEM --secure-protocol=SSLv2 https://xxx.duckdns.org/api/states?api_password=xxx
Resolving xxx.duckdns.org... x.x.x.x
Connecting to xxx.duckdns.org|x.x.x.x|:443... connected.
Unable to establish SSL connection.
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon app: Home Assistant controller

Post by marcelr »

Toon's native wget doesn't support ssl. You will need the version from the forum ftp server to get that working ...
Luc_S
Starting Member
Starting Member
Posts: 45
Joined: Tue Jun 05, 2018 6:57 pm

Re: Toon app: Home Assistant controller

Post by Luc_S »

marcelr wrote:Toon's native wget doesn't support ssl. You will need the version from the forum ftp server to get that working ...
Ah ok, should I be spending time to get wget working? I was troubleshooting wget because it gave me some errors to work with. In the app (where it is needed) I'm getting a status 0 with an empty responseText :roll:

A simple curl command is giving me the response I expect so I should be very close right? :D

Code: Select all

curl 'https://xxx.duckdns.org/api/states?api_password=xxx'
[Edit]:
I did a "update-ca-certificates --fresh" and a reboot of my Toon and it appears to be working!

[Edit 2]:
In the end this is what is now configured on my Toon, no clue if everything is needed but it works so I'm not changing it :P
My certificate structure looks like this:
DST Root CA X3 (Root certificate authority)
----> Let's Encrypt Authority X3 (Intermediate certificate authority)
---- ----> xxx.duckdns.org (Certificate)
  • 1. I copied all 3 certificates to /etc/ssl/certs/ with a .pem extension and to /usr/share/ca-certificates/ with a .crt extension (I kept names exactly the same apart from the file extensions).
    2. I added the .crt filenames to /etc/ca-certificates.conf (last 3 lines)

Code: Select all

# Lines starting with # will be ignored
# Lines starting with ! will remove certificate on next update
#
...
...
DST_Root_CA_X3.crt
xxx_duckdns_org.crt
LE_Authority_X3.crt
  • 3. Ran command 'update-ca-certificates --fresh'. A 'ls -l' command in folder /etc/ssl/certs/ now gives the following certificates and references;

Code: Select all

lrwxrwxrwx    1 root     root    45 Jun 20 19:41 DST_Root_CA_X3.pem -> /usr/share/ca-certificates/DST_Root_CA_X3.crt
lrwxrwxrwx    1 root     root    46 Jun 20 19:41 LE_Authority_X3.pem -> /usr/share/ca-certificates/LE_Authority_X3.crt
lrwxrwxrwx    1 root     root    52 Jun 20 19:41 xxx_duckdns_org.pem -> /usr/share/ca-certificates/xxx_duckdns_org.crt
  • 4. I did a reboot of Toon and the app now works as expected with Home Assistant on SSL :)
[Edit 3]:
As stated by Rudolf a few posts later only the root certificate is needed by Toon. So in the example above forget about LE_Authority_X3.crt and xxx_duckdns_org.crt

Also, you can just add the root certificate file to /usr/share/ca-certificates/ and add the certificate filename to file /etc/ca-certificates.conf. When you then run command 'update-ca-certificates --fresh' the system will build the stuff needed in folder /etc/ssl/certs/
Last edited by Luc_S on Thu Sep 20, 2018 11:01 pm, edited 2 times in total.
Luc_S
Starting Member
Starting Member
Posts: 45
Joined: Tue Jun 05, 2018 6:57 pm

Re: Toon app: Home Assistant controller

Post by Luc_S »

Hey all, I completed adding some sensor info to the tile. The first 3 configured sensors will be shown on the tile.

Because now I have more than 4 tiles I want on the main tile window, I added a date/time style tile option :) (this can be turned off, in that case the Home Assistant icon will be centered and still available in dim-state as grey styled icon).

[Edit]:
Sensor info will now also automatically refresh every minute, this to make sure the sensor info shown on the tile is kinda up-to-date :P

Image

Image
timkoers
Member
Member
Posts: 77
Joined: Thu Jun 28, 2018 6:43 pm

Re: Toon app: Home Assistant controller

Post by timkoers »

Are self signed certificates supported?

I've got an instance running self signed certificates, but it doesn't seem to connect.


Btw, you are an absolute hero making this app.
I'll see if I can contribute to the app on GitHub :D
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon app: Home Assistant controller

Post by marcelr »

timkoers wrote:Are self signed certificates supported?

I've got an instance running self signed certificates, but it doesn't seem to connect.
AFAIK, No. :-(
timkoers
Member
Member
Posts: 77
Joined: Thu Jun 28, 2018 6:43 pm

Re: Toon app: Home Assistant controller

Post by timkoers »

So I followed the duckdns tutorial and everything seems to be working as it should.
When I add the server to the Toon app, it shows Settings not saved, got response ""

How do I fix that issue?

Since Let's Encrypt certificate last for 90 days, do I need to update the certificates on the Toon every 90 days as well?
Luc_S
Starting Member
Starting Member
Posts: 45
Joined: Tue Jun 05, 2018 6:57 pm

Re: Toon app: Home Assistant controller

Post by Luc_S »

Tbh I have been trying to make ssh work on the Toon for days. In the end I got it working as I described. Make sure to enter the duckdns url in the app <domain>.duckdns.org with port 443.

About updating the certificates, good question, I don't know. I'm not really familiar with SSH, I needed it on my HASS because I bought an Echo Dot which I wanted to use with my home automation.
Rudolf
Member
Member
Posts: 136
Joined: Mon Dec 04, 2017 8:50 pm

Re: Toon app: Home Assistant controller

Post by Rudolf »

I highly doubt that; the only cert Toon has to trust is the root-certificate (the cert of the certificate authority - ca). As long as that certificate is valid, Toon will accept certificates derived from this ca.
It might the confusing that the cert is called 'xxx_duckdns_org.crt', makes me believe it's specific for that xxx-domain, but I don't think it is.

Here's a more accurate description:
https://support.dnsimple.com/articles/w ... rtificate/
Post Reply

Return to “Toon Apps”