Gardena smart system + Home assistant?

Hey, after updating to 0.72 it seems this has stopped working. Got any idea what can have caused this?

2018-06-25 23:00:25 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform gardena_smart,
Traceback (most recent call last):,
File “/usr/src/app/homeassistant/helpers/entity_platform.py”, line 129, in _async_setup_platform,
SLOW_SETUP_MAX_WAIT, loop=hass.loop),
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for,
return fut.result(),
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run,
File “/config/custom_components/sensor/gardena_smart.py”, line 39, in setup_platform,
add_devices([gardena_smart(username, password, location_id, device_id)]),
File “/config/custom_components/sensor/gardena_smart.py”, line 59, in init,
self.update(),
File “/usr/src/app/homeassistant/util/init.py”, line 319, in wrapper,
result = method(*args, **kwargs),
File “/config/custom_components/sensor/gardena_smart.py”, line 91, in update,
mower_info = self.gardena.get_mower_info(self.gardena.get_devices_in_catagory(‘mower’)[0]),
mower_info[‘error’] = self.get_mower_error(id)[0],
File “/config/deps/gardena_smart/init.py”, line 107, in get_mower_info,
File “/config/deps/gardena_smart/init.py”, line 80, in get_mower_error,
IndexError: list index out of range,
return (error[2][‘value’], error[7][‘value’]),
2018-06-25 23:00:26 ERROR (SyncWorker_0) [homeassistant.components.coinbase] Authentication error connecting to coinbase: APIError(id=authentication_error): request timestamp expired,
2018-06-25 23:00:28 ERROR (MainThread) [homeassistant.setup] Error during setup of component arlo,
2018-06-25 23:00:26 ERROR (MainThread) [homeassistant.setup] Setup failed for coinbase: Component failed to initialize.,
File “/usr/src/app/homeassistant/setup.py”, line 146, in _async_setup_component,
component.setup, hass, processed_config) # type: ignore,
File “/usr/src/app/homeassistant/components/arlo.py”, line 48, in setup,
result = self.fn(*self.args, **self.kwargs),
conf = config[DOMAIN]

Hi MortenB,

actually, it it’s not 0.72 causing the problem but the “numbering/order” of the JSON response abilities from gardena seems to have changed since you first used rcastbergs gardena integration.

Therefore, a slightly adapted code fragment for __init__py:

def get_mower_name(self, id):
    return self.device_info[id]['name']
def get_mower_device_state(self, id):
    return self.device_info[id]['device_state']
def get_mower_last_online(self, id):
    return self.device_info[id]['abilities'][0]['properties'][5]['value']
def get_mower_battery_level(self, id):
    return self.device_info[id]['abilities'][1]['properties'][0]['value']
def get_mower_charging_status(self, id):
    return self.device_info[id]['abilities'][1]['properties'][1]['value']
def get_mower_radio_quality(self, id):
    return self.device_info[id]['abilities'][2]['properties'][0]['value']
def get_mower_radio_status(self, id):
    return self.device_info[id]['abilities'][2]['properties'][2]['value']
def get_mower_radio_connection_status(self, id):
    return self.device_info[id]['abilities'][2]['properties'][1]['value']
def get_mower_manual_mode(self, id):
    return self.device_info[id]['abilities'][4]['properties'][0]['value']
def get_mower_status(self, id):
    return self.device_info[id]['abilities'][4]['properties'][1]['value']
def get_mower_error(self, id):
    """Return error and last ts"""
    error = self.device_info[id]['abilities'][4]['properties']
    return (error[2]['value'], error[7]['timestamp'])
def get_mower_last_error(self, id):
    return self.device_info[id]['abilities'][4]['properties'][3]['value']
def get_mower_next_source_start(self, id):
    return self.device_info[id]['abilities'][4]['properties'][4]['value']
def get_mower_next_start(self, id):
    return self.device_info[id]['abilities'][4]['properties'][5]['timestamp']
def get_mower_cutting_time(self, id):
    return self.device_info[id]['abilities'][5]['properties'][0]['value']
def get_mower_charging_cycles(self, id):
    return self.device_info[id]['abilities'][5]['properties'][1]['value']
