CATT show Domoticz on Google Hub

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.

Moderator: leecollings

Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

CATT show Domoticz on Google Hub

Post by Droid »

Hi there,

Im new here, and hope Im in the right place for my problem.

I've got a Synology DS214play with Domoticz on that.
I would like to show the dashboard on my Google Hub.

So I've installed CATT and made this script:

Code: Select all

#!/bin/bash
/volume1/@appstore/python3/bin/catt cast_site http://192.168.178.200:8084  &
exit 0
When I executed it on the command line, it works.
Also this is what the permissions look like:

Code: Select all

drwxr-xr-x  2 domoticz root 4.0K May 29 22:27 .
drwxr-xr-x 10 domoticz root 4.0K May 30 10:21 ..
-rwxrwxrwx  1 domoticz root   96 May 30 16:56 cast_tohubje.sh
In Domoticz, I've created a Dummy switch, which executes the script

Code: Select all

script://trscripts/cast_tohubje.sh
Or (also tried)

Code: Select all

script:///usr/local/domoticz/var/scripts/trscripts/cast_tohubje.sh
Looking at the Domoticz log I see the script is executed:

Code: Select all

 2020-05-30 16:56:54.733 (Virtuele knop) Light/Switch (Virtuele knop)
2020-05-30 16:56:54.703 Status: User: Admin initiated a switch command (1/Virtuele knop/On)
2020-05-30 16:56:54.932 Status: Executing script: /usr/local/domoticz/var/scripts/trscripts/cast_tohubje.sh 
However, Domoticz doesn't appear on the Hub...
Anyone a suggestion on how to solve this?
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

Hi,

Quick guess and let's try.

Modify your bash script as follows:|

Code: Select all

#!/bin/sh
cd /usr/local/domoticz/var/scripts/trscripts
/volume1/@appstore/python3/bin/catt cast_site http://192.168.178.200:8084 > /dev/null 2>&1 &
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/controller.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") controller | tee -a $LOGFILE
A log file will be created and check that log file.
Check the path where the logfile should be written, currently /home.

Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

Hi FireWizard,

Thanks for the reply, the logfile shows this:

Code: Select all

2020-05-30 21:25:43 controller
2020-05-30 21:26:17 controller
2020-05-30 21:26:20 controller
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

Hi
@Droid

This means that the script has been executed, 3 times.

But has something happened on your Google Nest Hub?

Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

No, that's the problem... nothing happens
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

Hi,
@Droid

(Not) Okay.

If you run this script manually?
Is there anything displayed?

Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

Yes, running it from the command line executes the script as it should. The webpage is then shown on the Hub
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

Hi,

@Droid

A script activated from a virtual swirch/button i a real pain in the a$$.

See my post at: https://www.domoticz.com/forum/viewtopi ... 07#p231907

There are many similar posts on this forum.

However maybe you can try an intermediate script as follows.

Create a script that cast the Domoticz page in e.g, your home directory and use full path.
Create the "On" script in your scripts directory and this one should activate the other script.
Create also a cast stop script.

Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

Hi FireWizard,

If the 2nd file is called by the first, it then isnt executed as root?
Im no expert on this, so could you help me in the right direction? What would those two files look like?
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

Hi,

@droid.

We have to make 2 files, located in /usr/local/domoticz/var/scripts (not in trscripts)
The name is up to you, but in this example I shall use catt_on.sh and catt_off.sh

The contents of catt_on.sh will be:

Code: Select all

#!/bin/sh
cd /home
/home/cast_site_on.sh
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/cast_site_on.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") cast_site_on | tee -a $LOGFILE
and for catt_off.sh

Code: Select all

#!/bin/sh
cd /home
/home/cast_site_off.sh
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/cast_site_off.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") cast_site_off | tee -a $LOGFILE
For the moment I have made it in such a way that the final script is located in /home.
You can change that, but adapt it also in catt_on.sh and catt_off.sh

make the files owned by root: chown root:root catt_on.sh and chown root:root catt_off.sh
Make it executable chmod +x catt_on.sh and chmod +x catt_off.sh

