question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected error for call_service

See original GitHub issue

Hello,

Today, when my automation ran I got following error:

Water front side: Error executing script. Unexpected error for call_service at pos 7: 'result'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 153, in _async_step
    self, f"_async_{cv.determine_script_action(self._action)}_step"
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 623, in _async_call_service_step
    *self._prep_call_service_step(), blocking=True, context=self._context
  File "/usr/src/homeassistant/homeassistant/core.py", line 1253, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1288, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 517, in handle_service
    required_features,
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/opensprinkler/__init__.py", line 385, in run
    return self._station.run(run_seconds)
  File "/usr/local/lib/python3.7/site-packages/pyopensprinkler/station.py", line 70, in run
    return self._manual_run(params)
  File "/usr/local/lib/python3.7/site-packages/pyopensprinkler/station.py", line 30, in _manual_run
    return content["result"]
KeyError: 'result'

My automation:

- id: "1588888773428"
  alias: Water front side
  description: ""
  trigger:
    - entity_id: binary_sensor.s05_station_running
      for: 00:00:30
      from: "on"
      platform: state
      to: "off"
  condition:
    - above: "5"
      condition: numeric_state
      entity_id: sensor.daikinap60251_outside_temperature
    - condition: state
      entity_id: input_boolean.automatic_sprinkler_control
      state: "on"
    - condition: state
      entity_id: input_boolean.automatic_watering
      state: "on"
    - condition: state
      entity_id: input_boolean.watering_back
      state: "on"
    - condition: state
      entity_id: binary_sensor.opensprinkler_sensor_1_active
      state: "off"
  action:
    - data:
        entity_id: switch.s02_station_enabled
      service: opensprinkler.stop
    - delay: 00:00:02
    - data:
        entity_id: switch.s01_station_enabled
        run_seconds: 64800
      service: opensprinkler.run
    - delay: 00:00:02
    - data_template:
        entity_id: switch.s04_station_enabled
        run_seconds: "{{ (states('input_number.front_side_watering_time_min') | float * 60) | int }}"
      service: opensprinkler.run
    - delay: 00:00:10
    - data_template:
        entity_id: switch.s04_station_enabled
        run_seconds: "{{ (states('input_number.front_side_watering_time_min') | float * 60) | int }}"
      service: opensprinkler.run
    - delay: 00:00:02
    - data: {}
      entity_id: input_boolean.watering_back
      service: input_boolean.turn_off

When I ran the automation again manually trough automation.trigger it succeeded.

Home Assistant 0.110.4 hass-opensprinkler v1.0.1 App version: 2.1.10 Firmware: 2.1.9 Hardware: OSPI on Rpi 3

Note: I know I have the run command there twice and a lot of delays. This is because previously before 1.0.0 they were needed as it was not reliable. I need to test how it works nowadays and whether I can trust one run command or/and can execute multiple commands at the same time.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
vinteocommented, Jun 2, 2020

Please keep an eye on it (I am sure you will) and see if happens again.

The scan interval is a thing I missed, its actually 15 seconds right now, will change it back to 5 secs in the next release

0reactions
JurajNyiricommented, Jun 11, 2021

No all is good now thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected Error when calling service - Configuration
I'm using the Developer Tools to call the input_select.select_option service. My yaml looks like this: service: input_select.select_option ...
Read more >
Error while executing automation ... Unknown error ... - GitHub
Unknown error for call_service at pos 1 #23510 ... 'NoneType' object has no attribute 'put_device' Traceback (most recent call last): File ...
Read more >
Solved: Call web service - getting "Unexpected error occur...
I'm trying to use the Call Web Service action to call /NintexWorkflow/workflow.asmx, but when I click Refresh I get: "Unexpected error ...
Read more >
An unexpected error from API call - WordPress.org
Hi, i just installed Envato elements and want to use seome of them, but when I click on Kits and other… there is...
Read more >
An unexpected error occurred while executing a service call ...
When attempting to configure a new Azure Auditing template, the creation fails with the error: An unexpected error occurred while 4292568, This is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found