Page 3 of 7

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Thursday 20 June 2019 2:43
by GieBek
Hi, the plugin works great.

I have a question. What command to play new music, e.g. TuneIn or Spotify?

I use this script but if I ask a question to Google, the music will not turn on again when motion in the detector occurs.

Code: Select all


return {
	on = {
		devices = {'Salon - Sensor'}, -- Change out PIR
	},
   
   execute = function(dz, PIR)
        local Radio = dz.devices('Google - Salon Playing') -- Change out light
        local Volume = dz.devices('Google - Salon Volume')
             
        local dimTimeTable  = { --  [   'timeSlot'   ]  = volume
                                    ['at 00:00-08:00']  = 5,
                                    ['at 08:01-09:59']  = 18,
                                    ['at 10:00-21:00']  = 24,
                                    ['at 21:01-23:59']  = 13,
                              }
                              
        if PIR.state ~= 'On' then 
            Radio.switchOff().afterMin(1)
        else
            for timeSlot, volume in pairs (dimTimeTable) do
               if dz.time.matchesRule(timeSlot) and Radio.state == 'Off' then
                        Volume.dimTo(volume-12)
                        Radio.switchOn()
                        Volume.dimTo(volume-10).afterSec(2)
                        Volume.dimTo(volume-8).afterSec(4)
                        Volume.dimTo(volume-6).afterSec(6)
                        Volume.dimTo(volume-4).afterSec(8)
                        Volume.dimTo(volume-2).afterSec(10)
                        Volume.dimTo(volume-1).afterSec(11)
                        Volume.dimTo(volume).afterSec(12)
                        return false
                end
            end
        end
    end
}

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Thursday 18 July 2019 14:39
by wvries
Hi,

I had the plugin working like a charm for several weeks / months.
With updating Domoticz to the latest release it seems there is a problem introduced.
The plugin does not connect anymore to any of the devices.

running latest version of Domoticz (11020), updates pychromecast and gtss with pip3 upgrade and running latest version of the plugin.
Hardware = RPI3B+ running Stretch on a USB SSD.

Following plugins installed:
Screenshot 2019-07-18 at 14.42.46.png
Screenshot 2019-07-18 at 14.42.46.png (69.68 KiB) Viewed 4100 times
Screenshot Google plugin:
Screenshot 2019-07-18 at 14.34.21.png
Screenshot 2019-07-18 at 14.34.21.png (181.88 KiB) Viewed 4101 times
This is my logfile (Python debugging enabled):
Logfile.txt
(18.58 KiB) Downloaded 120 times
Tried soft and hard reboots, no luck so far.

Also getting sometimes the following error:" Error: CConnection_disconnect, disconnection request from 'Google Home' ignored. Transport does not exist."

Any ideas ??

UPDATE !!!!

Disabled WLAN on the RPI and errors are gone.
Enabled WLAN again, problems occur again.

Seems the IP transport layer has some effect on it.

Will keep WLAN disabled, as I do not need it anyway.

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Monday 11 November 2019 22:41
by ricorico94
Hi,

I tried to install this plugin, but I can't uderstand how it should work..
I installed following the few commands described on github, then I created the Hardware entry and I found that it had discovered 9 devices, 3 for a google Home Mini, 3 for a Sony amplifier and 3 for my "freebox fmini" which is a French setop box of my ISP (which also hosts a chromecast app).
(by the way, after having created these devices, I modified the name of the hardware in the hardware menu -> is it an issue ? I simply mdofied the name in the hardware menu and clicked on "modify" button, but the devices in devices menu kept the old name of hardware. Is it normal ?)

For instance, for my google home mini, I now see 3 switches: a "google Mini Status", a "google home mini Volume " and a "Google Mini Playing".
Same thing for my SONY amplifier: for that one I cold notice that volume device is chaning when I modify the volume of amplifier.. so that's good ! but the other switches don't change : they remain "off" (status=sleeping and Playing=Off)
I can see error messages in the log:

