I forgot to put the notify component
Community Hass.io Add-on: Google Assistant Webserver (broadcast messages without interrupting music)
Awesome.
So you got it to work?
I canāt seem to get the UI to clear the field after submit - is that something you customized?
Yeah, the automation plus script I created above should do the trick.
Iāve basically made the script call the notification, and then clear the input_text component. And then the automation only triggers the script if the length is greater than zero, and the input_text component state changes.
Ahh, got it. In converting your automation to AppDaemon I had a syntax error that I wasnāt catching.
Here is an AppDaemon app to monitor input_text changes and call a notify service. Basic use is as you have yours now, in the future with added webhooks this could be used to have an intercom or control specific to each room or device.
import appdaemon.appapi as appapi
#
# App to monitor input_text input to use as an intercom to google assistant devices
#
# Forum Discussion:
# https://community.home-assistant.io/t/community-hass-io-add-on-google-assistant-webserver-broadcast-messages-without-interrupting-music/37274
#
#
# EXAMPLE appdaemon.yaml entry
###
# Intercom:
# class: intercom
# module: intercom
# entities:
# - intercom_input: input_text.intercom
# notify: googleassistant
#
#
# Arguments
###
# intercom_input: input_select entity to be monitored
# notify: the notify component to use
#
#
# NOTES:
# Example Notify:
# - name: googleassistant
# platform: rest
# resource: http://192.168.1.188:5000/broadcast_message
#
#
# Release Notes
#
# Version 1.0:
# Initial Version
#
#
# ####################################################################
# ####################################################################
class intercom(appapi.AppDaemon):
def initialize(self):
if "entities" in self.args:
for item in self.args["entities"]:
intercom_input = item["intercom_input"]
notify = item["notify"]
msg = "Intercom setup using {}.".format(
self.friendly_name(intercom_input))
self.log(msg, "INFO")
# Setup Listener
self.listen_state(self.state_changed, entity=intercom_input, notify=notify)
else:
msg = "Intercom enabled but no entities configured."
self.log(msg, "INFO")
def state_changed(self, entity, attribute, old, new, kwargs):
intercom_input = entity
notify = kwargs['notify']
if new != "" and new != " " and old != new:
notifyservice = 'notify/{}'.format(notify)
self.call_service(notifyservice, message=new)
self.call_service('input_text/set_value', value=" ", entity_id=intercom_input)
Yes! Only thing that after a restart in the box is shown unknown (minor issue)
Have you been able to get the āspecialā broadcasts to work using this method? For instance, if I personally say āBroadcast, itās dinner timeā - google will ring a bell and then say āitās dinner timeā or āBroadcast, Iām homeā will play a trumpet followed by āHey there, kylerw has arrivedā.
When using the intercom, it always plays back using TTS/Text To Speech.
I havenāt tried that out, but it could need to be specifically formatted a certain way. If you have the Google Assistant app on your phone, then it letās you try out text messages that you can then move over to Home Assistant.
So, in the Google Assistant app, it would be ābroadcast [some message]ā.
Hereās the link to the specific messages in case you havenāt seen it yet:
https://support.google.com/googlehome/answer/7531913?co=GENIE.Platform%3DAndroid&hl=en
Yeah, I took the liberty of adding a new api resource for a generic command and using broadcast without the quotes around the message gives the special responses.
Awesome! Iām definitely going to have to add all that when I get home then.
Just submitted a PR for the changes I had made. Hopefully thatās ok.
Struggling to set a timer with this using my edited API. If anyone works out the correct syntax (and the same goes for an alarm) without require any additional chat/response please feed back here.
I think the issue is that the alarm or timer is being set on the āvirtualā google home and there currently is not the capability to set a timer or alarm on another device.
That would explain it. Thanks.
Not seeing your pull request by the way. Interested to see it as Iād already submitted one myself but Iām no coder!
Hey andrewdolphin! I have a comment or two on your PR. Iād say once those two minor things are taken care of, I can trigger the Docker build from where I am and get the new version out there.
Just merged a PR from @kylerw that takes the add-on to version 0.0.3, adding a webhook for generic messages that arenāt for broadcasts.
http://[HASSIO LOCAL IP]:5000/command?message=[any Google command]
You can use this to send any generic message you want to Google that the Google Assistant app could normally handle.
āTurn on the hallway lights,ā or āSet a reminder for [something]ā, etc.
We should change to that (rather than have 2 types)?
Itās just a version upgrade, and Hass.io would suggest it. Although, if itās working for you, then thereās really no need to upgrade.
but if I use this, in order to broadcast a message I have to add BROADCAST in the text before the message, correct?
Basically I can:
turn on living room light
or
broadcast Itās time for dinner