Open malundqvist opened 4 years ago
This is contained in #2 . Issue can be closed.
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 ...)
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:
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.
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.
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)?
Well you actually just need to change the base class from StateVacuumEntity to VacuumEntity and then it works.
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/
That's too bad, maybe it's time for https://github.com/home-assistant/architecture/issues/40
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)
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_dontoverride function has duration as an argument: _start_dontoverride(self, duration):
Has anyone got this START_DONT_OVERRIDE working using py-smart-gardena library's start_dont_override function? With or without seconds?
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
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
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.
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.
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.