Code: Select all

2019-11-11 22:28:24.462 Status: (Chromecast-HW) Freebox Player Mini v2 is now: ConnectionStatus(status='LOST', address=NetworkAddress(address='192.168.0.24', port=8009))
2019-11-11 22:28:24.527 Status: (Chromecast-HW) Freebox Player Mini v2 is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='192.168.0.24', port=8009))
2019-11-11 22:28:24.531 Status: (Chromecast-HW) Freebox Player Mini v2 is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='192.168.0.24', port=8009))
2019-11-11 22:28:29.565 (Chromecast-HW) [Chromecast - Freebox Player Mini v2 Status] Update 9(9):'Screensaver'(Screensaver): 0(1)
2019-11-11 22:28:29.585 (Chromecast-HW) [Chromecast - Freebox Player Mini v2 Volume] Update 2(2):'16'(16): 0(1)
2019-11-11 22:28:29.610 (Chromecast-HW) [Chromecast - Freebox Player Mini v2 Playing] Update 0(0):''(): 0(1)
2019-11-11 22:28:29.538 Status: (Chromecast-HW) Freebox Player Mini v2 is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='192.168.0.24', port=8009))
2019-11-11 22:28:29.564 Status: (Chromecast-HW) Freebox Player Mini v2 is now: ConnectionStatus(status='CONNECTED', address=NetworkAddress(address='192.168.0.24', port=8009))
Is it normal ?

Also, my target would be to be able to make my Google Home Mini "speak" with various TTS depending on various events. I tried adding in that switch a notification and a text in its field, then pushing on the button but nothing happened. So I guess I do'nt do things properly.
- I read on this forum a mention related to installation of TTS. What should I do to enable TTS on my domoticz installation ? Anything more than the "sudo pip3 install gtts" ? Isn't it google home mini doing the job of translating text to speech instead of domoticz ?
- in domoticz, "settings" menu and "notifications" submenu, should I enable the "Google Cloud Messaging" ? I tried it and clicked on "test", but nothing happened..
- then I do'nt understand how notifications work : based on what I could read, notifications in switches are pre-defined and atatched to a status of that switch. For instance, in my google mini switch, I only see 3 "types" (switch on, switch off and Pause stream). So how can we trigger a google mini for saying whatever text message a script might define ?

