thefes / ha-configuration Goto Github PK
View Code? Open in Web Editor NEWMy Home Assistant config
My Home Assistant config
Hi,
This works fine when calling TTS with only the speaker playing music. But as soon as I call TTS on a group (e.g all google speakers) it doesn't resume playing.
I have a group with 3 speakers defined in the script.
It didn't support json files here so dpaste it is:
https://www.dpaste.org/t86mr
https://www.dpaste.org/osJc0
Update to 2022.12
Currently done:
Improvements
players_screen
, now using device_class
Bug fixes:
Play area to 100%
Limit led strip brightness to avoid blinking
Add induced TTS support and update to version 2.0
Add option to add delayed start for dishwasher
Hello,
I found your script for resuming spotify on the homeassistant forums. I think I have everything set up correctly, though I'm getting an error from the google resume helper script and I can't figure out what I've done wrong.
00 - Google Home Resume - Helper Script: If at step 1: Resume needed?: Resume playing: Spotify?: Error executing script. Unexpected error for call_service at pos 2: 'NoneType' object is not subscriptable
I have no idea what this means or how to fix it. I have your script in scripts.yaml, and I have the automation that goes along with it in automations.yaml. My automations are in an automations folder and as far as I understand they should be pretty simple.
If you need I can paste my automation to you here. Either that, or it's something I removed from the script, but all I took out was the groups and the players_screen as I have neither of them. I left primary_spotcast and set it to my name. Any help you can give would be greatly appreciated.
Good day Fes,
Sorry for bugging you again. This is not urgent, but I have 2 questions:
When playing 1 spotcast account per speaker at a time it works 100% and resumes with the spotcast account that was playing. When Playing music from 2 spotcast accounts on 2 media players, when notification plays and the music resumes it only resumes on the default spotcast account on the last speaker the script ran. I tried running a script per speaker pointing to different default spotcast account, didn't work. How can I setup my automation to resume both speakers with the 2 spotcast accounts that was playing?
When spotcast to media_player.group (my own group created in google home app) and the notification plays, the music resumes only on one speaker. I think i'm setting up the script wrong.
Thank you in advance.
Add to guest person
Create person group for family members (back to old situation)
Change automations using state of zone now to use the groups above
Update Google Home resume script with changes introduced in 2022.5
The Google Home Resume script interrupts the Google Home Voice script before it starts the TTS
Maybe add the same check as done in the perform resume script.
Good day,
I would like to use your script and would love to get it to work:
I have changed media players to my entities. When trying to run the script
I'm getting error: Error rendering data template: Result is not a Dictionary
Here are the full error:
Logger: homeassistant.components.websocket_api.http.connection
Source: helpers/service.py:238
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:28:05 AM (4 occurrences)
Last logged: 10:29:30 AM
[140159867333552] Error rendering data template: Result is not a Dictionary
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/components/script/init.py", line 273, in service_handler
await script_entity.async_turn_on(
File "/usr/src/homeassistant/homeassistant/components/script/init.py", line 377, in async_turn_on
await coro
File "/usr/src/homeassistant/homeassistant/components/script/init.py", line 403, in _async_run
return await self.script.async_run(script_vars, context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1260, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _async_call_service_step
params = service.async_prepare_call_from_config(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 238, in async_prepare_call_from_config
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error rendering data template: Result is not a Dictionary
Can you please point out to what I am doing wrong?
Thank you
On a fresh installation of the google_cast package, I see three errors in the google_home_resume.yaml code.
At line 720: data: "{{ data }}"
Line 976: {{ service_data if player.spotcast == 'primary_account' else dict(service_data, **account_data) }}
Line 1317: data: "{{ data }}"
All three locations give "Incorrect type. Expected "object". in the Visual Studio Code Server add-on IDE.
Always use spotcas service call without account when:
primary_spotcast
)primary_spotcast
provided. This avoids an incorrect service call when the service call uses an account which is not configured. Should be clearly explained in the docs though, because it will cause that the wrong account is resumed when the primary_spotcast
variable is incorrect.primary_spotcast
in script, put that in a variable and use that for the points above. Post a warning in the log in case it is not correctHey TheFes,
I am using your script for a while now and it still doing a very good job.
One thing that I see in my logs is the following:
Logger: homeassistant.helpers.template
Source: helpers/template.py:1850
First occurred: June 15, 2022, 23:22:00 (1 occurrences)
Last logged: June 15, 2022, 23:22:00
Template variable warning: 'players_screen' is undefined when rendering '{{ [] if not players_screen else target_not_playing | select('in', players_screen) | list }}'
I dont think that I need to worry about, but will it gives any problems for in the future if you know?
I don’t have the line players_screen, because I don’t need it. Or can I just add the line without any argument, so that the error doesn’t show anymore?
greetings,
Besiktas97
Check for state of group members instead of Google Home group
Test for github
When Marleen takes phone from charger
Triggers house mode from sleeping to home.
This is a test issue
For Shelly, ESPHome and ZigBee idle usage
As failsafe to always be able to turn off the light
Remove test.yaml which was created as test
On 🍄 dashboard
Add TTS and make phone notifications persistent
Hi,
my compliments for your great work!
I've tray a simple test implementation. This one:
google_home_voice_test:
alias: "Google Home Voice Test"
icon: mdi:car
sequence:
- variables:
message: "Ciao Ciao, ti sto rispondendo da Home Assistant solo qui"
- alias: "TTS for speaker voice command"
service: script.google_home_voice
data:
use_resume: true
target_variable: true
action:
- alias: "Send TTS message"
# service: tts.cloud_say
service: tts.cloud_say
data:
message: "{{ message }}"
volume: 35
I've made a routine in Google Home App that call this script and reproduce a specific relaxing sound (in according to the title in variable of your script)
I,ve tested from "Google Nest Hub":
And: the music stop, tts message spoke, the music resume!
I've testes from "Google Home Mini" the same voice command:
If I ask to launch my script without music in playback, the TTS message is reading.
Can you help me, please?
Thanks!
First off, HUGE thank you for taking the time to make this. It's been a pita having to restart music everytime so I find myself sitting in silence. I'm sure I'll enjoy using this even more than your kids.
First question, is there anyway this could be a python script? You must have had the patience of a saint writing the yaml, but I can't really follow it. If you know a way to make it a script I'd happily contribute! (very keen to support the BBC, which is no longer via tunein)
Second question:
2022-04-08 23:26:36 ERROR (MainThread) [homeassistant.components.script.google_home_resume_perform_resume] 00 🔊 Google Home Resume - Perform resume: Resume needed?: choice 1: Resume playing: Spotify?: Primary spotcast account?: default: Error executing script. Unexpected error for call_service at pos 1: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 372, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 575, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1673, in _execute_service
await self._hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/spotcast/__init__.py", line 170, in start_casting
client = spotcast_controller.get_spotify_client(account)
File "/config/custom_components/spotcast/spotcast_controller.py", line 179, in get_spotify_client
return spotipy.Spotify(auth=self.get_token_instance(account).access_token)
File "/config/custom_components/spotcast/spotcast_controller.py", line 170, in get_token_instance
dc = self.accounts.get(account).get(CONF_SP_DC)
AttributeError: 'NoneType' object has no attribute 'get'
I've been struggling to debug what's going on. Here's the variables I can find:
spotify_data:
- entity_id: media_player.spotify_xxxxx_xxxxx
source: Landing speaker
player_data:
- data_source: resume_script
entity_id: media_player.landing_speaker
state: playing
app_name: Spotify
volume_level: 0.44998854398727417
media_position: 19.155000047683714
members: []
type: no screen
spotcast: xxxx_xxxxx
players_to_resume:
- media_player.landing_speaker
I've masked my account, but it seems sensible. I don't really know where to go from here? My spotcast works via the lovelace attachment and I've removed default_user
from the variables.
Any thoughts? And thanks again!
Folder for switch to light templates is placed in unneeded template folder, can be moved to root of light folder.
Wrong icon shown when nobody is home
Change automations to lower screens in bedrooms based on temperature inside and rising temperature outside
Hey! I was able to get this working after just a few minutes of setup. Its great! Is there a way to have Resume work when I send an image to my google displays though?
I have a script that, when the doorbell is pressed, a picture of the visitor is taken and cast to the google displays throughout the house. After 30s the image is removed. What would be the proper way to configure this so your resume script works? I have tried a few different ways, but my guess is that I need to update something in the automation you provide. Can you point me in the right direction? If it helps, here is my doorbell script.
Thanks so much! 💚
doorbell_send_snapshot_to_displays:
alias: Doorbell send snapshot to displays
sequence:
- service: camera.snapshot
data:
filename: /config/www/images/doorbellsnap.jpeg
target:
device_id: 4f727cb6d16f05386b5ab17047d76a08
- service: media_player.play_media
data:
media_content_id: /local/images/doorbellsnap.jpeg
media_content_type: image/jpeg
announce: true
target:
entity_id:
- media_player.office_display
- media_player.kitchen_display
- media_player.bedroom
- delay:
hours: 0
minutes: 0
seconds: 20
milliseconds: 0
- service: media_player.turn_off
data: {}
target:
entity_id:
- media_player.kitchen_display
- media_player.office_display
- media_player.bedroom
mode: single
Hello,
very interested in your work but the file google_home_resume.yaml is missing.
It gives me an 404 :-(
Google found it under :
https://github.com/TheFes/HA-configuration/blob/main/include/integrations/packages/google_cast/google_home_resume.yaml
Hi there,
I managed to resume media which I started via Spotcast (triggered through the "custom:spotify-card") but media is not resumed when playing media with the newly integrated Music Assitant.
Do you think your script can be changed in order to work with this integration?
Furthermore I noticed that on my Google minis the volume level is changed before the originally played media is completely stopped, e.g. when altering the volume level for tts messages the originally played media gets pretty loud for a short time before tts is played.
Split data and target in the script and move all targets provided to the target section
Was not able to upload the .JSON file. It is available here.
Please advise if I can provide you with anything further.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.