Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #1

Open
wants to merge 4 commits into
base: automower
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/bundles/org.openhab.binding.astro/ @gerrieg
/bundles/org.openhab.binding.atlona/ @tmrobert8
/bundles/org.openhab.binding.autelis/ @digitaldan
/bundles/org.openhab.binding.automower/ @maxpg
/bundles/org.openhab.binding.avmfritz/ @cweitkamp
/bundles/org.openhab.binding.bigassfan/ @mhilbush
/bundles/org.openhab.binding.bluetooth/ @cdjackson @kaikreuzer
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.autelis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.automower</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
Expand Down
32 changes: 32 additions & 0 deletions bundles/org.openhab.binding.automower/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions bundles/org.openhab.binding.automower/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.automower</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.automower/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons
148 changes: 148 additions & 0 deletions bundles/org.openhab.binding.automower/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Automower Binding

This binding communicates to the Husqvarna Automower Connect API in order to send commands and query the state of Husqvarna Automower robots.

## Supported Things

`bridge:` The bridge needs to be configured with credentials and an application key that allows communicating with the Automower Connect Api

`automower:` A single Husqvarna Automower robot

Basically all Husqvarna Automower models with "Automower Connect" support should be supported. It was tested only with a Husqvarna Automower 450X


## Discovery

Once the bridge is created and configured, registered automowers will be discovered automatically


## Thing Configuration

`bridge:`

- appKey (mandatory): The Application Key is required to communication with the Automower Connect Api. It can be obtained by registering an Application on the Husqvarna Website. This application also needs to be connected to the "Authentication API" and the "Automower Connect API"
- userName (mandatory): The user name for which the application key has been issued
- password (mandatory): The password for the given user
- pollingInterval (optional): How often the bridge state should be queried in seconds. Default is 1h (3600s)

Keep in mind that the status of the bridge should not be queried too often. According to the Husqvarna documentation not more than 10000 requests per month and application key are allowed. With the default value of 1h this would mean ~720 requests per month for the bridge state

`automower:`

- mowerId (mandatory): The Id of an automower as used by the Automower Connect Api to identify a mower. This is automatically filled when the thing is discovered
- pollingInterval (optional): How often the current automower state should be polled in seconds. Default is 10min (600s)

Keep in mind that the status of the automowers should not be queried too often. According to the Husqvarna documentation not more than 10000 requests per month and application key are allowed. With the default value of 10min this would mean ~4300 requests per month per automower

## Channels


| channel | type | description |
|----------|--------|------------------------------|
| name | String | (readonly) The name of the Automower |
| mode | String | (readonly) The current mode (MAIN_AREA, SECONDARY_AREA, HOME, DEMO, UNKNOWN) |
| activity | String | (readonly) The current activity (UNKNOWN, NOT_APPLICABLE, MOWING, GOING_HOME, CHARGING, LEAVING, PARKED_IN_CS, STOPPED_IN_GARDEN) |
| state | String | (readonly) The current state (UNKNOWN, NOT_APPLICABLE, PAUSED, IN_OPERATION, WAIT_UPDATING, WAIT_POWER_UP, RESTRICTED, OFF, STOPPED, ERROR, FATAL_ERROR, ERROR_AT_POWER_UP) |
| last-update | DateTime | (readonly) The time when the automower updated its states |
| battery | Number | (readonly) The battery state of charge in percent |
| error-code | Number | (readonly) The current error code |
| error-timestamp | DateTime | (readonly) The timestamp when the current error occurred |


## Actions

The following actions are available for `automower`things:

| action name | arguments | description |
|----------|--------|------------------------------|
| Start | duration (int) | Starts the automower for the given duration (minutes), overriding the schedule |
| Pause | - | Pauses the automower wherever it is currently located |
| ParkUntilNextSchedule | - | Parks the automower, fully charges it and starts afterwards according to the schedule |
| ParkUntilFurtherNotice | - | Parks the automower until it is started again by the start action or the schedule gets resumed |
| Park | duration (int) | Parks the automower for the given duration (minutes), overriding the schedule |
| PesumeSchedule | - | Resumes the schedule for the automower |


## Full Example

### automower.thing

Bridge automower:bridge:mybridge [ appKey="<your_private_application_key>", userName="<your_username>", password="<your_password>" ] {
Thing automower myAutomower [ mowerId="<your_id_received_from_discovery>", pollingInterval=3600] {
}
}


### automower.items

String Automower_Name "Name" { channel="automower:automower:mybridge:myAutomower:name" }
String Automower_Mode "Mode" { channel="automower:automower:mybridge:myAutomower:mode" }
String Automower_Activity "Activity" { channel="automower:automower:mybridge:myAutomower:activity" }
String Automower_State "State" { channel="automower:automower:mybridge:myAutomower:state" }
DateTime Automower_Last_Update "Last Update" { channel="automower:automower:mybridge:myAutomower:last-update" }
Number Automower_Battery "Battery" { channel="automower:automower:mybridge:myAutomower:battery" }
Number Automower_Error_Code "Error Code" { channel="automower:automower:mybridge:myAutomower:error-code" }
DateTime Automower_Error_Time "Error Time" { channel="automower:automower:mybridge:myAutomower:error-timestamp" }


String Automower_Command "Command" { channel="automower:automower:mybridge:myAutomower:command" }
Number Automower_Command_Duration "Command Duration" { channel="automower:automower:mybridge:myAutomower:command-duration" }
String Automower_Command_Response "Command Response" { channel="automower:automower:mybridge:myAutomower:command-response" }

### automower.sitemap


```
sitemap demo label="Automower"
{
Frame {
Text item=Automower_Name
Text item=Automower_Mode
Text item=Automower_Activity
Text item=Automower_State
Text item=Automower_Last_Update
Text item=Automower_Battery
Text item=Automower_Error_Code
Text item=Automower_Error_Time
}
}
```

### automower.rule

Example rule that triggers an automower action

```
rule "AutomowerParkUntilFurtherNotice"
when
Item Some_Item changed to ON
then
val mowerActions = getActions("automower", "automower:automower:mybridge:myAutomower")
mowerActions.parkUntilFurtherNotice()
end
```
```
rule "Check Regen wegen Guenter"
when
Item Regen_Aussen_Dach_an_seit changed
then
if (Regen_Aussen_Dach_an_seit.state > 15 && Automower_Mode.state == "MAIN_AREA"){

sendNotification("mail@domain.com", "Guenter mus heim, es regnet schon lange: " + Regen_Aussen_Dach_an_seit.state)
sendCommand(Automower_Command,"ParkUntilFurtherNotice")
}
end
```
```
rule "Check Regen aus wegen Guenter"
when
Item Regen_Aussen_Dach_aus_seit changed
then
if (Regen_Aussen_Dach_aus_seit.state > 60 && Automower_Activity.state == "PARKED_IN_CS" && Automower_Mode.state == "HOME"){

sendNotification("mail@domain.com", "Guenter kann raus, regnet nicht mehr seit: " + Regen_Aussen_Dach_aus_seit.state)
sendCommand(Automower_Command,"ResumeSchedule")

}
end
```
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.automower/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>2.5.7-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.automower</artifactId>

<name>openHAB Add-ons :: Bundles :: Automower Binding</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.automower-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-automower" description="Automower Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.automower/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.automower.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.core.thing.ThingTypeUID;

/**
* The {@link AutomowerBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Markus Pfleger - Initial contribution
*/
@NonNullByDefault
public class AutomowerBindingConstants {

private static final String BINDING_ID = "automower";

public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");

// generic thing types
public static final ThingTypeUID THING_TYPE_AUTOMOWER = new ThingTypeUID(BINDING_ID, "automower");

// List of all Channel ids
public static final String CHANNEL_MOWER_NAME = "name";
public static final String CHANNEL_STATUS_MODE = "mode";
public static final String CHANNEL_STATUS_ACTIVITY = "activity";
public static final String CHANNEL_STATUS_STATE = "state";
public static final String CHANNEL_STATUS_LAST_UPDATE = "last-update";
public static final String CHANNEL_STATUS_BATTERY = "battery";
public static final String CHANNEL_STATUS_ERROR_CODE = "error-code";
public static final String CHANNEL_STATUS_ERROR_TIMESTAMP = "error-timestamp";

// Automower properties
public static final String AUTOMOWER_ID = "mowerId";
public static final String AUTOMOWER_NAME = "mowerName";
public static final String AUTOMOWER_MODEL = "mowerModel";
public static final String AUTOMOWER_SERIAL_NUMBER = "mowerSerialNumber";
}
Loading