Thanks a lot for your help,
ricorico94

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Wednesday 13 November 2019 18:27
by ricorico94
bonjour.. plus de réponse sur ce post... Personne n'utilise plus ce plugin ? Y en-t-a-il un mieux ?

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Sunday 29 December 2019 0:38
by Mooky
ricorico94 wrote: Monday 11 November 2019 22:41 - I read on this forum a mention related to installation of TTS. What should I do to enable TTS on my domoticz installation ? Anything more than the "sudo pip3 install gtts" ? Isn't it google home mini doing the job of translating text to speech instead of domoticz ?
- in domoticz, "settings" menu and "notifications" submenu, should I enable the "Google Cloud Messaging" ? I tried it and clicked on "test", but nothing happened..
- then I do'nt understand how notifications work : based on what I could read, notifications in switches are pre-defined and atatched to a status of that switch. For instance, in my google mini switch, I only see 3 "types" (switch on, switch off and Pause stream). So how can we trigger a google mini for saying whatever text message a script might define ?
- For TTS, you use the chromecast function of the google home - It doesn't have built-in TTS. So basically you stream an MP3 to it. That's why you need gtts (and that's all) : to make an MP3 out of your text.
- Google Cloud Messaging has nothing to do with this plugin
- My Google home name (as defined in the home app) is "Google Home Salon". Activating the plugin, it created me 3 devices "GoogleDevices - Google Home Salon Playing", "GoogleDevices - Google Home Salon Volume", "GoogleDevices - Google Home Salon Status". I added the device "GoogleDevices - Google Home Salon Playing" renaming it "Google Home Salon". Then in my lua script :

Code: Select all

commandArray['Google Home Salon'] = "SendNotification bonjour"
... and voilà

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Sunday 29 December 2019 14:02
by Mooky
By digging into the forum, I found an undocumented way which is simpler and more like the usual notification system : using the format

Code: Select all

commandArray['SendNotification']='subject#body#priority#sound#extradata#subsystem'
So this also works :

Code: Select all

commandArray['SendNotification']="#Bonjour####Google_Devices"

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Sunday 29 December 2019 19:59
by TiXav
Hello dnpwwo,

This works very well ! (I installed Chromecast and google home mini for Christmas)

Just a little question because I see this in your code

Code: Select all

line 421 : mc.play_media("http://"+ipAddress+":"+ipPort+"/"+uuid+".mp3", 'audio/mp3')
this means google mini comes read the file to the domoticz web folder

-> Is it possible via lua or another way to define a file to play(a normal MP3 file) to avoid to translate textTOmp3 each time and also to play a doorbell mp3 file.

Really impressed of all yours codes

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Monday 06 January 2020 17:05
by timeclypse
I installed the plugin and it recognizes the google devices (Chromecast and Google Home) nicely, but, i refuses to connect. I can't figure out what the problem is. The only thing i can find in the log is:

Code: Select all

2020-01-06 17:02:16.827 Status: (Google Home) Woonkamer is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[xxxxxxxxxxxx]=120/119,192.168.2.10', port=8009))
2020-01-06 17:02:16.850 Status: (Google Home) Chromecast is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[xxxxxxxxxxxx]=120/119,192.168.2.12', port=8009))
2020-01-06 17:02:21.832 Status: (Google Home) Woonkamer is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[xxxxxxxxxxxx]=120/119,192.168.2.10', port=8009))
2020-01-06 17:02:21.856 Status: (Google Home) Chromecast is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[xxxxxxxxxxxx]=120/119,192.168.2.12', port=8009))
2020-01-06 17:02:31.859 Status: (Google Home) Woonkamer is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[xxxxxxxxxxxx]=120/119,192.168.2.10', port=8009))
2020-01-06 17:02:31.876 Status: (Google Home) Chromecast is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='recordxxxxxxxxxxxx]=120/119,192.168.2.12', port=8009))
Anyone a clue where to start looking?

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Monday 06 January 2020 21:37
by Dnpwwo
The 'addess looks strange, mine just looks like a standard IPv4 address:

Code: Select all

2020-01-07 07:36:04.350 Status: (Google Media Devices) Downstairs Speakers is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='192.168.0.74', port=42925))

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Monday 06 January 2020 22:06
by EdwinK
timeclypse wrote: Monday 06 January 2020 17:05 I installed the plugin and it recognizes the google devices (Chromecast and Google Home) nicely, but, i refuses to connect. I can't figure out what the problem is. The only thing i can find in the log is:

Code: Select all

2020-01-06 17:02:16.827 Status: (Google Home) Woonkamer is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[xxxxxxxxxxxx]=120/119,192.168.2.10', port=8009))
Anyone a clue where to start looking?
I see the same

Code: Select all