def get_mower_collisions(self, id):
    return self.device_info[id]['abilities'][5]['properties'][2]['value']
def get_mower_running_time(self, id):
    return self.device_info[id]['abilities'][5]['properties'][3]['value']

@rcastberg: thank you for your integration so far!

Cheers,
Markus

Thanks! That fixed my issue :slight_smile: Any plans to expand this integration?

Yes, but my time is veeeery limited, I just moved with my family :slight_smile:

@maralex: I know…time is often very tight but maybe my thread helps.

I opened a feature request for Gardena / Husqvarna integration. It is already integrated in OpenHab. I have the Java source code and a german description of what has to be respected.

This is the thread:

I’m working on a proper home assistant component for the gardena smart ecosystem.
My goal is to make it a default home-assistant component but time is limited so I like to share my progress with you.

Currently I have all the code in a custom_component (which later should become a pypi library), it currently only supports the lawn mower, and registers it as a vacum cleaner.

Project:
https://github.com/wijnandtop/home_assistant_gardena

Setup should be very easy and feedback is welcome :slight_smile:

2 Likes

Had some more time today to work on it, update is available in the git repo.

Added:

  • support for smart sensor
  • support for watering computer added in the underlying library, but not registered in HA yet

Details in the readme within the git repo.

Hi wijnandtop,

I’m running Hass.io 0.77.1 in a docker container on Ubuntu.

I copied the contents of your git repo to /config/custom_components, but when restarting home assistant I get an error message saying:

Fri Aug 31 2018 12:39:17 GMT+0200 (centraleuropeisk sommartid)

Error loading custom_components.gardena. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 94, in get_component
module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/gardena.py", line 16, in <module>
from custom_components.pygardena.account import *
  File "/config/custom_components/pygardena/account.py", line 2, in <module>
from custom_components.pygardena.location import *
  File "/config/custom_components/pygardena/location.py", line 2, in <module>
from custom_components.pygardena.mower import *
  File "/config/custom_components/pygardena/mower.py", line 1, in <module>
from custom_components.pygardena.device import *
  File "/config/custom_components/pygardena/device.py", line 2, in <module>
import objectpath
ModuleNotFoundError: No module named 'objectpath'

Are there any special dependencies and how do I install them?

Thanks!

Good one, I installed this dependency myself during development.

Just updated the code and added them to the requirements of the module, which should result in an auto install of this module (haven’t tested it yet, still want to check the custom_component with a clean install)

Just give the latest version a try! Let me know if it did work and with which device / mower you tried.

B.t.w. did quite some updates last few days, as a result: more reliable updates and support for the Watering computer.

1 Like

I spun up a new test VM, installed hass.io and your custom component, but I had to do pip3.6 install objectpath to get it to work.
I have a smart sileno+ 1600 and I’m able to control it via HA now. :smile:

Thanks!

Would be so good to have gardena smart irrigation control in HA, but i understand it is not supported yet?

Thanks a lot for the project! We just got a smart sileno and we still have do the actual physical install, but at least the smart gateway seems to have connected.

1 Like

Tested on my Sileno Smart City 500, and it seems to work fine :slight_smile: Really hoping youre planning to take this to an official component and continue development on it!

1 Like

Probably won’t work, I don’t own the irrigation device and therefore I cannot do the implementation.
If I own the device it will be an hour work or so :slight_smile:

But if someone owns the device and is able to add support for it, that would be great!

I am only getting Component not found: gardena, when trying out your component @wijnandtop

Did you copy all the files to this folder:

/config/custom_components

Files shouldn’t be in a subfolder!

Hi, I was wondering if the components can communicate directly to the Gardena devices, or does it communicate with the gateway?

It uses the Gardena online API which is not documented but is used by the gardena web interface (and probably the smartphone app).

The gateway connects to the gardena online service as wel. Note that status updates aren’t realtime but the plugin does poll for changes.

Hi, works with this:

?

Yes, after configuring your credentials it should be automatically detected as a switch.

Build the plugin quite a while ago and since it is wintertime over here I haven’t used it for a couple of months, but is should work :slight_smile: