Code Monkey home page Code Monkey logo

domoticz-mqtt2-gardena's Introduction

domoticz-mqtt2-gardena

Python script to status, battery and connectivity data from Gardena using MQTT to Domoticz (or any other MQTT) Tested this on Gardena Sileno City, but should work on all Gardena/Husqvarna mowers

Configuration for Gardena/Husqvarna mower data

Configuration for Gardena mower control

  • Setup Domoticz with MQTT server
  • Install Python3 on your Domoticz server
  • Create folder 'gardena' in /home/pi/domoticz/scripts
  • Copy mower_control.sh and mower_control.pyin the created folder
  • Create 3 dummy devices in Domoticz:
    • Single button: Start mowing
    • Single button: Park until next operation
    • Single button: Park until further notice
  • Edit the button action in Domoticz with On/Off action script://gardena/mower_control.sh "INSERT ACTION KEY HERE"
    • Fill in the action key based on button (for example: script://gardena/mower_control.sh "START_DONT_OVERRIDE"):
      • START_SECONDS_TO_OVERRIDE - Manual operation, use 'seconds' attribute to define duration.
      • START_DONT_OVERRIDE - Automatic operation.
      • PARK_UNTIL_NEXT_TASK - Cancel the current operation and return to charging station.
      • PARK_UNTIL_FURTHER_NOTICE - Cancel the current operation, return to charging station, ignore schedule.

Auto startup

To run the script in the background by default, install it using PM2.

domoticz-mqtt2-gardena's People

Contributors

kdonkers avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

domoticz-mqtt2-gardena's Issues

Start and stop script mower

I've been using the current script for a few weeks now and it works perfect. The only thing I'm missing is the script you're talking about in the todo list. If it's done could you add it to this repository?

Compatibility

Hello,
thanks for the great plug-in.

One question, does it work also with devices without the hardware connection module?

Please advise, thanks

Errors when running the script...

class Client should be updated!

class Client:
    def on_message(self, ws, message):
        x = datetime.datetime.now()
        print("msg ", x.strftime("%H:%M:%S,%f"))
        mqtt_parse(message)
        print(message)
        sys.stdout.flush()

    def on_error(self, ws, error):
        x = datetime.datetime.now()
        print("error ", x.strftime("%H:%M:%S,%f"))
        print(error)

    def on_close(self, ws, close_status_code, close_msg):
        self.live = False
        x = datetime.datetime.now()
        print("closed ", x.strftime("%H:%M:%S,%f"))
        print("### closed ###")
        if close_status_code:
            print("status code: "+close_status_code)
        if close_msg:
            print("status message: "+close_msg)
        sys.exit(0)

    def on_open(self, ws):
        x = datetime.datetime.now()
        print("connected ", x.strftime("%H:%M:%S,%f"))
        print("### connected ###")

        self.live = True

        def run(*args):
            while self.live:
                time.sleep(1)

        Thread(target=run).start()

Websocket and Paho dependency

Errors when running the script python3 gardena.py

File "gardena.py", line 1, in
import websocket
ModuleNotFoundError: No module named 'websocket'

Solution: sudo pip3 install websocket

Successfully installed gevent-21.1.2 greenlet-1.1.0 websocket-0.2.1 zope.event-4.5.0 zope.interface-5.4.0
Successfully installed websockets-9.1
Successfully installed websocket-client-1.1.0

Question: tested with this webversion version??

File "gardena.py", line 7, in
import paho.mqtt.client as mqtt
ModuleNotFoundError: No module named 'paho'

Solution: pip3 install paho-mqtt

Dependency to include is at least worth to mention (and how to solve it)...
I got a litle annoyed by using pip instead of pip3, when trying to install the websocket module... pip is used in case of Python 2, but we have Python 3 here, we should use pip3.

I've added some suggestions to the readme file already ;-)

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.