Stihl Imow - Robotic lawn mower

You have done a lot of changes!
Is this a version we can try already?
What is the easiest way to upgrade the repository and the integration?

Tx for the hard work!

Hi, thank you for the insights.
The 30s are in the corresponding docs for fetching data the way I have to do (Fetching Data | Home Assistant Developer Docs)
What do you mean with map the way to the station?
I plan to implement switches for the on/off properties (soon).

I released this as a beta version. You can enable beta upgrades in HACS for this repo:



Afterwards there should be an upgrade suggestion.

I also suggest you guys delete the “old” configuration in HA settings and after upgrading re-add your stihl account in configuration->integration or you will have orphaned entries related to your device.

In your attributes I saw a data point “Map intelligent way home” or something like that, with the value “false”. I am just curious to see if that can be a switch for this functionality, because the current go home routine is very unsmart.
I have a question outstanding with technical support. Maybe a new feature for the next firmware update? I hope so.
I do not think a priority for you.

Hmm, i have no idea what this property “mappingIntelligentHomeDrive” is for. Maybe someone else have an idea.

Stihl Technical Service replied that Direct Drive Home is new iMow functionality which is included in the model RMI 522. Not for the model RMI 632. Pity.

In the beta you now have 53 sensors and a few services! Very nice. But the attributes of your 3 original sensors are gone. Is it possible to keep the attributes and the naming scheme (you dropped “mow” from all the sensor names)? No problem if not possible, but then I will wait until your beta becomes a release before renaming my 53 sensors !
Thanks, very nice work!

The 1.0.0rc3 has fixed entity names that do not change anymore

I just released version 1.0.0 :partying_face:
I suggest you remove and re-configure the integration after upgrading to get all of the new configuration options.
Thank’s for your testing so far.

https://community.home-assistant.io/t/stihl-imow-lawn-mower-integration-testers-needed/319729

Hi Chris, I have tested the new commands.
edgeMowing and toDocking work as expected.

I get errors with the startMowingFromPoint command.

The errors when I do not fill in an area to mow and no mowing time:

The error when I fill in area 1 and a mowing time of 30 min:

Here is my Lovelace horizontal button card:

type: horizontal-stack
cards:
  - type: button
    tap_action:
      action: call-service
      service: stihl_imow.intent
      service_data:
        action: startMowingFromPoint
        mower_name: Toon
      target: {}
    icon_height: 30px
    icon: mdi:robot-mower
    name: Mow main lawn
  - type: button
    tap_action:
      action: call-service
      service: stihl_imow.intent
      service_data:
        action: startMowingFromPoint
        mower_name: Toon
        duration: '30'
        startpoint: 1
      target: {}
    icon_height: 30px
    icon: mdi:robot-mower
    name: Mow front lawn
  - type: button
    tap_action:
      action: call-service
      service: stihl_imow.intent
      service_data:
        action: edgeMowing
        mower_name: Toon
      target: {}
    icon_height: 30px
    icon: mdi:robot-mower
    name: . Mow edges..
  - type: button
    tap_action:
      action: call-service
      service: stihl_imow.intent
      service_data:
        action: toDocking
        mower_name: Toon
      target: {}
    icon_height: 30px
    icon: mdi:home
    name: Stop & go home

I have tried several variations, like no quotes around the mowing time. What have I done wrong?

And second, wondering how you defined the two switches, e.g. gpsProtectionEnabled and automaticModeEnabled.

And third, wondering whether the other binary sensors can also be set with a switch. Perhaps define these as switch in “maps.py”?

And fourth, I have a sensor with suggested mowing time of minus 82, which does not quite make sense. Do you know why?
Huge tx

Hi Jan, thank’s for testing.

Regarding the first question:
The values for startpoint and duration should both be provided as plain numbers (integers), without any quotes. That is how it’s working for me, with your cards (copy/pasted, changed the name and removed the quotes on duration) and also within the developers tools → services.
Can you send the action via the developers tools → services ?

Second question:
gpsProtectionEnabled & automaticModeEnabled are the both settings one can alter on the WebApp as well, so I fetched and reverse engineered the corresponding api calls. Once I found out the calls, I displayed and marked them as switches and issuing the update calls on switch toggle. If the setting is able to be updated via True/False, I can set the field as switch in maps.py.

Third Question:
Here you can see a list on (theoretically) adjustable settings via the api. Many of these are not simple on/off settings and so cannot be implemented as switches.


allsettings