The file cast_site_on.sh contains the following:

Code: Select all

#!/bin/sh
/volume1/@appstore/python3/bin/catt cast_site http://192.168.178.200:8084/#/Dashboard >/dev/null &
and for cast_site_off.sh

Code: Select all

#!/bin/sh
/volume1/@appstore/python3/bin/catt stop  >/dev/null &
This files can be owned by the user but should be executable as well.
Try this and look at the log files created.

Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

Okay, followed the instructions:



/home/cast_on.sh

Code: Select all

-rwxr-xr-x  1 root root   97 May 31 21:45 cast_on.sh

Code: Select all

#!/bin/sh
/volume1/@appstore/python3/bin/catt cast_site http://192.168.178.200:8084 >/dev/null &
/usr/local/domoticz/var/scripts/trigger_cast_on.sh

Code: Select all

-rwxr-xr-x  1 domoticz root  177 May 31 21:50 trigger_cast_on.sh

Code: Select all

#!/bin/sh
cd /home
/home/cast_on.sh
NOW=$(date +"%Y-%m-%d")
LOGFILE=/usr/local/domoticz/var/scripts/cast_on.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") cast on | tee -a $LOGFILE
Log file

Code: Select all

2020-05-31 21:50:19 cast on
2020-05-31 21:50:50 cast on
2020-05-31 21:52:12 cast on
Domoticz log

Code: Select all

 2020-05-31 21:50:50.395 (Virtuele knop) Light/Switch (Virtuele knop)
2020-05-31 21:50:50.366 Status: User: Admin initiated a switch command (1/Virtuele knop/On)
2020-05-31 21:50:50.605 Status: Executing script: /usr/local/domoticz/var/scripts/trigger_cast_on.sh 
Problem remains the same, works when executed from the command line.
In Domoticz... nothing...
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

@droid

Can you check the ownership of the created log file, both when you try to run it from the command line and from Domoticz.

If you run from the command line cast_on.sh (and cast_off.sh) is then the Dashboard shown on your Google Nest Hub and removed if you run cast_off.sh?

Can you also add the log lines to the file cast_site_on,sh and cast_ste_off,sh and see if that script is executed when invoked from Domoticz.

Code: Select all

#!/bin/sh
/volume1/@appstore/python3/bin/catt cast_site http://192.168.178.200:8084/#/Dashboard >/dev/null &
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/cast_site_on.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") cast_site_on | tee -a $LOGFILE
and

Code: Select all

#!/bin/sh
/volume1/@appstore/python3/bin/catt stop >/dev/null &
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/cast_site_off.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") cast_site_off | tee -a $LOGFILE
So all 4 files has the 3 log lines and check which script is carried out and which is not carried out, when invoked from Domoticz.

Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

Did that, here the results

All logfiles are created by root...

Code: Select all

2020-05-31 22:38:02.308 (Virtuele knop) Light/Switch (Virtuele knop)
2020-05-31 22:38:02.282 Status: User: Admin initiated a switch command (1/Virtuele knop/On)
2020-05-31 22:38:02.542 Status: Executing script: /usr/local/domoticz/var/scripts/trigger_cast_on.sh
2020-05-31 22:38:13.134 (Virtuele knop) Light/Switch (Virtuele knop)
2020-05-31 22:38:13.059 Status: User: Admin initiated a switch command (1/Virtuele knop/Off)
2020-05-31 22:38:13.353 Status: Executing script: /usr/local/domoticz/var/scripts/trigger_cast_off.sh 

Code: Select all

/usr/local/domoticz/var/scripts

-rw-r--r--  1 root     root   29 May 31 22:38 trigger_cast_off.2020-05-31.log
-rwxr-xr-x  1 domoticz root  188 May 31 22:36 trigger_cast_off.sh
-rw-r--r--  1 root     root   28 May 31 22:38 trigger_cast_on.2020-05-31.log
-rwxr-xr-x  1 domoticz root  185 May 31 22:36 trigger_cast_on.sh

Code: Select all

/home

-rw-r--r--  1 root root   29 May 31 22:38 cast_off.2020-05-31.log
-rwxr-xr-x  1 root root  181 May 31 22:34 cast_off.sh
-rw-r--r--  1 root root   28 May 31 22:38 cast_on.2020-05-31.log
-rwxr-xr-x  1 root root  212 May 31 22:33 cast_on.sh
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

Hi,

@Droid
If you run from the command line cast_on.sh (and cast_off.sh) is then the Dashboard shown on your Google Nest Hub and removed if you run cast_off.sh?
Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

Yes, running it from te commandline shows the dashboard and hides it
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

@Droid,

Can you add in each script a last line with exit $.
So we can see what the exit code is.

Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

Hi FireWizard,

Adding that to each file, and then running the trigger files from the command line results in:

Code: Select all

root@_____:/usr/local/domoticz/var/scripts# bash trigger_cast_on.sh
2020-06-01 08:40:04 cast_on
/home/cast_on.sh: line 6: exit: $: numeric argument required
2020-06-01 08:40:04 cast on
trigger_cast_on.sh: line 7: exit: $: numeric argument required
root@____:/usr/local/domoticz/var/scripts# bash trigger_cast_off.sh
2020-06-01 08:40:07 cast_off
/home/cast_off.sh: line 6: exit: $: numeric argument required
2020-06-01 08:40:07 cast off
trigger_cast_off.sh: line 7: exit: $: numeric argument required
Here the whole scripts of both trigger files

Code: Select all

#!/bin/sh
cd /home
/home/cast_on.sh
NOW=$(date +"%Y-%m-%d")
LOGFILE=/usr/local/domoticz/var/scripts/trigger_cast_on.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") cast on | tee -a $LOGFILE
exit $


#!/bin/sh
cd /home
/home/cast_off.sh
NOW=$(date +"%Y-%m-%d")
LOGFILE=/usr/local/domoticz/var/scripts/trigger_cast_off.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") cast off | tee -a $LOGFILE
exit $
Looks to me that the error is because of the last line (line 6 on cast_on.sh and cast_off.sh / line 7 on the trigger files)
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

Hi,

@Droid,

Change all last lines in the scripts from "exit $" to "exit $?".

This causing the error.

Regards
Droid
Posts: 19
Joined: Saturday 30 May 2020 16:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: CATT show Domoticz on Google Hub

Post by Droid »

Changed it,

running it from Command line:

Code: Select all

root@___:/usr/local/domoticz/var/scripts# bash trigger_cast_on.sh
2020-06-01 15:36:44 cast on
root@___:/usr/local/domoticz/var/scripts# bash trigger_cast_off.sh
2020-06-01 15:36:52 cast off
No special error or message. Does however work.

Running it from Domoticz... no luck there. The log file says this:

Code: Select all

 2020-06-01 15:38:23.533 (Virtuele knop) Light/Switch (Virtuele knop)
2020-06-01 15:38:23.523 Status: User: Admin initiated a switch command (1/Virtuele knop/On)
2020-06-01 15:38:23.772 Status: Executing script: /usr/local/domoticz/var/scripts/trigger_cast_on.sh
2020-06-01 15:38:32.385 (Virtuele knop) Light/Switch (Virtuele knop)
2020-06-01 15:38:32.361 Status: User: Admin initiated a switch command (1/Virtuele knop/Off)
2020-06-01 15:38:32.587 Status: Executing script: /usr/local/domoticz/var/scripts/trigger_cast_off.sh 

This is making me crazy :/
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: CATT show Domoticz on Google Hub

Post by FireWizard »

@Droid,

What is the output of the other script files, when run from Domoticz?
(/home/cast_on.sh and /home/cast_off.sh)

I said, it is a pain in the a$$, to get the scripts running from Domoticz.
I tried it with CATT as well, but I left it. See: https://www.domoticz.com/forum/viewtopi ... 07#p231907

What happens if you try to run the scripts as root user? Use sudo /home/cast_on.sh or sudo /home/cast_off.sh).

You haven't something installed as node red?

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests