Using CATT

I’m running into issues with my automations now as well. As discussed earlier the ssh addon the hassio.addon_stdin service was removed, which was required for the automation.

But I have been running v8.2.4 for ages, so I don’t see why that would be my issue. But maybe some update was made on the HA core side of things to remove this functionality.

As with you works fine from command line, but not through automation calling hassio.addon_stdin.

Can anyone suggest a method to lock-down a CATT session ?

I have created a limited user and disallowed the user to see any other dashboards. However during the initialization of the CATT session the user can interrupt the process, log out of the limited account and log in with an admin account.

For what it’s worth, here is my watchdog to restart CATT when needed:

1 Like

Since i’m using duckdns , i have troubles casting dashboard using home assistant cast.
So i might be back into using catt.

It has been a couple of years, so i dont know anymore what to do.
Is this catt still working?
Or lots of troubles?
Since back in the old days, is there an addon yet? Or still need to do something with ssh addon?
Is there a howto somewhere?

@skank CATT is easier than it had been with the exception of needing a shell command to execute a bash command. Once it is done it is pretty good even with the 10 minute shutdown. If you have one of the updated V1 hubs then you may not have the 10 minute limit. Which is very good.

FYI I am using Nabu Casa. If you are not using NC you may need to access the hubs using RSA keys.

I will take a crack at getting you back up and running but no guarantees.

In my configuration.yaml, I declare a couple of shell commands:

# CATT
shell_command:
  updatecatt: bash updatecatt.sh
  cattkit: bash cast_kit.sh

Reboot after adding these to the configuration.yaml.

The contents of the 2 files updatecatt.sh and cast_kit.sh:

updatecatt.sh contains this one line:\

pip install catt --upgrade

cast_kit.sh contains the following lines: (but can be adjusted to suit)

#   catt -d 192.168.1.26 stop
#   catt -d 192.168.1.26 volume 50
   catt -d 192.168.1.26 cast_site http://192.168.1.110:8123/hubs-catt/kitchen

Next is the script

alias: CATT Kit
sequence:
  - service: shell_command.cattkit
    data: {}
mode: single

Next up, the events:
To initialize CATT on HA startup, first remove any old startup options to install pip3 CATT commands set in the SSH & Web Terminal. My first event I called CATT Init:

alias: CATT Init
description: 'Installs the latest version of CATT '
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: shell_command.updatecatt
    data: {}
mode: single

Next to run the actual CATT session this event calls

alias: CATT Kitchen
description: Restart Kitchen Catt 15 seconds after any interruption
trigger:
  - platform: state
    entity_id:
      - media_player.kitchen_display
    to: 'off'
    for:
      hours: 0
      minutes: 0
      seconds: 15
condition: []
action:
  - service: script.turn_on
    data: {}
    target:
      entity_id:
        - script.catt_kit
mode: single

Note there are a few bugaboos but generally does not need any restarter event as this event looks for the state of the hub to go OFF. When first powered up they do just that, so the session is initiated. The V2s that I have cycle every 10 minutes. My V1 is updated and does not need to restart every ten minutes. I have 6 hubs and I can tell you that these scripts work pretty well in general. But there are some instances where the hub will be showing a google picture but Dev Tools report Dashcast session active. This is a tough one to work around and I do not know where the problem lies but this happens infrequently.

Let me know how this works out for you.

3 Likes

After a few sleepless nights I think I have finally solved the 10 minutes timeout problem. Give it a try and let me know if it’s working:

2 Likes

Nice work. Seems to do what you claim and hasn’t skipped a beat since the install a few days ago.

1 Like

I’m completely stuck getting CATT working from shell command.

If I run my command direct from terminal it works
If I run my script from terminal it works

But a script to run the shell command fails with return code 127…

This may indicate that the shell cannot find the command you are trying to run. It’s best to use an absolute path. Relative paths must take the current working directory into account.

I’m running on an rpi. Is there a step by step on what needs to be setup?

I suspect this is related to the catt reinstall needed, but I’m seeing conflicting information.

My script uses /usr/bin/catt -d …
My shell_command is bash cast.sh

Do I need the install command in the ssh init commands config?

Do I need ssh keys?

Now that the timeout has been solved, you could even start DashCast directly:

https://stestagg.github.io/dashcast/

Just set “Force display” to Yes. It’s essentially what CATT does.

Without the timeout it will be very rarely needed to re-cast, mostly when the Cast display power cycles.

Is this in response to me? I can’t get home assistant to run catt from script at all

Yes, I’m saying that you might not necessarily need the script. You can cast manually with the web sender. CATT does the same thing but it is a command line utility, thus easy to use in automations. That was mainly needed because of the timeout. With the timeout gone, you can just start DashCast manually and forget about it (for me it’s been a little over a week now without needing to re-cast).

If you add this service to your HA installation, you can issue cast commands from automations and scripts without needing to use an SSH terminal and/or public/private keys:

3 Likes

Seems like this has matured with the solving of the timeout issues Super Thanks @swiergot for doing that. If I understand correctly alexxit has an HA repository to avoid all of the terminal stuff which was a bit of pain. Any chance to make an official integration or addon as it seems like viable alternative to home assistant cast.

On another note if the fix works how would I go about setting up an automation to recast say when my nest hub restarts itself which I think it does daily or after I have used it as a media player to listen to the news etc. Anybody figure those things out and can point me in the right direction. The 9 minute recast automation I used to have took place of those problems albeit sloppily

1 Like

I have installed the plugin, I have added scrypt but during execution it says: Failed to call script / test service. Unable to find service dash_cast.load_url. What may be the problem

The Dash Cast integration works perfectly and I can use it in automations. Super for casting Dwains Dashboard. Thanks a ton.

After installing it in HACS you will have to add it in Devices and Services as an integration, for it to work as a service.

Hi All,

Using catt directly from the webterminal works just fine

catt -d 'Google nest hub' cast_site https://xxxxxxx/lovelace-hub/0

result: afbeelding

However I want to be able to use this in automations, so I followed some tutorials here. I enabled SSH with a private key. Logging in this this in the webterminal also works fine:

ssh -o StrictHostKeyChecking=no -i /config/ssh/rsa_key [email protected]

result: afbeelding

However, If I try to combine both I get an error which seems to refer to the cast devices name:

ssh -o StrictHostKeyChecking=no -i /config/ssh/rsa_key [email protected] catt -d 'Google nest hub' cast_site https:/XXXXXXlovelace-hub/0

result:

The error log in Home assistant when trying this as a shell command:



Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/__init__.py:115
Integration: Shell Command (documentation, issues)
First occurred: 12:20:00 PM (4 occurrences)
Last logged: 12:40:00 PM

    Error running command: `ssh -o StrictHostKeyChecking=no -i /config/ssh/rsa_key [email protected] catt -d "='Google nest hub' cast_site https://XXXXXX/lovelace-hub/0`, return code: 2

NoneType: None

I tried both quote type "" and '' around the cast devices name, however both don’t seem to matter.

Anybody who can help out?

Hi @gertha,

this command is a bit off


ssh -o StrictHostKeyChecking=no -i /config/ssh/rsa_key [email protected] catt -d "='Google nest hub' cast_site https://XXXXXX/lovelace-hub/0

try


ssh -o StrictHostKeyChecking=no -i /config/ssh/rsa_key [email protected] catt -d "Google nest hub" cast_site https://XXXXXX/lovelace-hub/0