Because my pressure pump sensor is broken, the pump was running a lot (expensive watering solution :-( ). I decided to integrate a Shelly PM 1 plus sensor/actor to the circle and remove the pressure pump sensor that normally activates/deactivates the pump.
Nowadays the pump is activated, when the Hydrawise needs it and is deactivated, when it is no longer needed. This small python project realizes just that.
Take care: The server this script is running on, should be in the local area network (LAN) and be able to pull the hydrawise api from the internet and the shelly using its LAN-IP. The Shelly could be triggered using the cloud api, for simplicity i decided against it. Actually my Magic Mirror that uses a raspberry pi is the server I am running this script on ;-)
The poetry
package is needed for this project to install all necessary dependencies. When poetry is available, you just need to install the dependencies using the following command:
poetry install
When this is finished, you may run the script with
poetry run python app.py
To run this on a server, you may have to integrate cron or use pm2.
An example configuration can be seen in cfg/config.example.yml
, just make a copy of it and name it in cfg and name it cfg/config.yml
:
log-level: WARN
hydra-status-url: "https://api.hydrawise.com/api/v1/statusschedule.php"
hydra-api-key: "XXXX-XXXX-XXXX-XXXX"
hydra-sleep: 60
shelly-ip: "http://192.168.12.12/"
shelly-status-url: "rpc/Shelly.GetStatus"
shelly-switch-url: "rpc/Switch.Set"
shelly-switch-id: "0"
log-level
see python.logging doc here, set here as a stringhydra-status-url
see Hydrawise API at the links sectionhydra-api-key
see Hydrawise API at the links sectionhydra-sleep
integer wait time in seconds. If you hit the hydrawise api more than once a minute you may get rate-limitedshelly-ip
the static ip/url for your local shelly actorshelly-status-url
the get status action url, may be constantshelly-switch-url
the set switch action url, may be constantshelly-switch-id
the id of the switch, there are shelly devices with more than one switch