Git Product home page Git Product logo

gardena2mqtt's People

Contributors

dependabot[bot] avatar domochip avatar nce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gardena2mqtt's Issues

TypeError: '<=' not supported between instances of 'str' and 'int'

When trying to start the docker instance I get the following error:

07:59:13: ===== Connection To MQTT Broker =====
Traceback (most recent call last):
File "/app/gardena2mqtt.py", line 226, in
mqttclient.connect(mqtthost, mqttport)
File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 939, in connect
self.connect_async(host, port, keepalive,
File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1006, in connect_async
if port <= 0:
TypeError: '<=' not supported between instances of 'str' and 'int'

The credentials are correct as well as the hostname of the MQTT-server.

`grant_type` is invalid

I'm getting an error when trying to connect to the API:
Any ideas on what it could be?

11:26:37: ===== gardena2mqtt v1.0.2 =====
11:26:37: ===== Prepare MQTT Client =====
11:26:37: ===== Prepare SmartSystem Client =====
11:26:37:  - create
11:26:37:  - authenticate
Traceback (most recent call last):
  File "/app/gardena2mqtt.py", line 210, in <module>
    smart_system.authenticate()
  File "/usr/local/lib/python3.9/site-packages/gardena/smart_system.py", line 115, in authenticate
    self.token = self.oauth_session.fetch_token(
  File "/usr/local/lib/python3.9/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.9/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 429, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 425, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 432, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 402, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.UnauthorizedClientError: (unauthorized_client) Unauthorized client: `grant_type` is invalid

No success with compose file

I am using a compose file to start docker container.

Compose file here on github is:

version: '3'
services:
  gardena2mqtt:
    container_name: gardena2mqtt
    image: domochip/gardena2mqtt
    devices:
    - /dev/serial/by-id/usb-HUAWEI_HUAWEI_Mobile-if00-port0:/dev/mobile
    environment:
    - GARDENA_USER=GardenaUserName
    - GARDENA_PASSWORD=GardenaPassword
    - GARDENA_APIKEY=GardenaApiKey
    - HOST=192.168.1.x
    - PORT=1883
    - PREFIX=gardena2mqtt
    - CLIENTID=gardena2mqttclid
    - USER=mqtt_username
    - PASSWORD=mqtt_password
    restart: always

Questions on that:

  1. Is the device definition needed? I do not think so.
  2. Where can I provide the api application secret?

If I try to start a docker container with the above compose file (without device information) and I got the following log response:

13:17:09: ===== gardena2mqtt v1.0.2 =====
13:17:09: ===== Prepare MQTT Client =====
13:17:09: ===== Prepare SmartSystem Client =====
13:17:09:  - create
13:17:09:  - authenticate
Traceback (most recent call last):
  File "/app/gardena2mqtt.py", line 210, in <module>
    smart_system.authenticate()
  File "/usr/local/lib/python3.9/site-packages/gardena/smart_system.py", line 115, in authenticate
    self.token = self.oauth_session.fetch_token(
  File "/usr/local/lib/python3.9/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.9/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 429, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 425, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 432, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 402, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.UnauthorizedClientError: (unauthorized_client) Unauthorized client: `grant_type` is invalid

Without providing the application secret that can not work I guess ...

Changing location name / Need to wait

Hi, excellent job! Easy access via MQTT is really useful.

I had a problem getting the code to work. After a while I found that the location names during the subscription phase were set to "My Garden", while after the first round of device updates (right after setting up MQTT) it changed to "GARDENA smart Garden". Due to the subscription of wrong location names receiving commands did not work.

I guess it's a problem of the Gardena API. A little workaround of moving the "subscribe_everything" call right after "smart_system.start_ws" and a delay of 60 secs solved the problem. Anyone else having the same issue? Or something that needs to be adapted in the code? Thanks!

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.