Fourth Question:
I have no idea how this needs to be interpreted. Mine is showing “-16”. Maybe someone else have an idea. I am returning most of the plain api fields and stripping out a few unnecessary ones. Maybe this is a candidate as well.

Do you guys experience timeout errors in your Home Assistant logs regarding the imow sensors? I get quite lot since yesterday and wondering if it’s just me. What Interval settings are you guys using?

Best
Chris

Regarding the commands:
I have tried the developers console and ran the following command in yaml:

service: stihl_imow.intent
data:
   action: startMowingFromPoint
   mower_name: Toon
   duration: 30

The error I get is: "Failed to call service stihl_imow.intent. Unknown error.

The log says:

Logger: homeassistant.helpers.script.websocket_api_script
Source: custom_components/stihl_imow/services.py:97 
Integration: STIHL iMow 
First occurred: 20:33:33 (2 occurrences) 
Last logged: 20:34:05

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 368, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 568, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
    await handler.job.target(service_call)
  File "/config/custom_components/stihl_imow/services.py", line 32, in async_call_intent_service
    await intent_service(hass, entry, service_call)
  File "/config/custom_components/stihl_imow/services.py", line 97, in intent_service
    await mower_state.intent(
  File "/usr/local/lib/python3.8/site-packages/imow/common/mowerstate.py", line 118, in intent
    response = await self.imow.intent(
  File "/usr/local/lib/python3.8/site-packages/imow/api/__init__.py", line 351, in intent
    response = await self.api_request(url, "POST", payload=payload)
  File "/usr/local/lib/python3.8/site-packages/imow/api/__init__.py", line 289, in api_request
    raise e
  File "/usr/local/lib/python3.8/site-packages/imow/api/__init__.py", line 281, in api_request
    payload_ = await self.http_session.request(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 625, in _request
    resp.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1000, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url=URL('https://api.imow.stihl.com/mower-actions/')

I only have one time out error in three hours. My setting is 120 seconds.

The sensor for suggestedMowingTime perhaps could be a counter. My mower takes about 90 minutes for a pass, which includes about 10 minutes for returning home. I just do not understand the minus sign.

I understand the switches. Some sensors are true/false; others are 0 or 1 and still other have more options. Of the true/false sensors, I’d like switches for:

asmEnabled
childLock
corridorMode (is 0/1 not true/false)
smartLogicSmartNotification
smartLogicWeatherForecastEnabled

I was running two instances of the iMow integration, an older version (0.1.1) from before the command options and the latest release 1.0.1 (in two different HA servers).
The two releases do not show the same data. Release 0.1.1 is in sync with the app. Release 1.0.1 is not. It seems the latest release updates at time of latest geo position update only, but release 0.1.1 actually has more up to date data (also updates on changing battery level). The diference in timing is a few hours, so is material.


I then removed the second instance and upgraded the former to 1.0.1. But this version does not seem to do any updates, as far as I can see, while the older version did so frequently. It now only updates if I restart HA. I also tested by switching off smart notifications in the app, but this does not change the sensor in HA. I own an 632 C model. I have reinstalled with 30 sec update and 1 min update but to no avail. The sensors do not update. In addition, the mower has gone offline, maybe because there is too much data traffic?

In addition battery level now shows as text rather than a number. For now I converted to to number format. But without, this impacts lovelace’s graphic options (no graph in history).

Still did not get the mow command to work.

Hi @ChrisHaPunkt,

I just installed v1.0.1 and it works great - much better sensor design! Now I need less templates :slight_smile: .

One problem I just noticed: I removed the integration and updated the integration in HACS. When activating the integration in HA, I defined the polling interval to 30s. Now most sensors are getting “unavailable” around every minute.

Would it make more sense to increase the polling interval to 1m or 2m?

PS: I am using MI 422 PC.

Cheers, red

Hey guys, I will look into this on the weekend. Sry for the delay, hell of a week so far…

1 Like

Hi Red,
Are your sensors updating, especially the battery sensor? Because mine is not.
Mine are only updating when I restart HA.

I also noticed that the robot mower was taken offline, even though it is in STD energy setting. Maybe because we update too often. I changed update interval to 300 sevonds with the 1.0.2 release but to no avail. Maybe this will reset end of day? I hope so.

Thanks,

Hi @Jan_Willem_Maas,

It might be that the sensors don’t get an updated. But currently my imow got stuck. Since I am not at home I can only check this weekend. I will let you know.

Cheers, red

It’s true. The sensors are not updated at the moment. In the meantime I changed the polling interval to 60s. Did not even work. Red

HI folks,
sorry for the inconvenience, I will spend more time today and also reaching out to STIHL.