Git Product home page Git Product logo

pyhusmow's Introduction

pyhusmow

Control your Husqvarna automower using Automower connect API.

Requirements

  • python 3
  • requests
  • python-dateutil

One way to configure the environment to run pyhusmow

pyhusmow requires a recent version of requests so you can use virtualenv to install dependencies without modifying your system:

virtualenv -p python3 husmow_venv
source husmow_venv/bin/activate
pip3 install requests
pip3 install python-dateutil
curl -o husmow.py https://raw.githubusercontent.com/chrisz/pyhusmow/master/husmow.py
python3 husmow.py --help

Then you can run pyhusmow without loading the virtual environment explicitly:

./husmow_venv/bin/python3 husmow.py --help

Commands

Read status of your automower

python husmow.py --login yourmaillogin --password yourpassword status

Start your automower

python husmow.py --login yourmaillogin --password yourpassword control START

Stop your automower

python husmow.py --login yourmaillogin --password yourpassword control STOP

Park your automower

python husmow.py --login yourmaillogin --password yourpassword control PARK

Run HTTP server

You can run a tiny webserver to command your automower using HTTP commands (can be useful for home automation boxes...):

python husmow.py --login yourmaillogin --password yourpassword server

Then you can use GET requests to:

  • start your automower: http://127.0.0.1:1234/start
  • stop your automower: http://127.0.0.1:1234/stop
  • park your automower: http://127.0.0.1:1234/park
  • get the status of your automower: http://127.0.0.1:1234/status returns status as json in the response body

All of these HTTP requests return 200 if the command was successfully sent to Husqvarna server and 500 in case of problem.

You can change the IP address or port using options --address and --port but you shouldn't open this server outside of you local network because this tiny server is not designed to be as secure as common web server.

python husmow.py --login yourmaillogin --password yourpassword server --address 0.0.0.0 --port 2345

To avoid sending too much status requests to Husqvarna server, status is not refreshed before 30 seconds (can be configured using --expire option in seconds).

Save configuration in configuration file

You can save login, password, output_format, log_level in automower.cfg in the directory where you run this script to omit these information from the command line for the next run.

To save information, just type your command with all information and add the option --save to command line:

python husmow.py --login yourmaillogin --password yourpassword --log-level INFO --save control PARK

And the next time you run the command, you can omit these information from the command line:

python husmow.py control PARK

The file 'automower.cfg' is created in the current directory where you run the script and THE PASSWORD IS STORED IN PLAIN TEXT.

Warning

The API and command line are not stable and can change at any time.

Contributors

Special Thanks

I thank moumou for mowing my lawn very well !

pyhusmow's People

Contributors

caselit avatar rost314 avatar tmonjalo avatar

Watchers

James Cloos avatar  avatar

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.