hassio-addons
hassio-addons copied to clipboard
U can broadcast to 1 device now.
It is now possible to broadcast to 1 device.
Today i did find out how, i did say hey google, broadcast/announce to kitchen. than it asked what message and it announcec only there.
But on my phone i could use a text message so the default voice speaks instead of the tts from home assistant.
Can you implement this ?
just change your broadcast message to be "to kitchen the rest of your message"
@chelming
how does it work?
Unfortunately, the package runs sequentially though. So while you can broadcast to one speaker, if you call those in a loop to target say 3 of them, each appears to run sequentially and takes between 3-4 seconds before moving to the next speaker. It would be nice to fork the command to execute immediately without waiting. This isn't an automation problem (I use script.turn_on and can also recreate it from simple curl GETs)
@malosaa the broadcast command isn't actually broadcasting, it's running the command "broadcast ${your message here}" so if you just change your message to "to the kitchen it's time for bed" it'll actually run "broadcast to the kitchen it's time for bed".
@calisro does google have the ability to target a specified set of speakers when using your voice? like "broadcast to kitchen and livingroom it's lunch time"?
@calisro does google have the ability to target a specified set of speakers when using your voice? like "broadcast to kitchen and livingroom it's lunch time"?
No. You can hit only one at a time with a targeted 'broadcast to
sequence:
- variables:
speakers: |
{{ expand(target) | map(attribute='entity_id') | list }}
- repeat:
count: '{{ speakers | count }}'
sequence:
- variables:
speaker: '{{ speakers[repeat.index - 1] }}'
- choose:
- conditions:
- condition: template
value_template: '{{ message | length > 0 }}'
sequence:
- service: script.turn_on
data:
variables:
message: >-
broadcast to {{ state_attr('' ~
speaker,'friendly_name') }},
{{message|default('Test Message',true) }}
target:
entity_id: script.run_ga_command
I wish google would just allow broadcasts to speaker groups but that isn't available either.
@malosaa the broadcast command isn't actually broadcasting, it's running the command "broadcast ${your message here}" so if you just change your message to "to the kitchen it's time for bed" it'll actually run "broadcast to the kitchen it's time for bed".
In reality, the ga_command and the ga_broadcast is exactly the same and personally i don't even bother with the broadcast one. The command is simpler and not even sure why the second command was added only to prepend the message with 'broadcast'.
class BroadcastMessage(Resource):
def get(self):
message = request.args.get('message', default = 'This is a test!')
text_query = 'broadcast '+message
response_text, response_html = assistant.assist(text_query=text_query)
logging.debug(response_text)
return {'status': 'OK'}
api.add_resource(BroadcastMessage, '/broadcast_message')
class Command(Resource):
def get(self):
message = request.args.get('message', default = 'This is a test!')
response_text, response_html = assistant.assist(text_query=message)
logging.debug(response_text)
return {'status': 'OK'}
api.add_resource(Command, '/command')
To me it just adds confusion and an extra notify config in HA for zero advantage. shrugs
well they're not exactly the same because broadcast prepends the message with "broadcast". I think the idea was to make it slightly shorter e.g., /broadcast "it's time for lunch" vs /command "broadcast it's time for lunch" and you could reuse the message for other notification platforms.
well they're not exactly the same because broadcast prepends the message with "broadcast". I think the idea was to make it slightly shorter e.g., /broadcast "it's time for lunch" vs /command "broadcast it's time for lunch" and you could reuse the message for other notification platforms.
Its actually the same length. :)
The actual commands need to run each are (the doc is wrong, you need "message="):
http://[your.hassio.IP]:5000/broadcast_message?message=its time for lunch
http://[your.hassio.IP]:5000/command?message=broadcast its time for lunch
But yes I know the 'idea' but it's just confusing a simple thing. I'm guessing the broadcast was published first and then command was added and it was retained for backward compatibility as its missing in this initial commit.
https://github.com/AndBobsYourUncle/hassio-addons/commit/9d8fa350e3784579695484bac02a40994ed684c7
I use it now for all my notifications and it works as expected
delete