I use alexa_Media Player for an alarm automation but i’ve got the following error
'NoneType' object has no attribute 'is_on'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1233, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1258, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 139, in service_handler
if script.is_on:
AttributeError: 'NoneType' object has no attribute 'is_on'
after HA restart it works but after a while if got the same error message.
One example for a lightloop script
alarm_licht_loop:
alias: Alarm Licht Wiederholung
sequence:
- condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: pending
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: armed_away
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: armed_night
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: triggered
- data:
entity_id: script.alarm_licht_an
service: script.turn_off
- delay: 00:00:03
- service: script.alarm_licht_an
alarm_licht_an:
alias: Alarm Licht an
sequence:
- condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: pending
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: armed_away
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: armed_night
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: triggered
- device_id: a649f4db576049c4be532d61d2041513
domain: light
entity_id: light.eingang
type: turn_on
- device_id: ae153657c5c3495d8bb190b24e7fb1e2
domain: light
entity_id: light.kuechen_decke
type: turn_on
- device_id: ca6d74e907f342fea91cae5f2347dde0
domain: light
entity_id: light.treppe
type: turn_on
- data:
brightness: 255
entity_id: light.eingang
flash: long
service: light.turn_on
- data:
brightness: 255
entity_id: light.kuechen_decke
flash: long
service: light.turn_on
- data:
brightness: 255
entity_id: light.treppe
flash: long
service: light.turn_on
- delay: 00:00:20
- service: script.alarm_licht_loop
another example for an script with alexa_mediaplayer
alarm_sound1_loop:
alias: Alarm Hundebellen Wiederholung
sequence:
- condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: pending
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: armed_away
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: armed_night
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: triggered
- data:
entity_id: script.alarm_sound1_an
service: script.turn_off
- delay: 00:00:03
- service: script.alarm_sound1_an
alarm_sound1_an:
alias: Alarm Hundebellen an
sequence:
- condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: pending
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: armed_away
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: armed_night
- condition: state
entity_id: alarm_control_panel.alarmanlage
state: triggered
- data:
entity_id: media_player.radio_kuche
volume_level: 0.5
service: media_player.volume_set
- data:
entity_id: media_player.radio_kuche
media_content_id: Hundebellen - 2 große Hunde bellen bei Türklingel, bellender
Hund
media_content_type: AMAZON_MUSIC
service: media_player.play_media
- delay: 00:00:35
- service: script.alarm_sound1_an
i use those scripts for an alarm automation.
at the light script it helps if it turn the lights on…
example light on
domain: light
entity_id: light.eingang
type: turn_on
… befor i lets start the flash function
example for flash of hue lights
- data:
brightness: 255
entity_id: light.eingang
flash: long
service: light.turn_on
But the problem is that i have no idea how i can solve this issue with the alexa_mediaplayer
Have anyone a idea what could going wrong with this or what i can do as workaround for the use of alexa media player?
Or have anyone a script example (with loop) that works?