-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[generacmobilelink| Initial Contribution (#9322)
* This is the initial contribution of the Generac MobileLink binding. This allows the Generac line of generators using their MobileLink cloud service to be monitored as things in openHAB. * bump to 3.1 Signed-off-by: Dan Cunningham <[email protected]>
- Loading branch information
1 parent
03dd4d4
commit 6cb9f3a
Showing
21 changed files
with
1,024 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Generac MobileLink Binding | ||
|
||
This binding communicates with the Generac MobileLink API and reports on the status of Generac manufactured generators, including versions resold under the brands Eaton, Honeywell and Siemens. | ||
|
||
## Supported Things | ||
|
||
|
||
### MobileLink Account | ||
|
||
A MobileLink account bridge thing represents a user's MobileLink account and is responsible for authentication and polling for updates. | ||
|
||
ThingTypeUID: `account` | ||
|
||
### Generator | ||
|
||
A Generator thing represents a individual generator linked to an account bridge. Multiple generators are supported. | ||
|
||
ThingTypeUID: `generator` | ||
|
||
## Discovery | ||
|
||
The MobileLink account bridge must be added manually. Once added, generator things will automatically be added to the inbox. | ||
|
||
## Thing Configuration | ||
|
||
### MobileLink Account | ||
|
||
| Parameter | Description | | ||
|-----------------|------------------------------------------------------------------------------------| | ||
| username | The user name, typically an email address, used to login to the MobileLink service | | ||
| password | The password used to login to the MobileLink service | | ||
| refreshInterval | The frequency to poll for generator updates, minimum duration is 30 seconds | | ||
|
||
|
||
## Channels | ||
|
||
### Generator Channels | ||
|
||
All channels are read-only. | ||
|
||
| channel | type | description | | ||
|-------------------------|----------------------|-------------------------------------------| | ||
| connected | Switch | Connected status | | ||
| greenLight | Switch | Green light state (typically auto mode) | | ||
| yellowLight | Switch | Yellow light state | | ||
| redLight | Switch | Red light state (typically off mode) | | ||
| blueLight | Switch | Blue light state (typically running mode) | | ||
| statusDate | DateTime | Status date (start of day) | | ||
| status | String | General status | | ||
| currentAlarmDescription | String | Current alarm description | | ||
| runHours | Number:Time | Number of run hours | | ||
| exerciseHours | Number:Time | Number of exercise hours | | ||
| fuelType | Number | Fuel type | | ||
| fuelLevel | Number:Dimensionless | Fuel level | | ||
| batteryVoltage | String | Battery voltage status | | ||
| serviceStatus | Switch | Service status | | ||
|
||
|
||
## Full Example | ||
|
||
### Things | ||
|
||
```xtend | ||
Bridge generacmobilelink:account:main "MobileLink Account" [ userName="[email protected]", password="secret",refreshInterval=60 ] { | ||
Thing generator 123456 "MobileLink Generator" [ generatorId="123456" ] | ||
} | ||
``` | ||
|
||
### Items | ||
|
||
```xtend | ||
Switch GeneratorConnected "Connected [%s]" {channel="generacmobilelink:generator:main:123456:connected"} | ||
Switch GeneratorGreenLight "Green Light [%s]" {channel="generacmobilelink:generator:main:123456:greenLight"} | ||
Switch GeneratorYellowLight "Yellow Light [%s]" {channel="generacmobilelink:generator:main:123456:yellowLight"} | ||
Switch GeneratorBlueLight "Blue Light [%s]" {channel="generacmobilelink:generator:main:123456:blueLight"} | ||
Switch GeneratorRedLight "Red Light [%s]" {channel="generacmobilelink:generator:main:123456:redLight"} | ||
String GeneratorStatus "Status [%s]" {channel="generacmobilelink:generator:main:123456:status"} | ||
String GeneratorAlarm "Alarm [%s]" {channel="generacmobilelink:generator:main:123456:currentAlarmDescription"} | ||
``` | ||
|
||
### Sitemap | ||
|
||
```xtend | ||
sitemap MobileLink label="Demo Sitemap" { | ||
Frame label="Generator" { | ||
Switch item=GeneratorConnected | ||
Switch item=GeneratorGreenLight | ||
Switch item=GeneratorYellowLight | ||
Switch item=GeneratorBlueLight | ||
Switch item=GeneratorRedLight | ||
Text item=GeneratorStatus | ||
Text item=GeneratorAlarm | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>3.1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.generacmobilelink</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: GeneracMobileLink Binding</name> | ||
|
||
</project> |
23 changes: 23 additions & 0 deletions
23
bundles/org.openhab.binding.generacmobilelink/src/main/feature/feature.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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 | ||
--> | ||
<features name="org.openhab.binding.generacmobilelink-${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-generacmobilelink" description="Generac MobileLink Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.generacmobilelink/${project.version}</bundle> | ||
</feature> | ||
</features> |
29 changes: 29 additions & 0 deletions
29
...ava/org/openhab/binding/generacmobilelink/internal/GeneracMobileLinkBindingConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* 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.generacmobilelink.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link GeneracMobileLinkBindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Dan Cunningham - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class GeneracMobileLinkBindingConstants { | ||
private static final String BINDING_ID = "generacmobilelink"; | ||
public static final ThingTypeUID THING_TYPE_ACCOUNT = new ThingTypeUID(BINDING_ID, "account"); | ||
public static final ThingTypeUID THING_TYPE_GENERATOR = new ThingTypeUID(BINDING_ID, "generator"); | ||
} |
27 changes: 27 additions & 0 deletions
27
...nhab/binding/generacmobilelink/internal/config/GeneracMobileLinkAccountConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* 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.generacmobilelink.internal.config; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link GeneracMobileLinkAccountConfiguration} class contains fields mapping thing configuration parameters. | ||
* | ||
* @author Dan Cunningham - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class GeneracMobileLinkAccountConfiguration { | ||
public String username = ""; | ||
public String password = ""; | ||
public Integer refreshInterval = 60; | ||
} |
64 changes: 64 additions & 0 deletions
64
...enhab/binding/generacmobilelink/internal/discovery/GeneracMobileLinkDiscoveryService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* 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.generacmobilelink.internal.discovery; | ||
|
||
import static org.openhab.binding.generacmobilelink.internal.GeneracMobileLinkBindingConstants.THING_TYPE_GENERATOR; | ||
|
||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.binding.generacmobilelink.internal.GeneracMobileLinkBindingConstants; | ||
import org.openhab.binding.generacmobilelink.internal.dto.GeneratorStatusDTO; | ||
import org.openhab.core.config.discovery.AbstractDiscoveryService; | ||
import org.openhab.core.config.discovery.DiscoveryResult; | ||
import org.openhab.core.config.discovery.DiscoveryResultBuilder; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
import org.openhab.core.thing.ThingUID; | ||
|
||
/** | ||
* The {@link GeneracMobileLinkDiscoveryService} is responsible for discovering generator things | ||
* | ||
* @author Dan Cunningham - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class GeneracMobileLinkDiscoveryService extends AbstractDiscoveryService { | ||
private static final Set<ThingTypeUID> SUPPORTED_DISCOVERY_THING_TYPES_UIDS = Set.of(THING_TYPE_GENERATOR); | ||
|
||
public GeneracMobileLinkDiscoveryService() { | ||
super(SUPPORTED_DISCOVERY_THING_TYPES_UIDS, 0); | ||
} | ||
|
||
@Override | ||
public Set<ThingTypeUID> getSupportedThingTypes() { | ||
return SUPPORTED_DISCOVERY_THING_TYPES_UIDS; | ||
} | ||
|
||
@Override | ||
public void startScan() { | ||
} | ||
|
||
@Override | ||
public boolean isBackgroundDiscoveryEnabled() { | ||
return false; | ||
} | ||
|
||
public void generatorDiscovered(GeneratorStatusDTO generator, ThingUID bridgeUID) { | ||
DiscoveryResult result = DiscoveryResultBuilder | ||
.create(new ThingUID(GeneracMobileLinkBindingConstants.THING_TYPE_GENERATOR, bridgeUID, | ||
String.valueOf(generator.gensetID))) | ||
.withLabel("MobileLink Generator " + generator.generatorName) | ||
.withProperty("generatorId", String.valueOf(generator.gensetID)) | ||
.withRepresentationProperty("generatorId").withBridge(bridgeUID).build(); | ||
thingDiscovered(result); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...nk/src/main/java/org/openhab/binding/generacmobilelink/internal/dto/ErrorResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* 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.generacmobilelink.internal.dto; | ||
|
||
/** | ||
* {@link ErrorResponseDTO} object from the MobileLink API | ||
* | ||
* @author Dan Cunningham - Initial contribution | ||
*/ | ||
public class ErrorResponseDTO { | ||
public Integer errorCode; | ||
public String errorMessage; | ||
} |
54 changes: 54 additions & 0 deletions
54
.../src/main/java/org/openhab/binding/generacmobilelink/internal/dto/GeneratorStatusDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* 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.generacmobilelink.internal.dto; | ||
|
||
/** | ||
* {@link GeneratorStatusDTO} object from the MobileLink API | ||
* | ||
* @author Dan Cunningham - Initial contribution | ||
*/ | ||
public class GeneratorStatusDTO { | ||
public Integer gensetID; | ||
public String generatorDate; | ||
public String generatorName; | ||
public String generatorSerialNumber; | ||
public String generatorModel; | ||
public String generatorDescription; | ||
public String generatorMDN; | ||
public String generatorImei; | ||
public String generatorIccid; | ||
public String generatorTetherSerial; | ||
public Boolean connected; | ||
public Boolean greenLightLit; | ||
public Boolean yellowLightLit; | ||
public Boolean redLightLit; | ||
public Boolean blueLightLit; | ||
public String generatorStatus; | ||
public String generatorStatusDate; | ||
public String currentAlarmDescription; | ||
public Integer runHours; | ||
public Integer exerciseHours; | ||
public String batteryVoltage; | ||
public Integer fuelType; | ||
public Integer fuelLevel; | ||
public String generatorBrandImageURL; | ||
public Boolean generatorServiceStatus; | ||
public String signalStrength; | ||
public String deviceId; | ||
public Integer deviceTypeId; | ||
public String firmwareVersion; | ||
public String timezone; | ||
public String mACAddress; | ||
public String iPAddress; | ||
public String sSID; | ||
} |
25 changes: 25 additions & 0 deletions
25
...n/java/org/openhab/binding/generacmobilelink/internal/dto/GeneratorStatusResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* 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.generacmobilelink.internal.dto; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* {@link GeneratorStatusResponseDTO} response from the MobileLink API | ||
* | ||
* @author Dan Cunningham - Initial contribution | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class GeneratorStatusResponseDTO extends ArrayList<GeneratorStatusDTO> { | ||
|
||
} |
Oops, something went wrong.