-
-
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.
[renault] Initial Contribution (#11467)
* #11465 Initial renault-api binding Signed-off-by: Doug Culnane <[email protected]>
- Loading branch information
1 parent
9340213
commit 3d2663c
Showing
20 changed files
with
1,372 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,43 @@ | ||
# Renault Binding | ||
|
||
This binding allow MyRenault App. users to get battery status and other data from their cars. | ||
|
||
A binding that translates the [python based renault-api](https://renault-api.readthedocs.io/en/latest/) in an easy to use binding. | ||
|
||
|
||
## Supported Things | ||
|
||
Supports MyRenault registered cars with an active Connected-Services account. | ||
|
||
This binding can only retrieve information that is available in the the MyRenault App. | ||
|
||
|
||
## Discovery | ||
|
||
No discovery | ||
|
||
## Thing Configuration | ||
|
||
You require your MyRenault credential, locale and VIN for your MyRenault registered car. | ||
|
||
| Parameter | Description | Required | | ||
|-------------------|----------------------------------------|----------| | ||
| myRenaultUsername | MyRenault Username. | yes | | ||
| myRenaultPassword | MyRenault Password. | yes | | ||
| locale | MyRenault Location (language_country). | yes | | ||
| vin | Vehicle Identification Number. | yes | | ||
| refreshInterval | Interval the car is polled in minutes. | no | | ||
|
||
## Channels | ||
|
||
Currently all available channels are read only: | ||
|
||
| Channel ID | Type | Description | | ||
|--------------|---------------|---------------------------------| | ||
| batterylevel | Number | State of the battery in % | | ||
| hvacstatus | Switch | HVAC status switch | | ||
| image | String | Image URL of MyRenault | | ||
| location | Location | The GPS position of the vehicle | | ||
| odometer | Number:Length | Total distance travelled | | ||
|
||
|
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.2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.renault</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: Renault Binding</name> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.renault/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,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.renault-${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-renault" description="Renault Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.renault/${project.version}</bundle> | ||
</feature> | ||
</features> |
38 changes: 38 additions & 0 deletions
38
...g.renault/src/main/java/org/openhab/binding/renault/internal/RenaultBindingConstants.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,38 @@ | ||
/** | ||
* Copyright (c) 2010-2021 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.renault.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link RenaultBindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Doug Culnane - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class RenaultBindingConstants { | ||
|
||
private static final String BINDING_ID = "renault"; | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_CAR = new ThingTypeUID(BINDING_ID, "car"); | ||
|
||
// List of all Channel ids | ||
public static final String CHANNEL_BATTERY_LEVEL = "batterylevel"; | ||
public static final String CHANNEL_HVAC_STATUS = "hvacstatus"; | ||
public static final String CHANNEL_IMAGE = "image"; | ||
public static final String CHANNEL_LOCATION = "location"; | ||
public static final String CHANNEL_ODOMETER = "odometer"; | ||
} |
30 changes: 30 additions & 0 deletions
30
...ding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.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,30 @@ | ||
/** | ||
* Copyright (c) 2010-2021 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.renault.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link RenaultConfiguration} class contains fields mapping thing configuration parameters. | ||
* | ||
* @author Doug Culnane - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class RenaultConfiguration { | ||
|
||
public String myRenaultUsername = ""; | ||
public String myRenaultPassword = ""; | ||
public String locale = ""; | ||
public String vin = ""; | ||
public int refreshInterval = 10; | ||
} |
67 changes: 67 additions & 0 deletions
67
...ing.renault/src/main/java/org/openhab/binding/renault/internal/RenaultHandlerFactory.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,67 @@ | ||
/** | ||
* Copyright (c) 2010-2021 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.renault.internal; | ||
|
||
import static org.openhab.binding.renault.internal.RenaultBindingConstants.*; | ||
|
||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.jetty.client.HttpClient; | ||
import org.openhab.binding.renault.internal.handler.RenaultHandler; | ||
import org.openhab.core.io.net.http.HttpClientFactory; | ||
import org.openhab.core.thing.Thing; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
import org.openhab.core.thing.binding.BaseThingHandlerFactory; | ||
import org.openhab.core.thing.binding.ThingHandler; | ||
import org.openhab.core.thing.binding.ThingHandlerFactory; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* The {@link RenaultHandlerFactory} is responsible for creating things and thing | ||
* handlers. | ||
* | ||
* @author Doug Culnane - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
@Component(configurationPid = "binding.renault", service = ThingHandlerFactory.class) | ||
public class RenaultHandlerFactory extends BaseThingHandlerFactory { | ||
|
||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_CAR); | ||
|
||
private final HttpClient httpClient; | ||
|
||
@Activate | ||
public RenaultHandlerFactory(final @Reference HttpClientFactory httpClientFactory) { | ||
this.httpClient = httpClientFactory.getCommonHttpClient(); | ||
} | ||
|
||
@Override | ||
public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); | ||
} | ||
|
||
@Override | ||
protected @Nullable ThingHandler createHandler(Thing thing) { | ||
ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
|
||
if (THING_TYPE_CAR.equals(thingTypeUID)) { | ||
return new RenaultHandler(thing, httpClient); | ||
} | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.