jonkristian / alko

AL-KO Robolinho component for Home Assistant
MIT License
17 stars 3 forks source link

Implement mowing window #8

Open jonkristian opened 4 months ago

jonkristian commented 4 months ago

@udosw has already started some work around this. Adding it as a separate issue for clarity, as I'm sure this is something we would want to see added to the integration.

          I started with requesting the mowingWindows to see the structure of the json:

curl -s -X GET -H "Authorization: Bearer $TOKEN" -H "Accept: application/json" https://api.al-ko.com/v1/iot/things/${thingname}/state/reported | jq -r .mowingWindows This results in:

{
  "monday": {
[...]
  "sunday": {
    "window_1": {
      "activityMode": false,
      "marginMode": false,
      "startHour": 8,
      "startMinute": 0,
      "duration": 330,
      "entryPoint": 0,
      "narrowPassageMode": false
    },
    "window_2": {
      "activityMode": false,
      "marginMode": false,
      "startHour": 13,
      "startMinute": 30,
      "duration": 330,
      "entryPoint": 0,
      "narrowPassageMode": false
    }
  }
}

So the code to set a mowingWindow to active is:

curl -s -X PATCH -H "Authorization: Bearer $TOKEN" -H "Accept: application/json" https://api.al-ko.com/v1/iot/things/${thingname}/state/desired -d '{"mowingWindows": {"sunday": {"window_2": {"activityMode": true}}}}' You can even see the marker change from grey to red in the inTouch app realtime.

Originally posted by @udosw in https://github.com/jonkristian/alko/issues/6#issuecomment-2209501253