forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[airvisualnode] Initial contribution for AirVisual Node Binding (open…
…hab#2805) Signed-off-by: Victor Antonovich <v.antonovich@gmail.com> (github: 3cky)
- Loading branch information
Showing
26 changed files
with
1,571 additions
and
0 deletions.
There are no files selected for viewing
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src/main/java"/> | ||
<classpathentry kind="lib" path="lib/jcifs-1.3.18.jar"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
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,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.binding.airvisualnode</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ds.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
10 changes: 10 additions & 0 deletions
10
addons/binding/org.openhab.binding.airvisualnode/ESH-INF/binding/binding.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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<binding:binding id="airvisualnode" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0" | ||
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd"> | ||
|
||
<name>AirVisual Node Binding</name> | ||
<description>Binding for AirVisual Node air quality monitor</description> | ||
<author>Victor Antonovich</author> | ||
|
||
</binding:binding> |
115 changes: 115 additions & 0 deletions
115
addons/binding/org.openhab.binding.airvisualnode/ESH-INF/thing/thing-types.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,115 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<thing:thing-descriptions bindingId="airvisualnode" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" | ||
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> | ||
|
||
<thing-type id="avnode"> | ||
<label>AirVisual Node</label> | ||
<description>AirVisual Node air quality monitor</description> | ||
|
||
<!-- Channels --> | ||
|
||
<channels> | ||
<channel id="co2" typeId="Co2" /> | ||
<channel id="humidity" typeId="Humidity" /> | ||
<channel id="aqi" typeId="Aqi" /> | ||
<channel id="pm_25" typeId="Pm_25" /> | ||
<channel id="temperature" typeId="Temperature" /> | ||
<channel id="timestamp" typeId="Timestamp" /> | ||
<channel id="used_memory" typeId="Used_memory" /> | ||
<channel id="signal-strength" typeId="system.signal-strength" /> | ||
<channel id="battery-level" typeId="system.battery-level" /> | ||
</channels> | ||
|
||
<!-- Configuration parameters --> | ||
|
||
<config-description> | ||
<!-- Required parameters --> | ||
<parameter name="address" type="text" required="true"> | ||
<context>network-address</context> | ||
<label>Node Network Address</label> | ||
<description>Node network address</description> | ||
</parameter> | ||
<parameter name="username" type="text"> | ||
<label>Node Username</label> | ||
<description>Node network username</description> | ||
<default>airvisual</default> | ||
</parameter> | ||
<parameter name="password" type="text" required="true"> | ||
<context>password</context> | ||
<label>Node Password</label> | ||
<description>Node network password</description> | ||
</parameter> | ||
<!-- Advanced parameters --> | ||
<parameter name="share" type="text"> | ||
<label>Share Name</label> | ||
<description>Node network share name</description> | ||
<default>airvisual</default> | ||
<advanced>true</advanced> | ||
</parameter> | ||
<parameter name="refresh" type="integer" min="30" unit="s"> | ||
<label>Refresh Interval</label> | ||
<description>Node data fetches interval (in seconds)</description> | ||
<default>60</default> | ||
<unitLabel>s</unitLabel> | ||
<advanced>true</advanced> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<!-- Channel types --> | ||
|
||
<channel-type id="Co2"> | ||
<item-type>Number:Dimensionless</item-type> | ||
<label>CO₂ Level</label> | ||
<description>CO₂ level, ppm</description> | ||
<category>CarbonDioxide</category> | ||
<state readOnly="true" pattern="%d %unit%" /> | ||
</channel-type> | ||
|
||
<channel-type id="Humidity"> | ||
<item-type>Number:Dimensionless</item-type> | ||
<label>Humidity</label> | ||
<description>Humidity, %</description> | ||
<category>Humidity</category> | ||
<state readOnly="true" pattern="%d %unit%" /> | ||
</channel-type> | ||
|
||
<channel-type id="Aqi"> | ||
<item-type>Number:Dimensionless</item-type> | ||
<label>AQI</label> | ||
<description>Air Quality Index (US)</description> | ||
<state readOnly="true" pattern="%d" /> | ||
</channel-type> | ||
|
||
<channel-type id="Pm_25"> | ||
<item-type>Number:Density</item-type> | ||
<label>PM2.5</label> | ||
<description>PM2.5 level, μg/m³</description> | ||
<state readOnly="true" pattern="%.1f %unit%" /> | ||
</channel-type> | ||
|
||
<channel-type id="Temperature"> | ||
<item-type>Number:Temperature</item-type> | ||
<label>Temperature</label> | ||
<description>Current temperature</description> | ||
<category>Temperature</category> | ||
<state readOnly="true" pattern="%.1f %unit%" /> | ||
</channel-type> | ||
|
||
<channel-type id="Timestamp"> | ||
<item-type>DateTime</item-type> | ||
<label>Timestamp</label> | ||
<description>Status timestamp</description> | ||
<state readOnly="true" /> | ||
</channel-type> | ||
|
||
<channel-type id="Used_memory" advanced="true"> | ||
<item-type>Number</item-type> | ||
<label>Used Memory</label> | ||
<description>Used memory</description> | ||
<state readOnly="true" /> | ||
</channel-type> | ||
|
||
</thing:thing-descriptions> |
33 changes: 33 additions & 0 deletions
33
addons/binding/org.openhab.binding.airvisualnode/META-INF/MANIFEST.MF
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,33 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ActivationPolicy: lazy | ||
Bundle-ClassPath: | ||
., | ||
lib/jcifs-1.3.18.jar | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: AirVisualNode Binding | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
Bundle-SymbolicName: org.openhab.binding.airvisualnode;singleton:=true | ||
Bundle-Vendor: openHAB | ||
Bundle-Version: 2.4.0.qualifier | ||
Export-Package: | ||
org.openhab.binding.airvisualnode, | ||
org.openhab.binding.airvisualnode.handler | ||
Import-Package: | ||
org.openhab.binding.airvisualnode, | ||
org.openhab.binding.airvisualnode.handler, | ||
com.google.gson, | ||
com.google.gson.annotations, | ||
javax.measure, | ||
javax.measure.quantity, | ||
org.apache.commons.io, | ||
org.eclipse.jdt.annotation;resolution:=optional, | ||
org.eclipse.smarthome.config.core, | ||
org.eclipse.smarthome.config.discovery, | ||
org.eclipse.smarthome.core.library.types, | ||
org.eclipse.smarthome.core.library.unit, | ||
org.eclipse.smarthome.core.thing, | ||
org.eclipse.smarthome.core.thing.binding, | ||
org.eclipse.smarthome.core.thing.type, | ||
org.eclipse.smarthome.core.types, | ||
org.slf4j | ||
Service-Component: OSGI-INF/*.xml |
1 change: 1 addition & 0 deletions
1
addons/binding/org.openhab.binding.airvisualnode/OSGI-INF/.gitignore
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 @@ | ||
*.xml |
132 changes: 132 additions & 0 deletions
132
addons/binding/org.openhab.binding.airvisualnode/README.md
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,132 @@ | ||
# AirVisual Node Binding | ||
|
||
This is an openHAB binding for the [AirVisual Node Air Quality Monitor](https://airvisual.com/node) (also known as IQAir AirVisual Pro). | ||
|
||
## Supported Things | ||
|
||
There is one supported Thing, the "avnode". | ||
|
||
## Discovery | ||
|
||
Binding will do autodiscovery for AirVisual Node by searching for a host advertised with the NetBIOS name 'AVISUAL-<SerialNumber>'. | ||
|
||
All discovered devices will be added to the inbox. Please note you will need to set the Node username and password in the configuration | ||
of the newly discovered thing before a connection can be made. | ||
|
||
## Binding Configuration | ||
|
||
The binding has no configuration options, all configuration is done at Thing level. | ||
|
||
## Thing Configuration | ||
|
||
The thing has a few configuration parameters: | ||
|
||
| Parameter | Description | | ||
|-----------|-------------------------------------------------------------------------------------| | ||
| address | Hostname or IP address of the Node | | ||
| username | The Node Samba share username. Default is 'airvisual' | | ||
| password | The Node Samba share password | | ||
| share | (Optional) The Node SMB share name. Default is 'airvisual' | | ||
| refresh | (Optional) The time (in seconds) to refresh the Node data. Default is 60, min is 30 | | ||
|
||
Required configuration parameters can be obtained by pressing the center button on the Node for "Settings Menu" > "Network" > "Access Node data" tab. | ||
|
||
## Channels | ||
|
||
The binding supports the following channels: | ||
|
||
| Channel ID | Item Type | Description | | ||
|-----------------|-----------------------|-----------------------------| | ||
| co2 | Number:Dimensionless | CO2 level, ppm | | ||
| humidity | Number:Dimensionless | Relative humidity, % | | ||
| aqi | Number:Dimensionless | Air Quality Index (US) | | ||
| pm_25 | Number:Density | PM2.5 level, μg/m³ | | ||
| temperature | Number:Temperature | Temperature | | ||
| used_memory | Number | Used memory | | ||
| timestamp | DateTime | Timestamp | | ||
| battery-level | Number | Battery level, % | | ||
| signal-strength | Number | Wi-Fi signal strength, 0-4 | | ||
|
||
The Node updates measurements data every 5 minutes in active mode and every 15 minutes in power saving mode (screen off). | ||
|
||
## Example | ||
|
||
### Thing | ||
|
||
The preferred way to add AirVisual Node to the openHAB installation is autodiscovery, | ||
but the AirVisual Node also can be configured using `.things` file: | ||
|
||
``` | ||
airvisualnode:avnode:1a2b3c4 [ address="192.168.1.32", username="airvisual", password="12345", share="airvisual", refresh=60 ] | ||
``` | ||
|
||
### Items | ||
|
||
Here is an example of items for the AirVisual Node: | ||
|
||
``` | ||
Number:Temperature Livingroom_Temperature "Temperature [%.1f %unit%]" <temperature> {channel="airvisualnode:avnode:1a2b3c4:temperature"} | ||
Number:Dimensionless Livingroom_Humidity "Humidity [%d %unit%]" <humidity> {channel="airvisualnode:avnode:1a2b3c4:humidity"} | ||
Number:Dimensionless Livingroom_CO2_Level "CO₂" {channel="airvisualnode:avnode:1a2b3c4:co2"} | ||
Number:Dimensionless Livingroom_Aqi_Level "Air Quality Index" { channel="airvisualnode:avnode:1a2b3c4:aqi" } | ||
Number:Density Livingroom_Pm25_Level "PM2.5 Level" { channel="airvisualnode:avnode:1a2b3c4:pm_25" } | ||
DateTime Livingroom_Aqi_Timestamp "AQI Timestamp [%1$tH:%1$tM]" { channel="airvisualnode:avnode:1a2b3c4:timestamp" } | ||
``` | ||
|
||
### Rules | ||
|
||
Example rules: | ||
|
||
``` | ||
rule "AirVisual Node Temperature Rule" | ||
when | ||
Item Livingroom_Temperature changed | ||
then | ||
if (Livingroom_Temperature.state > 25.0|°C) { | ||
logInfo("avnode.rules", "Temperature is above 25°C") | ||
} | ||
end | ||
rule "AirVisual Node Humidity Rule" | ||
when | ||
Item Livingroom_Humidity changed | ||
then | ||
if (Livingroom_Humidity.state < 35.0|%) { | ||
logInfo("avnode.rules", "Humidity is below 35%") | ||
} | ||
end | ||
rule "AirVisual Node CO₂ Level Rule" | ||
when | ||
Item Livingroom_CO2_Level changed | ||
then | ||
if (Livingroom_CO2_Level.state > 1000.0|"ppm") { | ||
logInfo("avnode.rules", "CO₂ level is above 1000 ppm") | ||
} | ||
end | ||
rule "AirVisual Node PM2.5 Level Rule" | ||
when | ||
Item Livingroom_Pm25_Level changed | ||
then | ||
if (Livingroom_Pm25_Level.state > 25.0|"µg/m³") { | ||
logInfo("avnode.rules", "PM2.5 level is above 25 µg/m³") | ||
} | ||
end | ||
``` | ||
|
||
### Sitemap | ||
|
||
Example sitemap: | ||
|
||
``` | ||
sitemap home label="Home" { | ||
Frame label="Living Room" { | ||
Text item=Livingroom_Temperature | ||
Text item=Livingroom_Humidity | ||
Text item=Livingroom_CO2_Level | ||
Text item=Livingroom_Aqi_Level | ||
Text item=Livingroom_Pm25_Level | ||
} | ||
} | ||
``` |
49 changes: 49 additions & 0 deletions
49
addons/binding/org.openhab.binding.airvisualnode/about.html
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,49 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> | ||
<title>About</title> | ||
</head> | ||
<body lang="EN-US"> | ||
<h2>About This Content</h2> | ||
|
||
<p>March 30, 2017</p> | ||
<h3>License</h3> | ||
|
||
<p> | ||
The openHAB community makes available all content in this plug-in ("Content"). Unless otherwise | ||
indicated below, the Content is provided to you under the terms and conditions of the | ||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available | ||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
For purposes of the EPL, "Program" will mean the Content. | ||
</p> | ||
|
||
<p> | ||
If you did not receive this Content directly from the openHAB community, the Content is | ||
being redistributed by another party ("Redistributor") and different terms and conditions may | ||
apply to your use of any object code in the Content. Check the Redistributor's license that was | ||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise | ||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content | ||
and such source code may be obtained at <a href="http://www.openhab.org/">openhab.org</a>. | ||
</p> | ||
|
||
<h3>Third Party Content</h3> | ||
|
||
<p> | ||
The Content includes items that have been sourced from third parties as set out below. If you. | ||
did not receive this Content directly from the openHAB community, the following is provided. | ||
for informational purposes only, and you should look to the Redistributor's license for. | ||
terms and conditions of use. | ||
</p> | ||
|
||
<p> | ||
<em> | ||
<strong>JCIFS</strong> <br/> <br /> | ||
|
||
<a href="https://jcifs.samba.org/src/jcifs-1.3.18.jar">jcifs-1.3.18</a> is distributed under <a href="https://www.gnu.org/licenses/lgpl-2.1.txt">LGPL</a> license. | ||
</em> | ||
</p> | ||
|
||
</body> | ||
</html> |
8 changes: 8 additions & 0 deletions
8
addons/binding/org.openhab.binding.airvisualnode/build.properties
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,8 @@ | ||
source..=src/main/java/ | ||
output..=target/classes | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
OSGI-INF/,\ | ||
ESH-INF/,\ | ||
about.html,\ | ||
lib/jcifs-1.3.18.jar |
Binary file not shown.
Oops, something went wrong.