None type object error message

Hi all,

I have a script that cycles though various nanoleaf modes, the script has been running without incident till now. I am getting an error message “‘none type’ object has no attribute ‘is_on’”. The following appears in the log:

'NoneType' object has no attribute 'is_on'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1226, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1251, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 134, in service_handler
    if script.is_on:
AttributeError: 'NoneType' object has no attribute 'is_on'

I’ve tested each call in the services tab of the developer tools, all run fine. Anyone have any ideas?

Please post the correctly formatted script config.

Thanks Tom, here is the code from scripts.yaml

'1558590137782':
  alias: Nanoleaf Day
  sequence:
  - data:
      brightness: 254
      effect: Flames
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on
  - delay: 01:00:00
  - data:
      brightness: 254
      effect: Inner Peace
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on
  - delay: 01:00:00
  - data:
      brightness: 254
      effect: Nemo
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on
  - delay: 01:00:00
  - data:
      brightness: 254
      effect: Northern Lights
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on
  - delay: 01:00:00
  - data:
      brightness: 254
      effect: Romantic
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on
  - delay: 01:00:00
  - data:
      brightness: 254
      effect: Color Burst
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on
  - delay: 01:00:00
  - data:
      brightness: 254
      effect: Triluminox Energy Crystal
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on
  - delay: 01:00:00
  - data:
      brightness: 254
      effect: Relaxing neon
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on
  - delay: 01:00:00
  - data:
      brightness: 254
      effect: Flickering Candle
      entity_id: light.light_panels_53_39_43_local
    service: light.turn_on

That all looks ok.

Did you restart home assistant or use reload-scripts?

Seems there may be a bug: Problem (bug?) with Reload Scripts when using 'delay'

Try a restart.

OK, will do. I just updated to HA version 0.104.2, not sure if that has anything to do with it. I’ll try a restart and see.

Reboot seems to have fixed it. Would not have thought that would have have worked. Thanks for the advice.

1 Like