If you like it, please consider a donation:
An adapter for GARDENA smart system using official GARDENA smart system API and service.
The adapter allows the development of an application (e.g. with VIS) that can be used in parallel with the official GARDENA app. The adapter and its additional features do not affect any of the basic functions of the GARDENA app and vice versa.
The adapter is not a complete replacement for the GARDENA app, but an addition to integrate the GARDENA devices into a smart home with ioBroker. The most important actions can be carried out with the adapter. It also offers the opportunity to implement your own ideas that are not possible with the GARDENA app.
- GARDENA smart SILENO robotic lawnmowers
- GARDENA smart Irrigation Control
- GARDENA smart Pressure Pump
- GARDENA smart Water Control
- GARDENA smart Power Adapter
- GARDENA smart Sensor
For more information about the devices see at GARDENA German website and here in English.
To use this adapter you need two things:
- an GARDENA smart system account
- an GARDENA application key
To get both things please go to https://developer.husqvarnagroup.cloud/docs#/docs/getting-started/.
Note:
-
If you already have a Husqvarna Automower® Connect or a GARDENA smart system account, you can Sign In with that account and continue with Step 2, Create application to get the application key.
And it's almost certain that you have an account. Please use the same account as for the GARDENA app in which your GARDENA devices are registered. Otherwise you will not get access to your devices.
-
Make sure that you've connected the application (from Step 2) to the API's
- Authentication API and
- GARDENA smart system API.
And of course you need a running ioBroker installation and you should own at least one GARDENA smart device.
- ioBroker smartgarden adapter for GARDENA smart system
- Supported devices
- Requirements
- Table of Contents
- Installation
- Setup adapter
- Getting support
- Data points of the adapter
- Rate Limits
- Irrigation not allowed while mowing
- Wishes for data points
- Note
- Changelog
- Credits
- License
Adapter is available
- at npm: Install with
npm install iobroker.smartgarden
- at GitHub under https://github.com/jpgorganizer/ioBroker.smartgarden. An description how to install from GitHub is available here (German language).
-
Install the adapter
-
Create an instance of the adapter
-
Check and complete instance configuration
If you change any value of those settings please restart your adapter.
3.1 Edit username, password and application key in main instance configuration
Parameter Description user name user name for GARDENA smart system password corresponding password API Key API Key (application key), e.g. under Requirements Please note that password and application key are encoded and stored within the adapter and become just decoded for authentication with the GARDENA application host.
3.2 Verify default values of miscellaneous settings and switch on/off options in instance configuration. For most users the default values will be ok.
Parameter Description pre-define states pre-define all states of Gardena API regardless they are currently transmitted; switch on or off; if switched on then all states of the GARDENA smart system API are created regardless if they are currently transmitted by GARDENA service or not; default: off; (new in v0.4.0) forecast use forecast for charging time and mower remaining time; switch forecast charging and mowing time of mower on/off; default: off; (new in v0.5.0) cycles number of MOWER history cycles; you can use any number from 3 (minimum), but 10 (default) seems to be a good value; only relevant if the above 'forecast' is on; (new in v0.5.0) irrigation check Use the check whether irrigation is allowed while mowing; switch on/off; default: off; (new in v0.6.0) 3.3 Verify default values of systems settings and switch on/off options in instance configuration. Most users will not have to change anything on this tab.
Parameter Description Loglevel Loglevel: 0 = no log, 1 = some logs, 2 = some more logs, 3 = all logs; default: 0 monitoring Rate Limits use monitoring for the rate limits of Gardena smart system API; switch on/off; default: off ping frequence Frequence for sending Ping's to Gardena Webservice (in seconds); default: 150 auth factor Factor for validity of authentication token; default: 1.001 Auth-URL Authentication host URL; default: https://api.authentication.husqvarnagroup.dev Base-URL Webservice Base-URL; default: https://api.smart.gardena.dev TestVar use test variable for debug; switch on/off; default: off
To get help read this README and the FAQ carefully. If you need further support please join the ioBroker forum thread.
The adapter is designed to monitor and control GARDENA smart system devices.
For this there will be one LOCATION
and one or many DEVICE
's.
For each DEVICE
there will be
- one
SERVICE_COMMON_<id>
and - one or more
SERVICE_<servicelink_type>_<id>
.
Where <servicelink_type>
is a type description for the
device, for example MOWER or VALVE and <id>
is a (encoded)
GARDENA device id used by the API.
See description for ServiceLink at
https://developer.husqvarnagroup.cloud/apis/GARDENA+smart+system+API#/swagger.
Controlling/monitoring for each device is possible via the
SERVICE_<servicelink_type>
listed in the following table. The
SERVICE_COMMON
provides general information about the device.
device | SERVICE_<servicelink_type> |
---|---|
smart SILENO robotic lawnmower | SERVICE_MOWER and SERVICE_COMMON |
smart Irrigation Control | SERVICE_VALVE_SET, SERVICE_VALVE and SERVICE_COMMON |
smart Pressure Pump | SERVICE_VALVE and SERVICE_COMMON |
smart Water Control | SERVICE_VALVE and SERVICE_COMMON |
smart Power Adapter | SERVICE_POWER_SOCKET and SERVICE_COMMON |
smart Sensor | SERVICE_SENSOR and SERVICE_COMMON |
If you need more information about the data points please have a look at https://developer.husqvarnagroup.cloud/apis/GARDENA+smart+system+API#/swagger. There you'll find a description for every data point; except for those which are marked as data points of the adapter and not of the GARDENA smart system API.
The adapter creates its own data points for various features / options when the feature is selected. These data points are not automatically deleted when the feature is deselected. If you no longer need these data points, they must be deleted by hand.
The adapter doesn't change any values transmitted by the GARDENA smart API. The only thing that is done (from version 1.0.0) is to check the type of timestamps and numbers.
check for | description |
---|---|
timestamps | all timestamps are given in UTC; if a received timestamp is not a valid timestamp, 01 Jan 1970 00:00:00Z (Unix time zero) is used instead. So if you see this date/time please report. |
numbers | if a number is not a valid number, -1 is used instead. So if you see this number please report. |
To control the device use data point
-
activity_control_i
This data point is generated by the adapter and is not required due to the GARDENA smart system API.
Change this data point to start the mower.
- To start for a defined time set the value to the planned duration in seconds (please use multiples of 60)
- for automatic operation set string
START_DONT_OVERRIDE
- to cancel the current operation and return to charging station use
string
PARK_UNTIL_NEXT_TASK
- to cancel the current operation, return to charging station and ignore
schedule use string
PARK_UNTIL_FURTHER_NOTICE
All other data points are just for monitoring and information.
Special data points:
-
activity_mowing_i
This data point is generated by the adapter and is not required due to the GARDENA smart system API.
This data point shows two different states for the mower:
true
: mowing orfalse
: not mowing.
This data point can be used for further actions where it is important to know whether the mower is safely on the lawn or not.
Depending on the value of data point
activity_value
this data point is set. Please see following table for details.activity_value
activity_mowing_i
OK_CHARGING
The mower has to be mowing but insufficient charge level keeps it in the charging station.false PARKED_TIMER
The mower is parked according to timer, will start again at configured time.false PARKED_PARK_SELECTED
The mower is parked until further notice.false PARKED_AUTOTIMER
The mower skips mowing because of insufficient grass height.false PAUSED
The mower is in a waiting state with hatch closed.false OK_CUTTING
The mower is cutting in AUTO mode (schedule).true OK_CUTTING_TIMER_OVERRIDDEN
The mower is cutting outside schedule.true OK_SEARCHING
The mower is searching for the charging station.true OK_LEAVING
The mower is leaving charging station.true NONE
No activity is happening, perhaps due to an error.true all other values true -
batteryState_chargingTime_remain_i
(under SERVICE_COMMON...) and
activity_mowingTime_remain_i
(under SERVICE_MOWER...)Both data points are generated by the adapter and are not required due to the GARDENA smart system API.
Those data points show an forecast for remaining charging and mowing time in seconds of the mower. They are only created when the function is selected in the instance configuration.
To forecast a value an history of the last few charging and mowing cycles is saved in two states
info.saveMowingHistory
andinfo.saveChargingHistory
.This feature can be switched on/off in adapter instance configuration along with the number of saved charging and mowing cycles in history.
To put this function into operation, please make sure that at least one cycle of mowing and charging runs without errors (e.g. not interrupted manually or sensor control). It is better if at least three runs are completed without errors. This function tries to recognize the normal case and initially assumes that the next process is a normal case. If this is faulty, then this faulty run is regarded as a normal case and the runs that then pass through normally as a fault case. If there is an error during the run, please stop the adapter, delete the two data points and start again.
For more information about general forecasting mechanisms see FORECAST.md.
Notes:
-
Forecast values are only available if at least one complete charging and mowing cycle is saved in history.
-
The history is saved under
info
so that if theLOCATION
needs to be deleted, e.g. in the event of a future update, it is not lost. -
If you disconnect your mower from the GARDENA smart system and reconnect it again the history is lost, because your mower get's a new id within the GARDENA smart system. This means that the adapter cannot recognize the mower as the previous mower - may be it's a second one. In this case it is recommended to delete these two data points and to restart the adapter so that the previous (now old) history sets are not constantly read and written. The adapter then begins to build a new history.
-
This function should work for more than one mower, but it is not tested (I can't do that, because I've only one mower). If you have more than one mower please test and report errors and of course report if it works as intended. Thanks in advance for that.
-
-
lastErrorCode_value
Please pay special attention to data point
lastErrorCode_value
. A description of possible values can be found at https://developer.husqvarnagroup.cloud/apis/GARDENA+smart+system+API#/swagger, see "MowerService - lastErrorCode"
To control the device use data point
-
stop_all_valves_i
This data point is generated by the adapter and is not required due to the GARDENA smart system API.
Change this data point to stop all valves.
- To stop all valves immediately use string
STOP_UNTIL_NEXT_TASK
Note: Do not display the value of this data point in your application, as the value is mostly undefined. Furthermore, this data point cannot serve as a trigger for your own actions, because it is just set to value null after the command was triggered.
- To stop all valves immediately use string
All other data points are just for monitoring and information.
To control the device use data point
-
duration_value
Change this data point to start the valve.
-
To start for a defined time set the value to the value in seconds (please use multiples of 60).
Note: There are some limitations for the allowed values. Please report if you see other limitations.
device limit GARDENA smart Irrigation Control 3540 seconds (59 minutes) GARDENA smart Pump 36000 (10 hours) GARDENA smart Water Control 36000 (10 hours) -
To cancel the current watering and continue with the schedule use string
STOP_UNTIL_NEXT_TASK
-
To skip automatic operation until specified time, the currently active operation might or might not be cancelled (depends on device model) use string
PAUSE_<number_of_seconds>
, e.g.PAUSE_86400
to pause for 24 hours (please use multiples of 60) -
To restore automatic operation if it was paused use string
UNPAUSE
-
-
irrigationWhileMowing_allowed_i
andirrigationWhileMowing_mowerDefinition_i
This data points are generated by the adapter and are not required due to the GARDENA smart system API.
Those data points give control over the feature Irrigation not allowed while mowing. They are only created when the function is selected in the instance configuration. For description of this feature see chapter Irrigation not allowed while mowing.
All other data points are just for monitoring and information.
Special data point:
-
duration_leftover_i
This data point is generated by the adapter and is not required due to the GARDENA smart system API.
The value describes the number of minutes till the valve is closed and watering stops.
- An integer, one (
1
) or more. null
if undefined
- An integer, one (
To control the device use data point
-
duration_value
Change this data point to start the power socket.
- To start for a defined time set the value to the value in seconds (please use multiples of 60)
- To switch on the device forever please use the string
START_OVERRIDE
. - To stop the device use
STOP_UNTIL_NEXT_TASK
. - To skip automatic operation until specified time. The currently active operation
will NOT be cancelled. use string
PAUSE_<number_of_seconds>
, e.g.PAUSE_86400
to pause for 24 hours (please use multiples of 60) - To restore automatic operation if it was paused use string
UNPAUSE
All other data points are just for monitoring and information.
Special data point:
-
duration_leftover_i
This data point is generated by the adapter and is not required due to the GARDENA smart system API.
The value describes the number of minutes till the power socket is shut off.
- An integer, one (
1
) or more. null
if undefined
- An integer, one (
No control functions available.
All data points are just for monitoring and information.
The SERVICE_COMMON
provides general information about the device.
Description is integrated into description of other SERVICE_... where
necessary.
There are some limits you shoud be aware of. Please see chapter Rate Limits in README of GARDENA smart system API description.
To help you to see if you hit those rate limits you can switch on monitoring in instance configuration with parameter monitoring Rate Limits.
If you've enabled monitoring state info.RateLimitCounter
gets actualized with every request.
This state saves a data structure with the number of requests per month, day, hour and for
the last 30 and 31 days.
The structure is in JSON and looks like
{
"2020": { <<< year
"2020-08": { <<< month
"count": 21, <<< number of requests for month
"2020-08-27": { <<< day
"11": { <<< hour
"count": 3 <<< number of requests for hour
},
"12": { <<< hour
"count": 13 <<< number of requests for hour
},
"count": 16 <<< number of requests for day
},
"2020-08-28": { <<< day
"14": { <<< hour
"count": 5 <<< number of requests for hour
},
"count": 5 <<< number of requests for day
}
}
},
...
"last30days": {
"count": 2021 <<< number of requests in last 30 days
},
"last31days": {
"count": 2098 <<< number of requests in last 31 days
}
}
Note:
- That hour is hour of time in UTC
- That the actual number of requests may be higher. Especially as long as the respective period is not fully covered by the monitoring.
- That this structure becomes very large and is never deleted by the adapter. So please delete it manually from time to time or switch off monitoring - at least if you don't have any issues with the rate limits.
If you have both a mower and an irrigation system with pop-up sprinklers, there is a risk that your mower will run into a pop-up sprinkler while the irrigation is running and damage it or cause damage itself.
To prevent this, the irrigation system or better individual valves should be switched off when the mower is mowing.
With this function it is possible to stop irrigation when the mower is on the lawn. This can be defined separately for each valve.
One or more mowers can be defined for each valve, for which the valve is not allowed to be open while the mower is mowing. Basically, the mower has priority over irrigation, i.e. if the conflict arises that the mower is mowing and a valve is open, the valve is closed and a corresponding warning is set.
Additionally it is possible to define that a valve should never open regardless of a mower. E.g. can be used if a valve or the pipe behind it is damaged.
The whole check can be switched on or off in instance configuration with parameter irrigation check.
There are three data points available for each SERVICE_VALVE
.
They are used for configuration and for reporting warnings.
data point | writeable | Description of data points |
---|---|---|
irrigationWhileMowing_allowed_i |
yes | set to false if it should be checked if irrigation is allowed while the mower is mowing on the lawn, true otherwise |
irrigationWhileMowing_mowerDefinition_i |
yes | one or more id's of SERVICE_MOWER which get checked. Format of mower id see below. There is a special code IRRIGATION_FORBIDDEN meaning that the valve is always closed regardless of a mower. If more than one id should be set then separate them by semicolon (; ). |
irrigationWhileMowing_warningCode_i |
no | warning code is set if valve opens. Possible warning codes see next table. If more than one warning is set, codes are concatenated with + (e.g. STOPPED+UNKNOWN_MOWER ). |
-
mower id format
smartgarden.0.LOCATION_xxxxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxxxxxxxxxx.DEVICE_xxxxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxxxxxxxxxx.SERVICE_MOWER_xxxxxxxx-xxxxxx-xxxxxx-xxxxxxxxxxxxxxxxxxxxx
You can copy this mower id from the objects tab of ioBroker, see red arrow in the following picture.
-
warning codes
warning code description NO_WARNING
no warning, valve opened UNKNOWN_MOWER
wrong mower id in irrigationWhileMowing_mowerDefinition_i
STOPPED
valve automatically closed because mower is mowing FORBIDDEN
valve closed because special code IRRIGATION_FORBIDDEN
is set in data pointirrigationWhileMowing_mowerDefinition_i
This function is runnig every time when
- a valve becomes opened or
- a mower starts mowing
It doesn't run when you change the values in the data points listed above.
That means: if there is a conflict situation and you change
irrigationWhileMowing_allowed_i
from true
to false
, the conflict is not
recognized and the conflict will continue. The same behaviour applies to a
change of irrigationWhileMowing_mowerDefinition_i
.
This feature cannot prevent a valve from opening while the mower is mowing. This can e.g. done manually through the GARDENA app or automatically through a schedule.
This function can only close the valve as quickly as possible in the event of a conflict. And a conflict may not be recognized either. So it can happen that water is let through. E.g. it cannot be prevented that the pop-up sprinklers extend and that the mower hits the pop-up sprinklers, but the likelihood that this will happen has been minimized. So it is up to your application to make sure that this conflict will never happen.
This adapter reports every value as a data point that is supplied via the GARDENA smart system API. If someone wants more values, please contact GARDENA and inform them that this value will also be included in the API. To do this, please go to Contact us & Leave feedback in the footer on the GARDENA Developer Portal.
This is a private project. I am not in any association with GARDENA or Husqvarna.
- (jpgorganizer)
- monitoring rate limits, see chapter Rate Limits and discussion at Issue 18
- (jpgorganizer)
- better reconnection to GARDENA smart system server in case of your internet connection was broken
- textual changes in io-package.json
- improved README and FAQ
- (jpgorganizer)
- code rework, no functional change expected
- support
PAUSE
for SERVICE_VALVE, SERVICE_POWER_SOCKET. e.g. Issue 14 - internal representation for all timestamps changed from format like
2020-05-26T05:03:47.613+0000
to2020-05-26T05:03:47.613Z
to support Safari browser e.g. Issue 12. - support forecast values for mower id's in format with suffix,
e.g.
d8a1faef-2ee3-421d-a3f8-f8ed577c2ad3:suffix
, e.g. Issue 12 - making the adapter more fault tolerant at startup, e.g. trimming whitespaces from username, etc.
- README: new chapter Getting support,
- README: chapter Known Errors deleted, should be resolved by GARDENA
- README: links to GARDENA/Husqvarna developer portal adjusted to the new address
- (jpgorganizer)
- new feature Irrigation not allowed while mowing, for detailed description see Irrigation not allowed while mowing; e.g. Issue 5
- rework instance config dialog
- improvement of documentation
- (jpgorganizer)
- some corrections (sensor, typo)
- integration of travis-ci
- (jpgorganizer)
-
MOWER: forecast for remaining charging time and remaining mowing time integrated, e.g. Issue 1
-
IMPORTANT CHANGE for existing users: the id for LOCATION, all DEVICE's and all SERVICE's has changed due to support of History adapter. (History adapter cannot handle id's with
%
(percent) character within id's, although the%
is not forbidden in id's in ioBroker), e.g. Issue 8.So you must delete all states of the adapter instance to install this release and please check your application carefully for necessary adjustments regarding the change of the id names.
-
devices Water Control and Smart Pump tested (many thanks to user gammler2003 and xengosam at ioBroker Forum for testing)
-
some code rework and improvement of documentation
-
dependency corrected, important for js-controller v3, e.g. Issue 7
-
adapter now available at npm
-
- (jpgorganizer)
- error missing SENSOR data fixed (many thanks to user dslraser and muckel at ioBroker Forum for testing)
- (jpgorganizer)
- Dependency get's resolved now
- (jpgorganizer)
- NOTE: with this version an additional dependency is necessary at runtime.
If it does not get installed together with the installation of this adapter,
please install seperately with
npm install https://github.com/jpgorganizer/ioBroker.utils
ornpm i @jpgorganizer/utils
- NOTE: you must delete all states of the adapter instance to install this release and please check your application carefully for necessary adjustments regarding type/role changes (see below)
- data types of (nearly) all data points adjusted for compliance with
ioBroker guidance:
- states now have special ioBroker type and role instead of former
string
/text
where applicable, e.g.number
/value.battery
forbatteryLevel_value
, see Issue 3
- states now have special ioBroker type and role instead of former
- data point
activity_value_i
replaced byactivity_mowing_i
with type/roleboolean
/indicator.working
:true
means mowing,false
means not mowing - possibility to pre-define states integrated, see new switch
PreDefine States
in adapter/instance configuration, see Issue 2 - states are readonly now; except states for commands, see Issue 4
- input field for
useTestVariable
in adapter/instance configuration switched to a checkbox (former: text); please check your settings - error in command
stop_all_valves_i
in VALVE_SET fixed
- NOTE: with this version an additional dependency is necessary at runtime.
If it does not get installed together with the installation of this adapter,
please install seperately with
- (jpgorganizer)
- create all states read/write
- error TypeError: Cannot read property 'val' of null with useTestVariable fixed
- (jpgorganizer)
- IMPORTANT : data point for MOWER control (command) changed from
duration_value
toactivity_control_i
- rework leftovertimer
- improved error handling
- improved logging (see loglevel in adapter configurations)
- IMPORTANT : data point for MOWER control (command) changed from
- (jpgorganizer) initial release
smartgarden logo: http://www.freepik.com Designed by Freepik
Copyright (c) 2020 jpgorganizer, https://github.com/jpgorganizer
smartgarden by jpgorganizer is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC-BY-NC-SA-4.0) Based on a work at https://github.com/jpgorganizer/ioBroker.smartgarden.