Using CATT

I’ve got this working with SSH keys now if you needed any help?

Hello all and thanks for all the information on this thread. I finally got my Lovelace screen to cast to my nest hub but after 10 minutes it reverts to the clock. Is this happening for anyone else? Is there a setting to allow the cast to remain on screen until catt stop is called?

Thanks
Ian


This is WIP to use catt in a container environment.
Not working on all platforms, but i hope it get fixed.
1 Like

@Mrianphill the 10 min. thing is something with the latest firmware update.
Hopefully, they revert it. :frowning:

Ah ok thanks I hope they do too :grinning:

I found quite an easy way to use CATT when using Hassio on a Raspberry pi:

Step 1. Install https://github.com/hassio-addons/addon-ssh
Important! :DO NOT USE “Terminal & SSH” addon, that addon will not work, use the addon in this link above.

Step 2. In the configuration of this addon add this (it will install CATT everytime the whole system is rebooted, this is needed as the container of the addon is clean at every system reboot)

init_commands:
  - python3 -m pip install catt

(Make sure that this is executed after changing the configuration)

Step 3. Now you can make an automation like this (this launches the cast every 10 minutes as the cast is removed on the hub every 10 minutes):

- id: '1589529246400'
  alias: CastToHub
  description: ''
  trigger:
  - minutes: /10
    platform: time_pattern
  condition: []
  action:
  - data:
      addon: a0d7b954_ssh
      input: catt -d "Living Room display" cast_site http://192.168.178.87:8123/lovelace-test/0
    service: hassio.addon_stdin

What this final step does is execute the CATT command within the ssh terminal add on.

This all took me the better part of the day to figure out, so hope it helps some other people. This solution does not require any fiddeling with SSH keys or passwords. Just works straight away.

Edit:
Some additional posts with more info that I created after this one:
If you have problems with logging in on your hub see: Using CATT
To remove the beep every 10 minutes see: Using CATT

24 Likes

@john2014
nice found!! Gonna try this!
Thanks you!

Node red node:

[{"id":"1853134d.36e4cd","type":"api-call-service","z":"55510aaf.99a934","name":"start catt","server":"b1cbd3a7.1bc87","version":1,"debugenabled":true,"service_domain":"hassio","service":"addon_stdin","entityId":"","data":"{  \"addon\": \"a0d7b954_ssh\",     \"input\": \"catt -d display cast_site http://192.168.1.x:y/lovelace/test\" }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":288.5,"y":46,"wires":[[]]},{"id":"b1cbd3a7.1bc87","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
2 Likes

Btw I noticed that the cast every 10 minutes will also interrupt any media that might be playing. So now i created a scriptfile that I run instead of the single CATT command. The script will check if anything is playing on the Google Hub. So in the automation I now call /config/cast.sh which contains:

if  ! catt -d "Living Room display" status | grep 'PLAYING' ; then 
     catt -d "Living Room display" cast_site http://192.168.178.87:8123/lovelace-test/0
fi

Note: I put the cast.sh file in the config folder so that it will remain there after a complete reboot.

4 Likes

Thanks for sharing this script and your earlier post with the explanation how to install catt on the SSH addon. Really great stuff.

I made a script for it with the following config:

# Start CATT on Nest Hub Kitchen
catt_nest_hub_kitchen:
  sequence:
    - service: hassio.addon_stdin
      data:
        addon: a0d7b954_ssh
        input: "/config/scripts/catt_hub_kitchen.sh"

That wouldn’t start though and I got error open terminal failed: not a terminal and found this issue which describes a fix for it → .sh-Files are not executed after Update · Issue #113 · hassio-addons/addon-ssh · GitHub.
Maybe this will help someone else as well :grin:

2 Likes

Nice that its working. I did not have the problem myself that you mention.

I am quite happy how it turned out. By using https://github.com/maykar/custom-header it also makes it look really nice on the Google Hub. This is my current display.

1 Like

Hi Guys,

I’m using Catt on a google nest hub. I’m also using the calendar Lovelace card. But is won’t load on the hub. it works fine on the app, website of when using the build in cast function of HA.

Anybody any idea??

401 seems to indicate “401: Invalid Credentials” are you sure you are casting the same page as you are looking at on other devices?

I myself am using https://github.com/marksie1988/atomic-calendar-revive to show the calendar on the google hub, perhaps that one works for you also.

I tried that already but when I use atomic my calendar looks strange. Atomic puts all the items in my agenda on all day. I use the iCloud Caldav integration

The strange thing is that It still works when using the build in cast function

Hi all, when I try run this I my Home Hub shows the “Force Loading” message others have reported and doesn’t load if I have SSL configured for Hassio. If I disable the SSL certs for my Home Assistance instance to allow straight http traffic, things work. SSL certs are privately generated ones using OpenSSL for use within my network rather than being via lets-encrypt or anything like that.

Currently using HASSIO with the SSH Add-on as noted a few posts up.

Wondering if there’s any thing I need to do to make it work, ideally without needing to disable SSL? Unsure if using a public CA would help at all in this case? For my computers etc I can obviously set up devices to trust my own CA but that’s likely not the case for the Google Hub if that’s where the issue lies. Unsure if running CATT on a seperate PI could possibly help rather than my HASSIO setup?

Hi @Smigit

Just for my curiosity - why to use SSL internally (i assume home network) and not use Let’s encrypt cert?
This is not answer for Your question but my setup is: Let’s encrypt certificate on router + Nginx. So external traffic goes via https and internal via http. CATT works as expected.

I guess just preference and avoiding web browser warnings, although no reason really for using OpenSSL over Lets Encrypt other than maybe at the time I picked one over the other as I didn’t need to open any network ports to generate the OpenSSL certs. I have a Nabu Casa subscription so in theory I can disable the https for internal traffic and use the Nabu Casa URL for external via https. Am keen to see if internal https is doable but I do have that fallback position if needed.

Until now I’ve been using Cast which does allow me to retain the https too. Sort of like that CATT let’s me present an entire dashboard as opposed to a single view so multiple pages looks like it’ll be simpler.

I also had the forced loading issues when trying to fiddle with SSL. In the end I just stopped with the SSL as I only use it internally. By using trusted networks, the connection with the hub is straight forward.

homeassistant:
  auth_providers:
    - type: trusted_networks
      trusted_networks:
        - 192.168.178.0/24
1 Like

Ok looks like I got https working with this. CATT is setup in HASSIO as per John2014’s post above.

To deal with the cert issue I’ve assigned a registered (sub) domain to HA instead of using my old internal hostname of Hassio.local. That domain has an SSL cert assigned to it via Lets Encrypt (using the HA plugin to manage renewals). Google trusts that CA unlike my previously used privately signed certs. I’m using Cloudflare for DNS so Lets-Encrypt can renew via DNS APIs rather than me needing to open up any ports on my network.

The last step was to have the domain resolve to the internal IP. In my case since I only need to cast this internally I’ve set the (sub) domain name in Cloudflare to resolve to a local IP (10.0.0.X). That IP is obviously useless if I’m not on my own network, which is fine (I have Nabu Casa for external access). If I didn’t want to mess around with the hosting DNS I imagine I could also just reroute the domain on my own networks DNS server (PiHole) to the IP and then block the Home Hub from using Google’s DNS (8.8.8.8 and 8.8.4.4, given it uses Googles by default and would bypass my pinhole instance), so that the Google Hub would fail back to my DNS server and then would use the correct IP address. Either way there’s a hostname with an SSL cert resolving to my HA instance.

Note I have no plan to expose my HA instance via the domain I registered externally. If you did that then the previous paragraph would need to change so that an internal IP wasn’t set for the domain to resolve to.

A bit of a hack but happy enough with it. Now hopefully Google fixes that 10 minute cast timeout.

edit: One thing that isn’t working is calendar data. Unsure why but it doesn’t appear to be related to a specific add-on but rather something to do with retrieving calendar data from HA. Even the HA calendar pane that’s built in shows no events when the above is in effect. Add-ons load but can’t retrieve anything. Odd.

2 Likes

hi, i’m try to start catt to cast my lovelace on the google nest hub , but impossible with your node red flow…
here is the data :
{
“addon”: “a0d7b954_ssh”,
“input”: “catt -d ‘Chambre Parents’ cast_site http://192.168.100.76:8123/lovelace/0
}

maybee i made a mistake?
i’m also trying with shell command but same issue :

here is the shell command :

cast_accueil: catt -d 'Chambre Parents' cast_site http://192.168.100.76:8123/lovelace/0

when i try in ssh there is no problem :

bin $ catt -d 'Chambre Parents' cast_site http://192.168.100.76:8123/lovelace/0
Casting http://192.168.100.76:8123/lovelace/0 on "Chambre Parents"...

thank you for reply