2020-01-06 22:04:58.877 Status: (Google Stuff) Cast huiskamer is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,4c567382-4190-6109-6013-e377b2be29ff.local.]=120/119,192.168.0.109', port=8009))
2020-01-06 22:04:58.878 Status: (Google Stuff) Mini slaapkamer is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,aac0e5b9-287d-4649-b58c-6f2dc684775e.local.]=120/119,192.168.0.141', port=8009))
2020-01-06 22:04:58.878 Status: (Google Stuff) Cast huiskamer is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,4c567382-4190-6109-6013-e377b2be29ff.local.]=120/119,192.168.0.109', port=8009))
2020-01-06 22:04:58.879 Status: (Google Stuff) Mini slaapkamer is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,aac0e5b9-287d-4649-b58c-6f2dc684775e.local.]=120/119,192.168.0.141', port=8009))
2020-01-06 22:04:58.880 Status: (Google Stuff) Nest huiskamer is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,7fc2d82e-e093-d280-049c-5e07487491dd.local.]=120/119,192.168.0.7', port=8009))
2020-01-06 22:04:58.884 Status: (Google Stuff) Nest huiskamer is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,7fc2d82e-e093-d280-049c-5e07487491dd.local.]=120/119,192.168.0.7', port=8009))
2020-01-06 22:04:59.869 Status: (Google Stuff) Cast 2 is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,40da0405-c7fa-c66e-4ceb-8c2237bf6298.local.]=120/119,192.168.0.142', port=8009))
2020-01-06 22:04:59.870 Status: (Google Stuff) Cast 2 is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,40da0405-c7fa-c66e-4ceb-8c2237bf6298.local.]=120/119,192.168.0.142', port=8009))

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Tuesday 07 January 2020 13:10
by timeclypse
EdwinK wrote: Monday 06 January 2020 22:06 I see the same
I see that your status is FAILED as well, also in the status of Dnpwwo.

Is it working on your Domoticz, despite the status? Or are you facing the same issues?

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Tuesday 07 January 2020 13:27
by timeclypse
timeclypse wrote: Tuesday 07 January 2020 13:10
EdwinK wrote: Monday 06 January 2020 22:06 I see the same
I see that your status is FAILED as well, also in the status of Dnpwwo.

Is it working on your Domoticz, despite the status? Or are you facing the same issues?
UPDATE
It happens because of the latest release of the zeroconf dependency. Version 0.24.4 - released 30th of December - has issues apparently.

The previous version (0.24.3) works.

I installed 0.24.3 (pip3 install zeroconf==0.24.3) and now it's CONNECTED. The IP-address looks normal now too.

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Tuesday 07 January 2020 13:54
by tjabas
i have also installed this plugin, but i get alot of error messages, alot of connection failed:

2020-01-07 17:02:54.389 Status: (Google) ChromeCast is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,ae7b73d5-f074-a67e-1387-2b4922e591f5.local.]=120/119,192.168.1.49', port=8009))
2020-01-07 17:02:54.390 Status: (Google) Sovrum is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,4edc967e-1601-daf3-b3f3-ce77f0c1215c.local.]=120/119,192.168.1.97', port=8009))
2020-01-07 17:02:54.391 Status: (Google) Vardagsrum is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,ccfbbec1-5601-5e0f-b75c-ccca6708b665.local.]=120/119,192.168.1.78', port=8009))
2020-01-07 17:02:54.392 Status: (Google) Fiskhuset is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,052cecb8-e1fa-bad6-9daf-de401fd1585a.local.]=120/119,192.168.1.106', port=8009))
2020-01-07 17:02:54.393 Status: (Google) Gustavs rum is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,12fce734-735f-4e02-8663-7fe1e38b2c02.local.]=120/119,192.168.1.94', port=8009))
2020-01-07 17:02:54.394 Status: (Google) Garage is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,1a7c5e15-e7c3-7871-da1c-358309933e2c.local.]=120/119,192.168.1.243', port=8009))
2020-01-07 17:02:54.394 Status: (Google) Spotify is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,ccfbbec1-5601-5e0f-b75c-ccca6708b665.local.]=120/119,192.168.1.78', port=42325))
2020-01-07 17:02:54.395 Status: (Google) ChromeCast is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,ae7b73d5-f074-a67e-1387-2b4922e591f5.local.]=120/119,192.168.1.49', port=8009))
2020-01-07 17:02:54.395 Status: (Google) Sovrum is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,4edc967e-1601-daf3-b3f3-ce77f0c1215c.local.]=120/119,192.168.1.97', port=8009))
2020-01-07 17:02:54.397 Status: (Google) Vardagsrum is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,ccfbbec1-5601-5e0f-b75c-ccca6708b665.local.]=120/119,192.168.1.78', port=8009))
2020-01-07 17:02:54.397 Status: (Google) Fiskhuset is now: ConnectionStatus(status='FAILED', address=NetworkAddress(address='record[a,in-unique,052cecb8-e1fa-bad6-9daf-de401fd1585a.local.]=120/119,192.168.1.106', port=8009))
2020-01-07 17:02:54.480 Status: (Google) Kök is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,45649901-ed82-f9bb-1074-8cf671d827bd.local.]=120/119,192.168.1.79', port=8009))

