Code Monkey home page Code Monkey logo

hass-gardena-smart-system's People

Contributors

jpsy avatar osks avatar wijnandtop avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

wijnandtop jpsy

hass-gardena-smart-system's Issues

Can't setup integration

Hey,

first of all thanks for building this integration! Much appreciated!

I just installed the integration and cannot configure it, the credential prompt just repeats itself and the following error is logged:

Protokolldetails ( ERROR )
Logger: custom_components.gardena_smart_system.config_flow
Source: custom_components/gardena_smart_system/config_flow.py:132
Integration: gardena_smart_system (documentation)
First occurred: 11:24:58 (2 occurrences)
Last logged: 11:25:56

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/gardena_smart_system/config_flow.py", line 70, in async_step_user
    user_input[CONF_CLIENT_ID])
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/gardena_smart_system/config_flow.py", line 132, in try_connection
    smart_system.authenticate()
  File "/usr/local/lib/python3.7/site-packages/gardena/smart_system.py", line 102, in authenticate
    client_id=self.client_id,
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 360, in fetch_token
    self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client) Client not found 
  • HA 0.110.3
  • Version c230467
  • Gardena Smart System and Auth API connected
  • Verified e-mail/pw/app id via the curl command on the dev page.

Any help is highly appreciated.

Got 3 Sensors and a Smart Irrigation Control for testing.

Cheers

RFC: Additional attribute for mower devices

RFC for a new, combined attribute for mower devices.
I especially ask @osks and @wijnandtop here for feedback.

Currently we have two attributes that both provide information about the current state of the mower: activity and last_error_code. The separation is somewhat artificial, as whenever there is a real error, activity will switch to NONE. Consider the following examples...

Example: Normal operation
image

Example: Error condition
image

In my automations I find myself again and again looking at both attributes to derive the full mower status. In the previous custom component of @wijnandtop we had that information condensed into a single data point - the state of the mower. Working on my automations I come to the conclusion that this was closer to reality than spreading the information over two attributes.

My suggestion is to add (!) a third attribute that will compile the information of both attributes into one. When activity != "NONE", the new attribute would copy activity. Otherwise it would contain last_error_code. The existing attributes would not be touched or removed. We would not lose anything and would gain a condensed data endpoint.

Does this make sense to you?
If you agree, what would be your proposals for the attribute name - e.g. activity_or_error, combined_status, status_unified, ...?

Please comment.
I would create the code and issue a PR.

Testing

This integration requires more testing since I don't own all devices.

Use this issue to ask questions or discuss testing for now.

Irrigation Control: Switch doesn't represent valve status.

Thanks for this Integration!

A valve of the irrigation control could be activated via switch.
And the valve could be closed if you activate the switch an deactivate it within 3 sec.
Afterwards the switch go to off and don't represent the status of the valve.

If you need logs, let me know.

Missing Error status for Gardena Mower

At first a great integration for the husquana/gardena smart system. Thanks for this!
In addition to the great Integration it would be greate if errorcodes (like broken cables etc.) from the mower are shown as seperate sensor or as attribut of the Sileno device.

Can´t find the Integration

I entered the integration under HACS as a custom repository. It then appears there under integration. After pressing Install, the files are also copied to custom_components / gardena_smart_system. In HACS, however, the integration remains there as a new repository. If I now go to Settings / Integrations, I don't find any integration gardena smart sytem that I can set up ?!

Full set of mower commands

Oskar, first and foremost a big THANK YOU for your work!

Over the last days I have tested your component with my Gardena mower (which is my only Gardena Smart component). With my limited knowledge of Python and of the deeper mechanics of HA I have compiled the following details, which are hopefully correct:

The Husqvarna/Gardena API provides 4 mower commands:

  1. START_SECONDS_TO_OVERRIDE - Manual operation, use 'seconds' attribute to define duration.
  2. START_DONT_OVERRIDE - Automatic operation.
  3. PARK_UNTIL_NEXT_TASK - Cancel the current operation and return to charging station.
  4. PARK_UNTIL_FURTHER_NOTICE - Cancel the current operation, return to charging station, ignore schedule.

These 4 are all implemented as methods in your py-smart-gardena2 lib.
But only 2 of them are exposed as HA services by your custom component:

  1. START_SECONDS_TO_OVERRIDE
    through services:
    vacuum.turn_on, and vacuum.start
  2. PARK_UNTIL_NEXT_TASK
    through services:
    vacuum.turn_off, vacuum.return_to_base, and vacuum.stop

My request is to expose all 4 commands.

The rationale is simply that they are needed. There is currently no service to stop the mower permanently (deactivate the schedule) and also no service that would activate the schedule without immediately starting the mower.

IMHO the best mapping would be this:

  1. START_SECONDS_TO_OVERRIDE = vacuum.start
  2. START_DONT_OVERRIDE = vacuum.turn_on
  3. PARK_UNTIL_NEXT_TASK = vacuum.return_to_base
  4. PARK_UNTIL_FURTHER_NOTICE = vacuum.stop and vacuum.turn_off

I tried implementing this myself to create a PR. But unfortunately I found that the turn_off and turn_on service calls never get through to the corresponding methods in vacuum.py of your component. I am far from capable of finding the reasons for that. Without the turn_on/off calls we would have only 3 services left to map 4 mower commands.

If in the end we would have to live with only 3 services, I would recommend the following mapping - which would provide the most important functions for automations:

  1. START_SECONDS_TO_OVERRIDE = vacuum.start
  2. PARK_UNTIL_NEXT_TASK = vacuum.return_to_base
  3. PARK_UNTIL_FURTHER_NOTICE = vacuum.stop

But it would be much more desirable to have all commands exposed.
Please drop a comment if I can help in any way.

Wrong translation or status „cleaning“

I think it depends from the vacuumer python source. I see this not in the translation file
C1062506-D342-4EBB-A52F-ABAF786BB49C
„Reinigen“ in english „ cleaning“ but it shut be named „mähen“ or in english „cutting“
898C98B1-62D6-4AF5-B1C6-FE5D55C1DA09
„Staubsaugerbefehl“ in english „ vacuum command“ shut be named „Rasenmäherbefehl“ or in English „ Lawn mower command“

Unable to add Integration (version f1d5810)

Hi!

The component is added via HACS. When trying to add the Integration Gardena Smart System from the GUI, I enter E-mail, Password and Application Key / Client ID and press Submit. Immediately, the form is emptied.

I see the following in the home-assistant.log:

2020-05-26 16:33:33 ERROR (SyncWorker_9) [gardena.smart_system] 403 : {'message': 'Forbidden'}
2020-05-26 16:33:33 ERROR (MainThread) [custom_components.gardena_smart_system.config_flow] Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/gardena_smart_system/config_flow.py", line 70, in async_step_user
user_input[CONF_CLIENT_ID])
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/gardena_smart_system/config_flow.py", line 133, in try_connection
smart_system.update_locations()
File "/usr/local/lib/python3.7/site-packages/gardena/smart_system.py", line 157, in update_locations
if len(response_data["data"]) < 1:
KeyError: 'data'

Any idea what I might have missed?

Battery sensor: not added as sensor

Battery sensors are added as the type of their "parent".
So for the mower the battery sensor is added as a vacuum.
Battery sensor for a switch is added as a switch.

Probably the sensors should be added from the sensor.py, will try to make a PR.

Serial missing

The serial number is missing in the devices, is there a possibility to add them?

Thanks a lot for the Intergration!

Problem with the Integration

Hi,

When i click on the integration "Gardena Smart System" and enter my API key and password, nothing happens.

I get this error message:

Logger: custom_components.gardena_smart_system.config_flow
Source: custom_components/gardena_smart_system/config_flow.py:132
Integration: Gardena Smart System (documentation)
First occurred: 18:05:30 (1 occurrences)
Last logged: 18:05:30

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/gardena_smart_system/config_flow.py", line 70, in async_step_user
user_input[CONF_CLIENT_ID])
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/gardena_smart_system/config_flow.py", line 132, in try_connection
smart_system.authenticate()
File "/usr/local/lib/python3.7/site-packages/gardena/smart_system.py", line 102, in authenticate
client_id=self.client_id,
File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 360, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
validate_token_parameters(params)
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) The provided access grant is invalid, expired, or revoked.

Can't start the mower

Hi,

many thanks for this integration, very much appreciated. I've unfortunately got an issue with starting the mower. Whenever I try to trigger the mower (play button), it fails with error 502. Note that I had the same issue with the previous fork that Tobias provided.

Below my traceback data:

502 : error communicating with the backend Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service connection.context(msg), File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py", line 1253, in async_call task.result() File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py", line 1288, in _execute_service await handler.func(service_call) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 213, in handle_service self._platforms.values(), func, call, required_features File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 454, in entity_service_call future.result() # pop exception if have File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 597, in async_request_call await coro File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 485, in _handle_entity_call await result File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/vacuum/__init__.py", line 370, in async_start await self.hass.async_add_executor_job(self.start) File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/.homeassistant/custom_components/gardena_smart_system/vacuum.py", line 170, in start self._device.start_seconds_to_override(duration) File "/srv/homeassistant/lib/python3.7/site-packages/gardena/devices/mower.py", line 30, in start_seconds_to_override self.smart_system.call_smart_system_service(self.id, data) File "/srv/homeassistant/lib/python3.7/site-packages/gardena/smart_system.py", line 135, in call_smart_system_service raise Exception(f"{r.status_code} : {response['errors'][0]['title']}") Exception: 502 : error communicating with the backend

Cheers

Support for official HA Integration

Hi sorry if this is the wrong place, but what can we do/help as community that this integration become the status of an official HA Integration? Is there are an pull request in place on the HA side for what we can vote or other ways of support?

Moving this repository

Hi!

@grm reached out to me and wondered if we should work together, which I thought was a great idea. @grm and I have set up a Github organisation (https://github.com/py-smart-gardena) where we will host both the py-smart-gardena and this repository.

The new repository is at https://github.com/py-smart-gardena/hass-gardena-smart-system

Please open issues and pull requests there from now on!

I will also merge my changes in py-smart-gardena2 into py-smart-gardena (https://github.com/py-smart-gardena/py-smart-gardena) and then deprecate/remove py-smart-gardena2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.