Stihl Imow - Robotic lawn mower

Not sure what “this” is in your post, Huub. Intercepting the imow app traffic? Or do you also have a 632 model?

Hey HA and Stihl iMow friends :slight_smile:,

Could anyone (with MI 422 PC) make it to run the imow service stihl_imow.intent with the startMowingFromPoint action?

Which attributes do you need to fill?

I cannot try it myself, since this command is not available to model 632 P, but the default inputs are minutes [30, 60, 90] and a defined starting point 1, 2, 3 or 4. I have only one starting point defined, 1.

When trying to call this service, I am getting an “Unknown Error”:

Logger: homeassistant.helpers.event
Source: components/sensor/__init__.py:593
First occurred: 12:02:46 (3 occurrences)
Last logged: 16:13:10

Error while dispatching event for sensor.carlos_smartlogic_performedactivitytime to <Job track state_changed event {'sensor.carlos_smartlogic_mowingtime', 'sensor.carlos_smartlogic_performedactivitytime'} HassJobType.Callback <bound method TrackTemplateResultInfo._refresh of <TrackTemplateResultInfo {Template<template=({{ states('sensor.carlos_smartlogic_performedactivitytime') }} von {{ states('sensor.carlos_smartlogic_mowingtime') }}) renders=58>: <RenderInfo Template<template=({{ states('sensor.carlos_smartlogic_performedactivitytime') }} von {{ states('sensor.carlos_smartlogic_mowingtime') }}) renders=58> all_states=False all_states_lifecycle=False domains=frozenset() domains_lifecycle=frozenset() entities=frozenset({'sensor.carlos_smartlogic_mowingtime', 'sensor.carlos_smartlogic_performedactivitytime'}) rate_limit=None has_time=False exception=None is_static=False>, Template<template=(mdi:map-marker-distance) renders=30>: <RenderInfo Template<template=(mdi:map-marker-distance) renders=30> all_states=False all_states_lifecycle=False domains=frozenset() domains_lifecycle=frozenset() entities=frozenset() rate_limit=None has_time=False exception=None is_static=True>}>>>
Error while dispatching event for sensor.carlos_smartlogic_performedactivitytime to <Job track state_changed event {'sensor.carlos_smartlogic_mowingtime', 'sensor.carlos_smartlogic_performedactivitytime'} HassJobType.Callback <bound method TrackTemplateResultInfo._refresh of <TrackTemplateResultInfo {Template<template=({{ states('sensor.carlos_smartlogic_performedactivitytime') }} von {{ states('sensor.carlos_smartlogic_mowingtime') }}) renders=60>: <RenderInfo Template<template=({{ states('sensor.carlos_smartlogic_performedactivitytime') }} von {{ states('sensor.carlos_smartlogic_mowingtime') }}) renders=60> all_states=False all_states_lifecycle=False domains=frozenset() domains_lifecycle=frozenset() entities=frozenset({'sensor.carlos_smartlogic_mowingtime', 'sensor.carlos_smartlogic_performedactivitytime'}) rate_limit=None has_time=False exception=None is_static=False>, Template<template=(mdi:map-marker-distance) renders=31>: <RenderInfo Template<template=(mdi:map-marker-distance) renders=31> all_states=False all_states_lifecycle=False domains=frozenset() domains_lifecycle=frozenset() entities=frozenset() rate_limit=None has_time=False exception=None is_static=True>}>>>
Error while dispatching event for sensor.carlos_smartlogic_performedactivitytime to <Job track state_changed event {'sensor.carlos_smartlogic_mowingtime', 'sensor.carlos_smartlogic_performedactivitytime'} HassJobType.Callback <bound method TrackTemplateResultInfo._refresh of <TrackTemplateResultInfo {Template<template=({{ states('sensor.carlos_smartlogic_performedactivitytime') }} von {{ states('sensor.carlos_smartlogic_mowingtime') }}) renders=62>: <RenderInfo Template<template=({{ states('sensor.carlos_smartlogic_performedactivitytime') }} von {{ states('sensor.carlos_smartlogic_mowingtime') }}) renders=62> all_states=False all_states_lifecycle=False domains=frozenset() domains_lifecycle=frozenset() entities=frozenset({'sensor.carlos_smartlogic_mowingtime', 'sensor.carlos_smartlogic_performedactivitytime'}) rate_limit=None has_time=False exception=None is_static=False>, Template<template=(mdi:map-marker-distance) renders=32>: <RenderInfo Template<template=(mdi:map-marker-distance) renders=32> all_states=False all_states_lifecycle=False domains=frozenset() domains_lifecycle=frozenset() entities=frozenset() rate_limit=None has_time=False exception=None is_static=True>}>>>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 586, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '16 von 21'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 589, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: '16 von 21'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 293, in _async_dispatch_entity_id_event
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 625, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1211, in _refresh
    self.hass.async_run_hass_job(self._job, event, updates)
  File "/usr/src/homeassistant/homeassistant/core.py", line 625, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 429, in _handle_results
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 593, in state
    raise ValueError(
ValueError: Sensor sensor.imow_mowing_time has device class 'None', state class 'None' unit 'h' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '16 von 21' (<class 'str'>)
Logger: homeassistant.helpers.script.websocket_api_script
Source: custom_components/stihl_imow/services.py:93
Integration: STIHL iMow
First occurred: 17:14:44 (1 occurrences)
Last logged: 17:14:44

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 403, message='Forbidden', url=URL('https://api.imow.stihl.com/mower-actions/')
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stihl_imow/services.py", line 36, in async_call_intent_service
    await intent_service(hass, entry, service_call, device_registry)
  File "/config/custom_components/stihl_imow/services.py", line 93, in intent_service
    await upstream_mower_state.intent(
  File "/usr/local/lib/python3.11/site-packages/imow/common/mowerstate.py", line 121, in intent
    await self.imow.intent(
  File "/usr/local/lib/python3.11/site-packages/imow/api/__init__.py", line 493, in intent
    response = await self.api_request(url, "POST", payload=payload)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/imow/api/__init__.py", line 329, in api_request
    raise e
  File "/usr/local/lib/python3.11/site-packages/imow/api/__init__.py", line 324, in api_request
    response.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url=URL('https://api.imow.stihl.com/mower-actions/')
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/stihl_imow/services.py:93
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 17:14:44 (1 occurrences)
Last logged: 17:14:44

[546308191040] Error handling message: Unknown error (unknown_error) Erik from 172.18.0.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 740, in handle_execute_script
    script_result = await script_obj.async_run(msg.get("variables"), context=context)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1579, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1969, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2006, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stihl_imow/services.py", line 36, in async_call_intent_service
    await intent_service(hass, entry, service_call, device_registry)
  File "/config/custom_components/stihl_imow/services.py", line 93, in intent_service
    await upstream_mower_state.intent(
  File "/usr/local/lib/python3.11/site-packages/imow/common/mowerstate.py", line 121, in intent
    await self.imow.intent(
  File "/usr/local/lib/python3.11/site-packages/imow/api/__init__.py", line 493, in intent
    response = await self.api_request(url, "POST", payload=payload)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/imow/api/__init__.py", line 329, in api_request
    raise e
  File "/usr/local/lib/python3.11/site-packages/imow/api/__init__.py", line 324, in api_request
    response.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url=URL('https://api.imow.stihl.com/mower-actions/')

Can you share what your call looks like in yaml mode?

Please see my screenshot above. I did the call from development tools.

  1. Does this startpoint exist? I only have 1 defined

  2. Have tried the command without duration?