in which folder do i install the zeroconf==0.24.3?

and do i need to delete the zeroconf==0.24.4 version ?

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Tuesday 07 January 2020 17:53
by tjabas
timeclypse wrote: Tuesday 07 January 2020 13:27
timeclypse wrote: Tuesday 07 January 2020 13:10
EdwinK wrote: Monday 06 January 2020 22:06 I see the same
I see that your status is FAILED as well, also in the status of Dnpwwo.

Is it working on your Domoticz, despite the status? Or are you facing the same issues?
UPDATE
It happens because of the latest release of the zeroconf dependency. Version 0.24.4 - released 30th of December - has issues apparently.

The previous version (0.24.3) works.

I installed 0.24.3 (pip3 install zeroconf==0.24.3) and now it's CONNECTED. The IP-address looks normal now too.
i have installed pip3 install zeroconf==0.24.3, but after i have done that domoticz chrashes, should i install zeroconf in domoticz/plugins?
and do i need to uninstall zeroconf 0.24.4 first?

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Wednesday 08 January 2020 6:55
by tjabas
Anyone?

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Thursday 09 January 2020 10:17
by EdwinK
timeclypse wrote: Tuesday 07 January 2020 13:27 [The previous version (0.24.3) works.

I installed 0.24.3 (pip3 install zeroconf==0.24.3) and now it's CONNECTED. The IP-address looks normal now too.

Unfortunately, this didn't work for me :(
2020-01-09 10:16:30.190 Status: (Google Stuff) Cast huiskamer is now: ConnectionStatus(status='CONNECTING', address=NetworkAddress(address='record[a,in-unique,4c567382-4190-6109-6013-e377b2be29ff.local.]=120/119,192.168.0.109', port=8009))

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Thursday 09 January 2020 10:19
by EdwinK
timeclypse wrote: Tuesday 07 January 2020 13:10
EdwinK wrote: Monday 06 January 2020 22:06 I see the same
I see that your status is FAILED as well, also in the status of Dnpwwo.

Is it working on your Domoticz, despite the status? Or are you facing the same issues?
Nope. Facing the same issues.

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Monday 13 January 2020 10:57
by Dnpwwo
I'm running zeroconf 0.23.0 because it was current at the time I wrote the plugin.

I do see the odd flurry of CONNECTING....FAILED....CONNECTING.... messages but only for groups of devices that I've created ('Downstairs Speakers' for exampe), never for 'real' devices. Seems like around once an hour the devices in the group do a little dance to decide who is the 'primary'.

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Monday 13 January 2020 12:19
by DewGew
I have same issues as above. The pluging run good for about an hour then it craches domoticz.
I use latest domoticz beta and buster with python 3.7.3 ,zeroconf 0.23.0

Re: Python Plugin: Domoticz-Google-Plugin

Posted: Monday 13 January 2020 16:58
by timeclypse
DewGew wrote: Monday 13 January 2020 12:19 I have same issues as above. The pluging run good for about an hour then it craches domoticz.
I use latest domoticz beta and buster with python 3.7.3 ,zeroconf 0.23.0
That is weird, i did not have any issues afterwards. Could it be your Python version? In the info it states:
Python version 3.4 or higher required & a 2019 version of Domoticz (for voice to work). On Python 3.6.x this plugin will crash Domoticz 10-20% of the time when the plugin is stopped or restarted. This appears related to a defect introduced in Python 3.6 that has been reported on the Internet.
I am on Python 3.5.1.