Okay so I have a Yale Smart Sync Alarm integrated nicely with HA via their API.
I’m trying to write a script that activates when a command on my Google Home Mini is heard - which I have got working, however I wanted the feedback from the GHM to be a bit more dynamic. See below from my scripts.yaml file:
> arm_alarm:
> alias: Arm Alarm
> sequence:
> - service: tts.google_say
> entity_id: media_player.stes_room_speaker
> data_template:
> message: >
> {% if is_state("alarm_control_panel.yale_smart_alarm", "armed_away") %}
> "Alarm is already armed"
> {% endif %}
> "STEVEN"
> - condition: state
> entity_id: alarm_control_panel.yale_smart_alarm
> state: 'disarmed'
> - service: alarm_control_panel.alarm_arm_away
> data:
> entity_id:
> alarm_control_panel.yale_smart_alarm
> - wait_template: "{{is_state('alarm_control_panel.yale_smart_alarm', 'armed_away') }}"
> - service: tts.google_say
> entity_id: media_player.stes_room_speaker
> data_template:
> message: >
> {% if is_state("alarm_control_panel.yale_smart_alarm", "armed_away") %}
> "Alarm is now armed"
> {% endif %}
The problem I am having is that the first `tts.google_say` call throws an error, as per below (ignore the messages, this is just for testing purposes):
> Error executing service <ServiceCall tts.google_say (c:15de4878b5eb4e8dbc5bac0a72b4726e): message="STEVEN", entity_id=['media_player.stes_room_speaker']>
> Traceback (most recent call last):
> File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1177, in _event_to_service_call
> await service_handler.func(service_call)
> File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 137, in async_say_handle
> options=options
> File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 306, in async_get_url
> engine, key, message, use_cache, language, options)
> File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 318, in async_get_tts_audio
> message, language, options)
> File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/google.py", line 83, in async_get_tts_audio
> token.calculate_token, part)
> File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
> result = self.fn(*self.args, **self.kwargs)
> File "/usr/local/lib/python3.6/site-packages/gtts_token/gtts_token.py", line 28, in calculate_token
> seed = self._get_token_key()
> File "/usr/local/lib/python3.6/site-packages/gtts_token/gtts_token.py", line 57, in _get_token_key
> tkk_expr = re.search(".*?(TKK=.*?;)W.*?", line).group(1)
> AttributeError: 'NoneType' object has no attribute 'group'
The second tts.google_say works perfectly and I get a response once the alarm status has changed in HA, so doubt anything to do with tokens / credentials and stuff?
I’m just starting out with scripts, and my gut feeling is that this script probably isn’t the most efficient way to achieve what I want, so am open to suggestions.
Any help out there? Thanks in advance!