Hi @TheFes - awesome work !!!
I too unfortunately seem to have an error. I don’t really understand how to approach this - maybe you can shed some light.
So, I have an automation that tracks when me/my wife get home - announce this via the google kitchen display (google hub). If music is playing - Spotify/TuneIn - I want it to announce the TTS message - then resume the play of that track which it was playing.
So, the automation is:
alias: Vlad @ Home
description: Vlad arrives home
trigger:
- entity_id: person.vlad_chiriloiu
from: not_home
platform: state
to: home
condition:
- condition: time
before: "21:00:00"
after: "07:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
- condition: or
conditions:
- condition: state
entity_id: sensor.sm_f936b_wifi_connection
state: XXXX
- condition: state
entity_id: sensor.sm_f936b_wifi_connection
state: XXXXX
action:
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- data:
message: Vlad a ajuns acasa !
title: Notificare Home Assistant
service: notify.mobile_app_sm_g780f
- service: notify.mobile_app_sm_a536b
data:
message: Vlad a ajuns acasa !
title: Notificare Home Assistant
- data:
message: Vlad a ajuns acasa !
title: Notificare Home Assistant
service: notify.mobile_app_sm_f936b
- scene: scene.vlad_is_home
- service: script.google_home_resume
data:
action:
- service: media_player.volume_set
data:
volume_level: 0.5
target:
entity_id: media_player.kitchen_google_display
- service: tts.cloud_say
data:
message: Bine ai venit acasă Vlad. Sper că ai o zi bună !
entity_id: media_player.kitchen_google_display
target:
entity_id: media_player.kitchen_google_display
- delay: "00:01:00"
- service: light.turn_off
data: {}
target:
entity_id:
- light.desk_led
- light.kitchen_led
mode: single
As per your instructions in the documentation - I deleted all previous GoogleHome scripts/automations - created a folder - inside created the .yaml file - copied the script (latest version 2013) and adjusted the initial part to match my setup:
homeassistant:
customize:
script.google_home_resume:
# enter settings for the script here, all settings are optional, you can remove sections if you don't need them
# always leave the line with "settings: &settings" in!
settings: &settings
primary_spotcast: vlad_chiriloiu
radio_data:
Europa FM:
picture: "http://192.168.000.000:8123/local/pictures/radio/europa_fm.png"
title: "Just Music"
Magic FM:
picture: "http://192.168.000.000:8123/local/pictures/radio/magic_fm.png"
title: "WE. LOVE. MUSIC."
Pro FM:
picture: "http://192.168.000.000:8123/local/pictures/radio/pro_fm.png"
title: "MUSIC MATTERS"
DIGI FM:
picture: "http://192.168.000.000:8123/local/pictures/radio/digi_fm.jpg"
title: "NO ALTERNATIVE"
speaker_groups:
media_player.all_house:
- media_player.kids_bedroom_speaker
- media_player.kitchen_google_display
- media_player.office_speaker
- media_player.bedroom_speaker
- media_player.living_room_speaker
default_volume_level: 0.25
dummy_player: media_player.vlc_telnet
default_resume_delay:
seconds: 20
max_runtime:
minutes: 10
# settings for automation
enable_automation: true
dashboard_cast: true
announce_volume_automation: 0.4
# settings for voice script
voice_settings: &voice_settings
check_for_title: "White Noise"
use_resume: true
When I trigger the above automation to test it - it runs up to the google resume script - it cuts the song - plays the TTS message, then it throws the following errors:
Logger: custom_components.spotcast.spotcast_controller
Source: custom_components/spotcast/spotcast_controller.py:234
Integration: Spotcast (documentation, issues)
First occurred: 5:30:37 PM (1 occurrences)
Last logged: 5:30:37 PM
Could not find device Kitchen Google Display from hass.data
###########
Logger: homeassistant.components.script.google_home_resume_helper
Source: helpers/script.py:409
Integration: Script (documentation, issues)
First occurred: 5:30:37 PM (6 occurrences)
Last logged: 5:30:37 PM
00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Resume playing: Spotify?: Error executing script. Error for repeat at pos 2: Could not find device with name Kitchen Google Display
00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Error executing script. Error for choose at pos 2: Could not find device with name Kitchen Google Display
00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Error executing script. Error for if at pos 9: Could not find device with name Kitchen Google Display
00 - Google Home Resume - Helper Script: If at step 2: Error executing script. Error for parallel at pos 1: Could not find device with name Kitchen Google Display
00 - Google Home Resume - Helper Script: Error executing script. Error for if at pos 2: Could not find device with name Kitchen Google Display
###########
Logger: homeassistant
Source: custom_components/spotcast/spotcast_controller.py:88
Integration: Spotcast (documentation, issues)
First occurred: 5:30:37 PM (1 occurrences)
Last logged: 5:30:37 PM
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 462, in _async_run
return await self.script.async_run(script_vars, context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 923, in _async_if_step
await self._async_run_script(if_data["if_then"])
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 252, in async_wrapper
await func(*args)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1025, in _async_parallel_step
raise result
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1017, in async_run_with_trace
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 923, in _async_if_step
await self._async_run_script(if_data["if_then"])
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 896, in _async_choose_step
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 252, in async_wrapper
await func(*args)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 813, in _async_repeat_step
await async_run_sequence(iteration, extra_msg)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 795, in async_run_sequence
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1798, in _execute_service
await self._hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/spotcast/__init__.py", line 190, in start_casting
spotify_device_id = spotcast_controller.get_spotify_device_id(
File "/config/custom_components/spotcast/spotcast_controller.py", line 234, in get_spotify_device_id
spotify_cast_device = SpotifyCastDevice(
File "/config/custom_components/spotcast/spotcast_controller.py", line 62, in __init__
self.castDevice = self.getChromecastDevice(device_name)
File "/config/custom_components/spotcast/spotcast_controller.py", line 88, in getChromecastDevice
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Could not find device with name Kitchen Google Display
What is puzzling is that the device - Kitchen Google Display is present - and working via Spotcast as well as well as via Spotify
I am sorry for the long post - but I wanted to have a background on what I am trying to achieve and what’s not working
Thank you very much for any hint on what may be that’s not configured/setup properly for it to work