hass-gardena-smart-system icon indicating copy to clipboard operation
hass-gardena-smart-system copied to clipboard

START_DONT_OVERRIDE not available for mower

Open malundqvist opened this issue 5 years ago • 14 comments

I can't find any vacuum service to issue a "resume schedule" command to the mower. Is this possible to add? I believe START_DONT_OVERRIDE is the API command. I used this command to resume scheduled operations after it has stopped raining, with help of IFTTT. IFTTT does not work anymore after adding this component (IFTTT gets logged out frequently) and therefore it would be great to find it in the component.

malundqvist avatar Jul 24 '20 21:07 malundqvist

This is contained in #2 . Issue can be closed.

Jpsy avatar Sep 19 '20 07:09 Jpsy

Hey @Jpsy ,

I made some tests a few monthes ago (related to #2), but from what i remember, you could only resume normal operations. I will have to do some testing, because, for a reason I don't remember, i did't write down my test results :(, and i don't remember the results either :p

But from what I can remember, not all possibilities were covered with the actions, and on was missing (but now my mower does not works as expected, moles cut some lines :p in the garden ...)

grm avatar Sep 27 '20 19:09 grm

Hi @grm,

AFAIR the problem in #2 was, that we did not succeed to find 4 different service calls in HA that would trigger the 4 mower commands that we would like to use. The vacuum integration of HA actually provides 5 calls:

  1. vacuum.start
  2. vacuum.stop
  3. vacuum.return_to_base
  4. vacuum.turn_on
  5. vacuum.turn_off

But unfortunately in all my tests I could only receive 1. to 3. in the custom component, but not 4. and 5. The last two service calls don't make it through to our code and I am not knowledgeable enough to determine the cause.

So we are stuck with three service calls and we had to map only 3 of the 4 desirable commands, which we did. A good mapping for 4 commands is already described in #2.

Jpsy avatar Sep 28 '20 13:09 Jpsy

But unfortunately in all my tests I could only receive 1. to 3. in the custom component, but not 4. and 5. The last two service calls don't make it through to our code and I am not knowledgeable enough to determine the cause.

I think the issue is that StateVacuumEntity is used as base class instead of VacuumEntity. The StateVacuumEntity can't be turned on/off because the status is derived from the current state of the vacuum/mower. That means if the state is on the entity is also on.

crazyfx1 avatar Aug 26 '21 07:08 crazyfx1

The only Gardena API command, which is not working is START_DONT_OVERRIDE. If StateVacuumEntity's turn_on doesn't work, maybe you could implement own function for START_DONT_OVERRIDE? Similar as Husqvarna component's 'husqvarna_automower.park_and_start', see https://github.com/Thomas55555/husqvarna_automower

Or maybe reuse even more of those Husqvarna codes (as Husqvarna and Gardena APIs are similar)?

jlatvala avatar Apr 23 '22 10:04 jlatvala

Well you actually just need to change the base class from StateVacuumEntity to VacuumEntity and then it works.

crazyfx1 avatar Apr 23 '22 11:04 crazyfx1

Well you actually just need to change the base class from StateVacuumEntity to VacuumEntity and then it works.

VacuumEntity is deprecated and will be removed in future releases. Please use or migrate to the StateVacuumEntity https://developers.home-assistant.io/docs/core/entity/vacuum/

jlatvala avatar Apr 23 '22 17:04 jlatvala

That's too bad, maybe it's time for https://github.com/home-assistant/architecture/issues/40

crazyfx1 avatar Apr 23 '22 20:04 crazyfx1

As a workaround, can I easily modify vacuum.start to use START_DONT_OVERRIDE instead of START_SECONDS_TO_OVERRIDE?

I guess changing this self._device.start_seconds_to_override(duration) to this self._device.start_dont_override() could do the trick? (here https://github.com/py-smart-gardena/hass-gardena-smart-system/blob/911ffb9c70fb8cd74922b8b65a6063670699db55/custom_components/gardena_smart_system/vacuum.py#L174 )

Or do I need to change something else too?

(Sorry, I am not familiar with HA implementation or python even have coded a lot in the past (and after that worked as a SW & solution architect the last ~13 years)

jlatvala avatar Apr 24 '22 10:04 jlatvala

I just realized that Gardena API's START_DONT_OVERRIDE (MowerCommand) doesn't require seconds as an attribute. (https://developer.husqvarnagroup.cloud/apis/GARDENA+smart+system+API#/swagger )

But py-smart-gardena library's start_dont_override function has duration as an argument: start_dont_override(self, duration):

Has anyone got this START_DONT_OVERRIDE working using py-smart-gardena library's start_dont_override function? With or without seconds?

jlatvala avatar May 16 '22 15:05 jlatvala

I've already created a PR a month ago to remove the parameter but doesn't seem like it's getting approved soon. https://github.com/py-smart-gardena/py-smart-gardena/pull/122

crazyfx1 avatar May 16 '22 16:05 crazyfx1

I've already created a PR a month ago to remove the parameter but doesn't seem like it's getting approved soon. py-smart-gardena/py-smart-gardena#122

Maybe it is not approved because the build fails (Python 3.7 fails, 3.6 and 3.8 passes). See https://github.com/py-smart-gardena/py-smart-gardena/pull/122/checks?check_run_id=6251911201 and https://app.travis-ci.com/github/py-smart-gardena/py-smart-gardena/jobs/568802980

jlatvala avatar May 17 '22 05:05 jlatvala

The build error is not related to my change, I guess the 3.7 build is generelly at fault. Other PRs fail aswell with 3.7 and I also don't see how my change can fail in a specific python version.

crazyfx1 avatar May 17 '22 05:05 crazyfx1

Hello,

I had not realised that this thread was still updated.

@crazyfx1 i'll have a look into you PR tonight ;) Sorry for the delay.

grm avatar Jun 14 '22 21:06 grm