Adding more information to a list for speaking it

i did it like you said - create new automation → switch to yaml and paste it there

Ok, it’s likely the hyphen before alias:… that was from the original and is only required when pasting it to configuration.yaml or automations.yaml.

I’ve adjusted the automation configuration in my original post, so do a new copy/paste.

Ok did all what you said bite Alexa don’t answer the windows error in expiration


Stopped because an error was encountered at 29. Juni 2023 um 08:03:17 (runtime: 1.22 seconds)

Unable to find service notify.alexa_media_last_called

ok i set the delay little bit higher now the error dont occure.
but alexa answer nothing :frowning:

i think your posted script above is not equal with this one:

tts_opened_windows:
  alias: Notify - Alexa - List Open Windows
  sequence:
  - service: notify.alexa_media_last_called
    data:
      data:
        type: tts
      message: '{{active_windows}}'
  variables:
    active_windows: |-
      {% set ow = expand('binary_sensor.all_window_sensors')
      | selectattr('state','eq','on')  |
      map(attribute='entity_id') | map('area_name')  
      | unique | reject('eq',None) | sort | map('lower') | list %} 
      {% set qty = ow | count %} 
      {% if qty != 0 %} 
      There {{'is an' if qty==1 else 'are'}} open window{{' ' if qty==1
      else 's '}}in the {{' and '.join((ow|join(', ')).rsplit(', ', 1)) }}.
      {% else %} 
      All windows are closed. 
      {% endif %}

so i think alexa couldnt answer anything ? - my actual script is this:

alias: "Alexa Report"
trigger:
  - platform: state
    entity_id: light.alexa_virtual
    to: 'on'
condition:
action:
  - variables: 
      messages:
        1: |-
          {% set ow = expand('binary_sensor.all_window_sensors') | selectattr('state','eq','on')  |
          map(attribute='entity_id') | map('area_name') | unique | reject('eq',None) | sort | map('lower') | list %} 
          {% set qty = ow | count %} 
          {% if qty != 0 %} 
            There {{'is an' if qty==1 else 'are'}} open window{{' ' if qty==1 else 's '}}in the {{' and '.join((ow|join(', ')).rsplit(', ', 1)) }}.
          {% else %} 
            All windows are closed. 
          {% endif %}
  - service: alexa_media.update_last_called
  - delay: 1
  - service: notify.alexa_media_last_called
    data:
      data:
        type: tts
      message: |-
        {% set brightness = state_attr('light.alexa_virtual', 'brightness') %}
        {% set id = (brightness | int(0) / 255 * 100 ) | round | string%}
        {% if id in messages %}
          {{ messages.get(id) }}
        {% else %}
          No value has been set for brightness level {{ brightness }}
        {% endif %}
  - delay: 1
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.alexa_virtual

That error message indicates that HA can’t find the service. Check if the service call exists on your HA instance by using the Services tool in Developer Tools. If you paste notify.alexa_media_last_called into the selection box you should be presented with:

If that does not show up, there is something wrong with your Alexa Media Player integration and you may need to delete the integration and reinstall it.

The script I posted has been tested and works…

I have changed now to that:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
id: '1687937695627'
alias: Alexa Report
trigger:
  - platform: state
    entity_id: light.alexa_virtual
    to: 'on'
condition: null
action:
  - service: alexa_media.update_last_called
    data: {}
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: notify.alexa_media_last_called
    data:
      type: tts
      messages: '{{1}}'
      variables:
        '1': |-
          {% set ow = expand('binary_sensor.fenster') |
          selectattr('state','eq','on')  |

          map(attribute='entity_id') | map('area_name') | unique |
          reject('eq',None) | sort | map('lower') | list %} 

          {% set qty = ow | count %} 

          {% if qty != 0 %} 
            There {{'is an' if qty==1 else 'are'}} open window{{' ' if qty==1 else 's '}}in the {{' and '.join((ow|join(', ')).rsplit(', ', 1)) }}.
          {% else %} 
            Nein alle Fenster sind zu 
          {% endif %}
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.alexa_virtual

So i think its nearly working but i got following error at the end:


Stopped because an error was encountered at 29. Juni 2023 um 13:32:40 (runtime: 3.26 seconds)

extra keys not allowed @ data['type']

start over again… copied again your script now i have no error - but alexa says nothing in the logs after a start stand only output

message: No value has been set for brightness level 4

but i use “1”

shouldnt be stand here for example No Windows are open - which the alexa speaks ?

YES !!! I got it !! the problem is this :slight_smile:

https://github.com/custom-components/alexa_media_player/issues/770

Weird… The automation I have (and tested yesterday) has round and works without issue. I have updated the automation above and the A.M.P. wiki to use int since that apparently works for everyone.

One last question! All of my Echos fire up the windows and answer only with one (and that’s the main echo) won’t work. In log the error appears:


Stopped because an error was encountered at 4. Juli 2023 um 07:57:51 (runtime: 2.18 seconds)

Unable to find service notify.alexa_media_last_called

All other work :confused: