Initial commit
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Debug (Attach) - openHAB",
|
||||
"request": "attach",
|
||||
"hostName": "localhost",
|
||||
"port": 5005,
|
||||
"preLaunchTask": "Build"
|
||||
}
|
||||
]
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Debug (Attach) - openHAB",
|
||||
"request": "attach",
|
||||
"hostName": "localhost",
|
||||
"port": 5005,
|
||||
"preLaunchTask": "Build"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,149 +1,149 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"options": {
|
||||
"env": {
|
||||
"openhab_home": "C://source//openhab_runtime",
|
||||
"openhab_runtime": "C://source//openhab_runtime//runtime",
|
||||
"openhab_addons": "C://source//openhab_runtime//addons",
|
||||
"openhab_logs": "C://source//openhab_runtime//userdata/logs",
|
||||
"dist" : "org.openhab.binding.meycan-4.0.0-SNAPSHOT.jar"
|
||||
}
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Start openHAB (Debug)",
|
||||
"type": "shell",
|
||||
"isBackground": true,
|
||||
"command": "$openhab_home/start.sh debug",
|
||||
"windows": {
|
||||
"command": "& $env:openhab_home/start.bat debug"
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Stop openHAB",
|
||||
"type": "shell",
|
||||
"command": "$openhab_runtime/bin/stop",
|
||||
"windows": {
|
||||
"command": "& $env:openhab_runtime/bin/stop.bat"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "mvn Compile (Release)",
|
||||
"type": "shell",
|
||||
"command": "mvn",
|
||||
"args": [
|
||||
"clean",
|
||||
"install"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "mvn Compile (Online)",
|
||||
"type": "shell",
|
||||
"command": "mvn",
|
||||
"args": [
|
||||
"clean",
|
||||
"install",
|
||||
"-DskipChecks"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "mvn Compile (Offline)",
|
||||
"type": "shell",
|
||||
"command": "mvn",
|
||||
"args": [
|
||||
"-o",
|
||||
"clean",
|
||||
"install",
|
||||
"-DskipChecks"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Copy Distribution to Addons",
|
||||
"type": "shell",
|
||||
"command": "cp",
|
||||
"args": [
|
||||
"${workspaceFolder}/target/$dist",
|
||||
"$openhab_addons"
|
||||
],
|
||||
"windows": {
|
||||
"command": "copy",
|
||||
"args": [
|
||||
"${workspaceFolder}/target/$env:dist",
|
||||
"$env:openhab_addons"
|
||||
]
|
||||
},
|
||||
"dependsOn": [
|
||||
"mvn Compile (Offline)"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Build",
|
||||
"dependsOn": [
|
||||
"Copy Distribution to Addons"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Tail events.log",
|
||||
"type": "shell",
|
||||
"command": "tail",
|
||||
"args": [
|
||||
"-n",
|
||||
"50",
|
||||
"-F",
|
||||
"$openhab_logs/events.log"
|
||||
],
|
||||
"windows": {
|
||||
"command": "Get-Content",
|
||||
"args": [
|
||||
"-Last",
|
||||
"50",
|
||||
"-Path",
|
||||
"$env:openhab_logs/events.log",
|
||||
"-Wait"
|
||||
]
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Tail openhab.log",
|
||||
"type": "shell",
|
||||
"command": "tail",
|
||||
"args": [
|
||||
"-n",
|
||||
"50",
|
||||
"-F",
|
||||
"$openhab_logs/openhab.log"
|
||||
],
|
||||
"windows": {
|
||||
"command": "Get-Content",
|
||||
"args": [
|
||||
"-Last",
|
||||
"50",
|
||||
"-Path",
|
||||
"$env:openhab_logs/openhab.log",
|
||||
"-Wait"
|
||||
]
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
},
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"options": {
|
||||
"env": {
|
||||
"openhab_home": "C://source//openhab_runtime",
|
||||
"openhab_runtime": "C://source//openhab_runtime//runtime",
|
||||
"openhab_addons": "C://source//openhab_runtime//addons",
|
||||
"openhab_logs": "C://source//openhab_runtime//userdata/logs",
|
||||
"dist" : "org.openhab.binding.meycan-4.0.0-SNAPSHOT.jar"
|
||||
}
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Start openHAB (Debug)",
|
||||
"type": "shell",
|
||||
"isBackground": true,
|
||||
"command": "$openhab_home/start.sh debug",
|
||||
"windows": {
|
||||
"command": "& $env:openhab_home/start.bat debug"
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Stop openHAB",
|
||||
"type": "shell",
|
||||
"command": "$openhab_runtime/bin/stop",
|
||||
"windows": {
|
||||
"command": "& $env:openhab_runtime/bin/stop.bat"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "mvn Compile (Release)",
|
||||
"type": "shell",
|
||||
"command": "mvn",
|
||||
"args": [
|
||||
"clean",
|
||||
"install"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "mvn Compile (Online)",
|
||||
"type": "shell",
|
||||
"command": "mvn",
|
||||
"args": [
|
||||
"clean",
|
||||
"install",
|
||||
"-DskipChecks"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "mvn Compile (Offline)",
|
||||
"type": "shell",
|
||||
"command": "mvn",
|
||||
"args": [
|
||||
"-o",
|
||||
"clean",
|
||||
"install",
|
||||
"-DskipChecks"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Copy Distribution to Addons",
|
||||
"type": "shell",
|
||||
"command": "cp",
|
||||
"args": [
|
||||
"${workspaceFolder}/target/$dist",
|
||||
"$openhab_addons"
|
||||
],
|
||||
"windows": {
|
||||
"command": "copy",
|
||||
"args": [
|
||||
"${workspaceFolder}/target/$env:dist",
|
||||
"$env:openhab_addons"
|
||||
]
|
||||
},
|
||||
"dependsOn": [
|
||||
"mvn Compile (Offline)"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Build",
|
||||
"dependsOn": [
|
||||
"Copy Distribution to Addons"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Tail events.log",
|
||||
"type": "shell",
|
||||
"command": "tail",
|
||||
"args": [
|
||||
"-n",
|
||||
"50",
|
||||
"-F",
|
||||
"$openhab_logs/events.log"
|
||||
],
|
||||
"windows": {
|
||||
"command": "Get-Content",
|
||||
"args": [
|
||||
"-Last",
|
||||
"50",
|
||||
"-Path",
|
||||
"$env:openhab_logs/events.log",
|
||||
"-Wait"
|
||||
]
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Tail openhab.log",
|
||||
"type": "shell",
|
||||
"command": "tail",
|
||||
"args": [
|
||||
"-n",
|
||||
"50",
|
||||
"-F",
|
||||
"$openhab_logs/openhab.log"
|
||||
],
|
||||
"windows": {
|
||||
"command": "Get-Content",
|
||||
"args": [
|
||||
"-Last",
|
||||
"50",
|
||||
"-Path",
|
||||
"$env:openhab_logs/openhab.log",
|
||||
"-Wait"
|
||||
]
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
},
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,13 +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 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
|
||||
|
||||
@@ -1,94 +1,94 @@
|
||||
# MeyCan Binding
|
||||
|
||||
_Give some details about what this binding is meant for - a protocol, system, specific device._
|
||||
|
||||
_If possible, provide some resources like pictures (only PNG is supported currently), a video, etc. to give an impression of what can be done with this binding._
|
||||
_You can place such resources into a `doc` folder next to this README.md._
|
||||
|
||||
_Put each sentence in a separate line to improve readability of diffs._
|
||||
|
||||
## Supported Things
|
||||
|
||||
_Please describe the different supported things / devices including their ThingTypeUID within this section._
|
||||
_Which different types are supported, which models were tested etc.?_
|
||||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
|
||||
|
||||
- `bridge`: Short description of the Bridge, if any
|
||||
- `sample`: Short description of the Thing with the ThingTypeUID `sample`
|
||||
|
||||
## Discovery
|
||||
|
||||
_Describe the available auto-discovery features here._
|
||||
_Mention for what it works and what needs to be kept in mind when using it._
|
||||
|
||||
## Binding Configuration
|
||||
|
||||
_If your binding requires or supports general configuration settings, please create a folder ```cfg``` and place the configuration file ```<bindingId>.cfg``` inside it._
|
||||
_In this section, you should link to this file and provide some information about the options._
|
||||
_The file could e.g. look like:_
|
||||
|
||||
```
|
||||
# Configuration for the MeyCan Binding
|
||||
#
|
||||
# Default secret key for the pairing of the MeyCan Thing.
|
||||
# It has to be between 10-40 (alphanumeric) characters.
|
||||
# This may be changed by the user for security reasons.
|
||||
secret=openHABSecret
|
||||
```
|
||||
|
||||
_Note that it is planned to generate some part of this based on the information that is available within ```src/main/resources/OH-INF/binding``` of your binding._
|
||||
|
||||
_If your binding does not offer any generic configurations, you can remove this section completely._
|
||||
|
||||
## Thing Configuration
|
||||
|
||||
_Describe what is needed to manually configure a thing, either through the UI or via a thing-file._
|
||||
_This should be mainly about its mandatory and optional configuration parameters._
|
||||
|
||||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
|
||||
|
||||
### `sample` Thing Configuration
|
||||
|
||||
| Name | Type | Description | Default | Required | Advanced |
|
||||
|-----------------|---------|---------------------------------------|---------|----------|----------|
|
||||
| hostname | text | Hostname or IP address of the device | N/A | yes | no |
|
||||
| password | text | Password to access the device | N/A | yes | no |
|
||||
| refreshInterval | integer | Interval the device is polled in sec. | 600 | no | yes |
|
||||
|
||||
## Channels
|
||||
|
||||
_Here you should provide information about available channel types, what their meaning is and how they can be used._
|
||||
|
||||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
|
||||
|
||||
| Channel | Type | Read/Write | Description |
|
||||
|---------|--------|------------|-----------------------------|
|
||||
| control | Switch | RW | This is the control channel |
|
||||
|
||||
## Full Example
|
||||
|
||||
_Provide a full usage example based on textual configuration files._
|
||||
_*.things, *.items examples are mandatory as textual configuration is well used by many users._
|
||||
_*.sitemap examples are optional._
|
||||
|
||||
### Thing Configuration
|
||||
|
||||
```java
|
||||
Example thing configuration goes here.
|
||||
```
|
||||
### Item Configuration
|
||||
|
||||
```java
|
||||
Example item configuration goes here.
|
||||
```
|
||||
|
||||
### Sitemap Configuration
|
||||
|
||||
```perl
|
||||
Optional Sitemap configuration goes here.
|
||||
Remove this section, if not needed.
|
||||
```
|
||||
|
||||
## Any custom content here!
|
||||
|
||||
_Feel free to add additional sections for whatever you think should also be mentioned about your binding!_
|
||||
# MeyCan Binding
|
||||
|
||||
_Give some details about what this binding is meant for - a protocol, system, specific device._
|
||||
|
||||
_If possible, provide some resources like pictures (only PNG is supported currently), a video, etc. to give an impression of what can be done with this binding._
|
||||
_You can place such resources into a `doc` folder next to this README.md._
|
||||
|
||||
_Put each sentence in a separate line to improve readability of diffs._
|
||||
|
||||
## Supported Things
|
||||
|
||||
_Please describe the different supported things / devices including their ThingTypeUID within this section._
|
||||
_Which different types are supported, which models were tested etc.?_
|
||||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
|
||||
|
||||
- `bridge`: Short description of the Bridge, if any
|
||||
- `sample`: Short description of the Thing with the ThingTypeUID `sample`
|
||||
|
||||
## Discovery
|
||||
|
||||
_Describe the available auto-discovery features here._
|
||||
_Mention for what it works and what needs to be kept in mind when using it._
|
||||
|
||||
## Binding Configuration
|
||||
|
||||
_If your binding requires or supports general configuration settings, please create a folder ```cfg``` and place the configuration file ```<bindingId>.cfg``` inside it._
|
||||
_In this section, you should link to this file and provide some information about the options._
|
||||
_The file could e.g. look like:_
|
||||
|
||||
```
|
||||
# Configuration for the MeyCan Binding
|
||||
#
|
||||
# Default secret key for the pairing of the MeyCan Thing.
|
||||
# It has to be between 10-40 (alphanumeric) characters.
|
||||
# This may be changed by the user for security reasons.
|
||||
secret=openHABSecret
|
||||
```
|
||||
|
||||
_Note that it is planned to generate some part of this based on the information that is available within ```src/main/resources/OH-INF/binding``` of your binding._
|
||||
|
||||
_If your binding does not offer any generic configurations, you can remove this section completely._
|
||||
|
||||
## Thing Configuration
|
||||
|
||||
_Describe what is needed to manually configure a thing, either through the UI or via a thing-file._
|
||||
_This should be mainly about its mandatory and optional configuration parameters._
|
||||
|
||||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
|
||||
|
||||
### `sample` Thing Configuration
|
||||
|
||||
| Name | Type | Description | Default | Required | Advanced |
|
||||
|-----------------|---------|---------------------------------------|---------|----------|----------|
|
||||
| hostname | text | Hostname or IP address of the device | N/A | yes | no |
|
||||
| password | text | Password to access the device | N/A | yes | no |
|
||||
| refreshInterval | integer | Interval the device is polled in sec. | 600 | no | yes |
|
||||
|
||||
## Channels
|
||||
|
||||
_Here you should provide information about available channel types, what their meaning is and how they can be used._
|
||||
|
||||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
|
||||
|
||||
| Channel | Type | Read/Write | Description |
|
||||
|---------|--------|------------|-----------------------------|
|
||||
| control | Switch | RW | This is the control channel |
|
||||
|
||||
## Full Example
|
||||
|
||||
_Provide a full usage example based on textual configuration files._
|
||||
_*.things, *.items examples are mandatory as textual configuration is well used by many users._
|
||||
_*.sitemap examples are optional._
|
||||
|
||||
### Thing Configuration
|
||||
|
||||
```java
|
||||
Example thing configuration goes here.
|
||||
```
|
||||
### Item Configuration
|
||||
|
||||
```java
|
||||
Example item configuration goes here.
|
||||
```
|
||||
|
||||
### Sitemap Configuration
|
||||
|
||||
```perl
|
||||
Optional Sitemap configuration goes here.
|
||||
Remove this section, if not needed.
|
||||
```
|
||||
|
||||
## Any custom content here!
|
||||
|
||||
_Feel free to add additional sections for whatever you think should also be mentioned about your binding!_
|
||||
|
||||
@@ -1,17 +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 https://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>4.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.openhab.binding.meycan</artifactId>
|
||||
|
||||
<name>openHAB Add-ons :: Bundles :: MeyCan Binding</name>
|
||||
|
||||
</project>
|
||||
<?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 https://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>4.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.openhab.binding.meycan</artifactId>
|
||||
|
||||
<name>openHAB Add-ons :: Bundles :: MeyCan Binding</name>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<features name="org.openhab.binding.meycan-${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-meycan" description="MeyCan Binding" version="${project.version}">
|
||||
<feature>openhab-runtime-base</feature>
|
||||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.meycan/${project.version}</bundle>
|
||||
</feature>
|
||||
</features>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<features name="org.openhab.binding.meycan-${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-meycan" description="MeyCan Binding" version="${project.version}">
|
||||
<feature>openhab-runtime-base</feature>
|
||||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.meycan/${project.version}</bundle>
|
||||
</feature>
|
||||
</features>
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2023 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.meycan.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
|
||||
/**
|
||||
* The {@link MeyCanBindingConstants} class defines common constants, which are
|
||||
* used across the whole binding.
|
||||
*
|
||||
* @author Martin Linkwitz - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeyCanBindingConstants {
|
||||
|
||||
private static final String BINDING_ID = "meycan";
|
||||
|
||||
// List of all Thing Type UIDs
|
||||
public static final ThingTypeUID THING_TYPE_SAMPLE = new ThingTypeUID(BINDING_ID, "sample");
|
||||
|
||||
// List of all Channel ids
|
||||
public static final String CHANNEL_1 = "channel1";
|
||||
}
|
||||
/**
|
||||
* Copyright (c) 2010-2023 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.meycan.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
|
||||
/**
|
||||
* The {@link MeyCanBindingConstants} class defines common constants, which are
|
||||
* used across the whole binding.
|
||||
*
|
||||
* @author Martin Linkwitz - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeyCanBindingConstants {
|
||||
|
||||
private static final String BINDING_ID = "meycan";
|
||||
|
||||
// List of all Thing Type UIDs
|
||||
public static final ThingTypeUID THING_TYPE_SAMPLE = new ThingTypeUID(BINDING_ID, "sample");
|
||||
|
||||
// List of all Channel ids
|
||||
public static final String CHANNEL_1 = "channel1";
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2023 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.meycan.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link MeyCanConfiguration} class contains fields mapping thing configuration parameters.
|
||||
*
|
||||
* @author Martin Linkwitz - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeyCanConfiguration {
|
||||
|
||||
/**
|
||||
* Sample configuration parameters. Replace with your own.
|
||||
*/
|
||||
public String hostname = "";
|
||||
public String password = "";
|
||||
public int refreshInterval = 600;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) 2010-2023 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.meycan.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link MeyCanConfiguration} class contains fields mapping thing configuration parameters.
|
||||
*
|
||||
* @author Martin Linkwitz - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeyCanConfiguration {
|
||||
|
||||
/**
|
||||
* Sample configuration parameters. Replace with your own.
|
||||
*/
|
||||
public String hostname = "";
|
||||
public String password = "";
|
||||
public int refreshInterval = 600;
|
||||
}
|
||||
|
||||
@@ -1,104 +1,104 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2023 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.meycan.internal;
|
||||
|
||||
import static org.openhab.binding.meycan.internal.MeyCanBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.binding.BaseThingHandler;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The {@link MeyCanHandler} is responsible for handling commands, which are
|
||||
* sent to one of the channels.
|
||||
*
|
||||
* @author Martin Linkwitz - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeyCanHandler extends BaseThingHandler {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MeyCanHandler.class);
|
||||
|
||||
private @Nullable MeyCanConfiguration config;
|
||||
|
||||
public MeyCanHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
if (CHANNEL_1.equals(channelUID.getId())) {
|
||||
if (command instanceof RefreshType) {
|
||||
// TODO: handle data refresh
|
||||
}
|
||||
|
||||
// TODO: handle command
|
||||
|
||||
// Note: if communication with thing fails for some reason,
|
||||
// indicate that by setting the status with detail information:
|
||||
// updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
// "Could not control device at IP address x.x.x.x");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
config = getConfigAs(MeyCanConfiguration.class);
|
||||
|
||||
// TODO: Initialize the handler.
|
||||
// The framework requires you to return from this method quickly, i.e. any network access must be done in
|
||||
// the background initialization below.
|
||||
// Also, before leaving this method a thing status from one of ONLINE, OFFLINE or UNKNOWN must be set. This
|
||||
// might already be the real thing status in case you can decide it directly.
|
||||
// In case you can not decide the thing status directly (e.g. for long running connection handshake using WAN
|
||||
// access or similar) you should set status UNKNOWN here and then decide the real status asynchronously in the
|
||||
// background.
|
||||
|
||||
// set the thing status to UNKNOWN temporarily and let the background task decide for the real status.
|
||||
// the framework is then able to reuse the resources from the thing handler initialization.
|
||||
// we set this upfront to reliably check status updates in unit tests.
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
|
||||
// Example for background initialization:
|
||||
scheduler.execute(() -> {
|
||||
boolean thingReachable = true; // <background task with long running initialization here>
|
||||
// when done do:
|
||||
if (thingReachable) {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
} else {
|
||||
updateStatus(ThingStatus.OFFLINE);
|
||||
}
|
||||
});
|
||||
|
||||
// These logging types should be primarily used by bindings
|
||||
// logger.trace("Example trace message");
|
||||
// logger.debug("Example debug message");
|
||||
// logger.warn("Example warn message");
|
||||
//
|
||||
// Logging to INFO should be avoided normally.
|
||||
// See https://www.openhab.org/docs/developer/guidelines.html#f-logging
|
||||
|
||||
// Note: When initialization can NOT be done set the status with more details for further
|
||||
// analysis. See also class ThingStatusDetail for all available status details.
|
||||
// Add a description to give user information to understand why thing does not work as expected. E.g.
|
||||
// updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
// "Can not access device as username and/or password are invalid");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Copyright (c) 2010-2023 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.meycan.internal;
|
||||
|
||||
import static org.openhab.binding.meycan.internal.MeyCanBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.binding.BaseThingHandler;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The {@link MeyCanHandler} is responsible for handling commands, which are
|
||||
* sent to one of the channels.
|
||||
*
|
||||
* @author Martin Linkwitz - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MeyCanHandler extends BaseThingHandler {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MeyCanHandler.class);
|
||||
|
||||
private @Nullable MeyCanConfiguration config;
|
||||
|
||||
public MeyCanHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
if (CHANNEL_1.equals(channelUID.getId())) {
|
||||
if (command instanceof RefreshType) {
|
||||
// TODO: handle data refresh
|
||||
}
|
||||
|
||||
// TODO: handle command
|
||||
|
||||
// Note: if communication with thing fails for some reason,
|
||||
// indicate that by setting the status with detail information:
|
||||
// updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
// "Could not control device at IP address x.x.x.x");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
config = getConfigAs(MeyCanConfiguration.class);
|
||||
|
||||
// TODO: Initialize the handler.
|
||||
// The framework requires you to return from this method quickly, i.e. any network access must be done in
|
||||
// the background initialization below.
|
||||
// Also, before leaving this method a thing status from one of ONLINE, OFFLINE or UNKNOWN must be set. This
|
||||
// might already be the real thing status in case you can decide it directly.
|
||||
// In case you can not decide the thing status directly (e.g. for long running connection handshake using WAN
|
||||
// access or similar) you should set status UNKNOWN here and then decide the real status asynchronously in the
|
||||
// background.
|
||||
|
||||
// set the thing status to UNKNOWN temporarily and let the background task decide for the real status.
|
||||
// the framework is then able to reuse the resources from the thing handler initialization.
|
||||
// we set this upfront to reliably check status updates in unit tests.
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
|
||||
// Example for background initialization:
|
||||
scheduler.execute(() -> {
|
||||
boolean thingReachable = true; // <background task with long running initialization here>
|
||||
// when done do:
|
||||
if (thingReachable) {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
} else {
|
||||
updateStatus(ThingStatus.OFFLINE);
|
||||
}
|
||||
});
|
||||
|
||||
// These logging types should be primarily used by bindings
|
||||
// logger.trace("Example trace message");
|
||||
// logger.debug("Example debug message");
|
||||
// logger.warn("Example warn message");
|
||||
//
|
||||
// Logging to INFO should be avoided normally.
|
||||
// See https://www.openhab.org/docs/developer/guidelines.html#f-logging
|
||||
|
||||
// Note: When initialization can NOT be done set the status with more details for further
|
||||
// analysis. See also class ThingStatusDetail for all available status details.
|
||||
// Add a description to give user information to understand why thing does not work as expected. E.g.
|
||||
// updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
// "Can not access device as username and/or password are invalid");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2023 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.meycan.internal;
|
||||
|
||||
import static org.openhab.binding.meycan.internal.MeyCanBindingConstants.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
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.Component;
|
||||
|
||||
/**
|
||||
* The {@link MeyCanHandlerFactory} is responsible for creating things and thing
|
||||
* handlers.
|
||||
*
|
||||
* @author Martin Linkwitz - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(configurationPid = "binding.meycan", service = ThingHandlerFactory.class)
|
||||
public class MeyCanHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_SAMPLE);
|
||||
|
||||
@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_SAMPLE.equals(thingTypeUID)) {
|
||||
return new MeyCanHandler(thing);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Copyright (c) 2010-2023 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.meycan.internal;
|
||||
|
||||
import static org.openhab.binding.meycan.internal.MeyCanBindingConstants.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
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.Component;
|
||||
|
||||
/**
|
||||
* The {@link MeyCanHandlerFactory} is responsible for creating things and thing
|
||||
* handlers.
|
||||
*
|
||||
* @author Martin Linkwitz - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(configurationPid = "binding.meycan", service = ThingHandlerFactory.class)
|
||||
public class MeyCanHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_SAMPLE);
|
||||
|
||||
@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_SAMPLE.equals(thingTypeUID)) {
|
||||
return new MeyCanHandler(thing);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<addon:addon id="meycan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:addon="https://openhab.org/schemas/addon/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/addon/v1.0.0 https://openhab.org/schemas/addon-1.0.0.xsd">
|
||||
|
||||
<type>binding</type>
|
||||
<name>MeyCan Binding</name>
|
||||
<description>This is the binding for MeyCan.</description>
|
||||
|
||||
</addon:addon>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<addon:addon id="meycan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:addon="https://openhab.org/schemas/addon/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/addon/v1.0.0 https://openhab.org/schemas/addon-1.0.0.xsd">
|
||||
|
||||
<type>binding</type>
|
||||
<name>MeyCan Binding</name>
|
||||
<description>This is the binding for MeyCan.</description>
|
||||
|
||||
</addon:addon>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# FIXME: please add all English translations to this file so the texts can be translated using Crowdin
|
||||
# FIXME: to generate the content of this file run: mvn i18n:generate-default-translations
|
||||
# FIXME: see also: https://www.openhab.org/docs/developer/utils/i18n.html
|
||||
# FIXME: please add all English translations to this file so the texts can be translated using Crowdin
|
||||
# FIXME: to generate the content of this file run: mvn i18n:generate-default-translations
|
||||
# FIXME: see also: https://www.openhab.org/docs/developer/utils/i18n.html
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="meycan"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<!-- Sample Thing Type -->
|
||||
<thing-type id="sample">
|
||||
<!-- Comment this in for Things which need a Bridge to function.
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="MeyCanBridge" />
|
||||
</supported-bridge-type-refs>
|
||||
-->
|
||||
|
||||
<label>MeyCan Binding Thing</label>
|
||||
<description>Sample thing for MeyCan Binding</description>
|
||||
|
||||
<channels>
|
||||
<channel id="channel1" typeId="sample-channel"/>
|
||||
</channels>
|
||||
|
||||
<config-description>
|
||||
<parameter name="hostname" type="text" required="true">
|
||||
<context>network-address</context>
|
||||
<label>Hostname</label>
|
||||
<description>Hostname or IP address of the device</description>
|
||||
</parameter>
|
||||
<parameter name="password" type="text" required="true">
|
||||
<context>password</context>
|
||||
<label>Password</label>
|
||||
<description>Password to access the device</description>
|
||||
</parameter>
|
||||
<parameter name="refreshInterval" type="integer" unit="s" min="1">
|
||||
<label>Refresh Interval</label>
|
||||
<description>Interval the device is polled in sec.</description>
|
||||
<default>600</default>
|
||||
<advanced>true</advanced>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
<!-- Sample Channel Type -->
|
||||
<channel-type id="sample-channel">
|
||||
<item-type>Number:Temperature</item-type>
|
||||
<label>Example Temperature</label><!-- Use uppercase words, except prepositions. 2-3 words, max 25 chars -->
|
||||
<description>Sample channel for MeyCan Binding</description>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="meycan"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<!-- Sample Thing Type -->
|
||||
<thing-type id="sample">
|
||||
<!-- Comment this in for Things which need a Bridge to function.
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="MeyCanBridge" />
|
||||
</supported-bridge-type-refs>
|
||||
-->
|
||||
|
||||
<label>MeyCan Binding Thing</label>
|
||||
<description>Sample thing for MeyCan Binding</description>
|
||||
|
||||
<channels>
|
||||
<channel id="channel1" typeId="sample-channel"/>
|
||||
</channels>
|
||||
|
||||
<config-description>
|
||||
<parameter name="hostname" type="text" required="true">
|
||||
<context>network-address</context>
|
||||
<label>Hostname</label>
|
||||
<description>Hostname or IP address of the device</description>
|
||||
</parameter>
|
||||
<parameter name="password" type="text" required="true">
|
||||
<context>password</context>
|
||||
<label>Password</label>
|
||||
<description>Password to access the device</description>
|
||||
</parameter>
|
||||
<parameter name="refreshInterval" type="integer" unit="s" min="1">
|
||||
<label>Refresh Interval</label>
|
||||
<description>Interval the device is polled in sec.</description>
|
||||
<default>600</default>
|
||||
<advanced>true</advanced>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
<!-- Sample Channel Type -->
|
||||
<channel-type id="sample-channel">
|
||||
<item-type>Number:Temperature</item-type>
|
||||
<label>Example Temperature</label><!-- Use uppercase words, except prepositions. 2-3 words, max 25 chars -->
|
||||
<description>Sample channel for MeyCan Binding</description>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
|
||||
Reference in New Issue
Block a user