Domoticz-Google-Assistant
Domoticz-Google-Assistant copied to clipboard
DZGA Chromecast message not working on clean install
Describe the bug:
Clean install of Raspbian Buster, Domoticz and DZGA.
Restored Domoticz database and DZGA Config
Expected behavior:
Expected be able to send message to my Google Home Device by sending, for example: http://10.0.0.10:3030/say?De-wasmachine-is-klaar/nl
Logs: 2022-03-09 13:51:17 - INFO - Logs removed by user 2022-03-09 13:51:22 - DEBUG - text: De-wasmachine-is-klaar 2022-03-09 13:51:22 - DEBUG - tld: com 2022-03-09 13:51:22 - DEBUG - lang: nl 2022-03-09 13:51:22 - DEBUG - slow: False 2022-03-09 13:51:22 - DEBUG - lang_check: True 2022-03-09 13:51:22 - DEBUG - pre_processor_funcs: [<function tone_marks at 0x754ce588>, <function end_of_line at 0x754ce738>, <function abbreviations at 0x754ce858>, <function word_sub at 0x754cec48>] 2022-03-09 13:51:22 - DEBUG - tokenizer_func: <bound method Tokenizer.run of re.compile('(?<=\?).|(?<=!).|(?<=?).|(?<=!).|(?<!\.[a-z])\. |(?<!\.[a-z]), |(?<!\d):|;|\[|¿|。|‥|\)|,|—|\(|،|\]|¡|、|:|…|\\n', re.IGNORECASE) from: [<function tone_marks at 0x754cecd8>, <function period_comma at 0x754ced20>, <function colon at 0x754ced68>, <function other_punctuation at 0x754cedb0>]> 2022-03-09 13:51:22 - DEBUG - langs: {'af': 'Afrikaans', 'ar': 'Arabic', 'bg': 'Bulgarian', 'bn': 'Bengali', 'bs': 'Bosnian', 'ca': 'Catalan', 'cs': 'Czech', 'cy': 'Welsh', 'da': 'Danish', 'de': 'German', 'el': 'Greek', 'en': 'English', 'eo': 'Esperanto', 'es': 'Spanish', 'et': 'Estonian', 'fi': 'Finnish', 'fr': 'French', 'gu': 'Gujarati', 'hi': 'Hindi', 'hr': 'Croatian', 'hu': 'Hungarian', 'hy': 'Armenian', 'id': 'Indonesian', 'is': 'Icelandic', 'it': 'Italian', 'ja': 'Japanese', 'jw': 'Javanese', 'km': 'Khmer', 'kn': 'Kannada', 'ko': 'Korean', 'la': 'Latin', 'lv': 'Latvian', 'mk': 'Macedonian', 'ml': 'Malayalam', 'mr': 'Marathi', 'my': 'Myanmar (Burmese)', 'ne': 'Nepali', 'nl': 'Dutch', 'no': 'Norwegian', 'pl': 'Polish', 'pt': 'Portuguese', 'ro': 'Romanian', 'ru': 'Russian', 'si': 'Sinhala', 'sk': 'Slovak', 'sq': 'Albanian', 'sr': 'Serbian', 'su': 'Sundanese', 'sv': 'Swedish', 'sw': 'Swahili', 'ta': 'Tamil', 'te': 'Telugu', 'th': 'Thai', 'tl': 'Filipino', 'tr': 'Turkish', 'uk': 'Ukrainian', 'ur': 'Urdu', 'vi': 'Vietnamese', 'zh-CN': 'Chinese', 'zh-TW': 'Chinese (Mandarin/Taiwan)', 'zh': 'Chinese (Mandarin)'} 2022-03-09 13:51:22 - INFO - say command on 09/03/22 13:51:22, text : De-wasmachine-is-klaar, lang : nl
Desktop (please complete the following information):
- Domoticz version 2022.1 Stable
- Dzga version DZGA Version: 1.10.9 master
- Python Version Python 3.7.3
Smartphone (please complete the following information):
- Device: Google Home speaker
Additional context, screenshot:
Webbrowser says: Page not found!: name 'cast' is not defined
I had the same issue.
If you look higher in the logs, you'll see:
chromecasts init not succeeded, error : 'Chromecast' object has no attribute 'device'
This was caused because PyChromecast 10.0 dropped the device property.
I was able to create a workaround by running:
./Domoticz-Google-Assistant/env/bin/python -m pip install PyChromecast==9.1.2
Thanks you, however this does not fix my problem. I removed pychromecast (it was version 10) and installed 9.1.2, however still the same problem :(
Is there maybe a log entry with 'chromecasts init not succeeded, error' in your log file? If so, can you maybe post it?
Did you restart the dzga service after reinstalling PyChromecast?:
sudo systemctl restart dzga.service
And did you also installed version 9.1.2 of PyChromecast on the Python version on this location?:
./Domoticz-Google-Assistant/env/bin/python
So, like this:
./Domoticz-Google-Assistant/env/bin/python -m pip install PyChromecast==9.1.2
Instead of directly running this: pip install PyChromecast==9.1.2
I used pip install PyChromecast==9.1.2.
But if this is a know issue, why isn't is fixed ? Looks like development has stopped. Howver, the Google Smart Home Integration works great.
So i decied to look for another solution since the auto genereated voices aren't great (In Dutch). I used https://texttospeechrobot.com/ to generate some mp3 files and hosting them internally with lighttpd. The voices form here are generated by a much better TTS engine (Looks like it's from IBM).
Then i installed latest PyChromecast and used this Pyton script to send them to my Chromecast from Domoticz. Works also great and keeps things simple. It is a little slower before it plays on the Chromecast, however it works great for me.
#!/usr/bin/env python3
import time
import pychromecast
chromecasts, browser = pychromecast.get_listed_chromecasts(friendly_names=["Woonkamer Speaker"])
[cc.device.friendly_name for cc in chromecasts]
cast = chromecasts[0]
cast.wait()
mc = cast.media_controller
mc.play_media('http://10.0.0.10/De-wasmachine-is-klaar.mp3', 'audio/mp4')
mc.block_until_active()
print(mc.status)
mc.pause()
time.sleep(5)
mc.play()
pychromecast.discovery.stop_discovery(browser)
Changed requirements to PyChromecast==9.1.2