How to debug script

I’m currently trying to debug a script.
Basically, I have an automation that calls the script, but some steps are failing.

I tried to use the logger (https://www.home-assistant.io/components/logger/) module with the following configuration:

logger:
  default: warning
  logs:
    homeassistant.helpers.script: debug

And I get the below output in the home-assistant.log file:

2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Test Automation: Running script
2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Test Automation: Executing step call service
2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Running script
2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Executing step call service
2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Executing step call service
2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Executing step call service
2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Executing step call service
2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Executing step delay 0:00:00
2019-02-27 21:47:55 INFO (MainThread) [homeassistant.helpers.script] Script Test Automation: Executing step
2019-02-27 21:47:56 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Executing step wait template
2019-02-27 21:48:02 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Executing step wait template
2019-02-27 21:48:02 INFO (MainThread) [homeassistant.helpers.script] Script Sonos TTS script - Testing: Executing step call service

Is there a way to get the script to display more information on the failing part? (some kind of print statement?)

you can use the system_log.write service

3 Likes