Updated external content (Jenkins build 694)

pull/1839/head
openHAB Build Server 2021-12-22 03:37:29 +00:00
parent ef3b0e18ac
commit f03f95a3c2
8 changed files with 23 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -45,7 +45,7 @@ to common openHAB functionality within rules including items, things, actions, l
This add-on includes by default the [openhab-js](https://github.com/openhab/openhab-js/) NPM library and exports it's namespaces onto the global namespace. This allows the use of `items`, `actions`, `cache` and other objects without the need to explicitly import using `require()`. This functionality can be disabled for users who prefer to manage their own imports via the add-on configuration options. This add-on includes by default the [openhab-js](https://github.com/openhab/openhab-js/) NPM library and exports it's namespaces onto the global namespace. This allows the use of `items`, `actions`, `cache` and other objects without the need to explicitly import using `require()`. This functionality can be disabled for users who prefer to manage their own imports via the add-on configuration options.
![OpenHAB Rule Configuration](./docs/settings.png) ![openHAB Rule Configuration](./doc/settings.png)
## UI Based Rules ## UI Based Rules
@ -57,17 +57,17 @@ Advanced users, or users migrating scripts from existing systems may want to use
Using the openHAB UI, first create a new rule and set a trigger condition Using the openHAB UI, first create a new rule and set a trigger condition
![OpenHAB Rule Configuration](./docs/rule-config.png) ![openHAB Rule Configuration](./doc/rule-config.png)
### Adding Actions ### Adding Actions
Select "Add Action" and then select "ECMAScript 262 Edition 11". Its important this is "Edition 11" or higher, earlier versions will not work. This will bring up a empty script editor where you can enter your javascript. Select "Add Action" and then select "ECMAScript 262 Edition 11". Its important this is "Edition 11" or higher, earlier versions will not work. This will bring up a empty script editor where you can enter your javascript.
![OpenHAB Rule Engines](./docs/rule-engines.png) ![openHAB Rule Engines](./doc/rule-engines.png)
You can now write rules using standard ES6 Javascript along with the included openHAB [standard library](#standard-library). You can now write rules using standard ES6 Javascript along with the included openHAB [standard library](#standard-library).
![OpenHAB Rule Script](./docs/rule-script.png) ![openHAB Rule Script](./doc/rule-script.png)
For example, turning a light on: For example, turning a light on:
```javascript ```javascript
@ -594,7 +594,7 @@ Additionally all the above triggers have the following functions:
//Basic rule, when the BedroomLight1 is changed, run a custom function //Basic rule, when the BedroomLight1 is changed, run a custom function
rules.when().item('BedroomLight1').changed().then(e => { rules.when().item('BedroomLight1').changed().then(e => {
console.log("BedroomLight1 state", e.newState) console.log("BedroomLight1 state", e.newState)
}.build(); }).build();
//turn on the kitchen light at SUNSET //turn on the kitchen light at SUNSET
rules.when().timeOfDay("SUNSET").then().sendOn().toItem("KitchenLight").build("Sunset Rule","turn on the kitchen light rules.when().timeOfDay("SUNSET").then().sendOn().toItem("KitchenLight").build("Sunset Rule","turn on the kitchen light

View File

@ -10,7 +10,7 @@
<category>PowerOutlet</category> <category>PowerOutlet</category>
<channels> <channels>
<channel id="switch" typeId="system.power"/> <channel id="brightness" typeId="system.brightness"/>
<channel id="led" typeId="led"/> <channel id="led" typeId="led"/>
<channel id="rssi" typeId="rssi"/> <channel id="rssi" typeId="rssi"/>
</channels> </channels>

View File

@ -103,6 +103,13 @@
<state pattern="%.1f %unit%" readOnly="true"/> <state pattern="%.1f %unit%" readOnly="true"/>
</channel-type> </channel-type>
<channel-type id="pm25">
<item-type>Number:Density</item-type>
<label>Air Quality</label>
<description>Current Air Quality measured in PM 2.5</description>
<state pattern="%.1f %unit%" readOnly="true"/>
</channel-type>
<channel-type id="waterLevel"> <channel-type id="waterLevel">
<item-type>Number</item-type> <item-type>Number</item-type>
<label>Water Level</label> <label>Water Level</label>
@ -113,6 +120,7 @@
<option value="1">Refill tank</option> <option value="1">Refill tank</option>
<option value="2">OK</option> <option value="2">OK</option>
<option value="3">Full</option> <option value="3">Full</option>
<option value="4">Max</option>
</options> </options>
</state> </state>
</channel-type> </channel-type>
@ -152,4 +160,11 @@
<state pattern="%d" readOnly="true"/> <state pattern="%d" readOnly="true"/>
</channel-type> </channel-type>
<channel-type id="serviceTime">
<item-type>Number:Time</item-type>
<label>Service Time</label>
<description>Service time in minutes</description>
<state pattern="%d" readOnly="true"/>
</channel-type>
</thing:thing-descriptions> </thing:thing-descriptions>

View File

@ -49,6 +49,7 @@
<channel id="automatic" typeId="automatic"/> <channel id="automatic" typeId="automatic"/>
<channel id="temperature" typeId="temperature"/> <channel id="temperature" typeId="temperature"/>
<channel id="humidity" typeId="humidity"/> <channel id="humidity" typeId="humidity"/>
<channel id="pm25" typeId="pm25"/>
<channel id="waterLevel" typeId="waterLevel"/> <channel id="waterLevel" typeId="waterLevel"/>
<channel id="fanRPM" typeId="fanRPM"/> <channel id="fanRPM" typeId="fanRPM"/>
<channel id="cleanMode" typeId="cleanMode"/> <channel id="cleanMode" typeId="cleanMode"/>
@ -56,6 +57,7 @@
<channel id="operationTime" typeId="operationTime"/> <channel id="operationTime" typeId="operationTime"/>
<channel id="discReplaceTime" typeId="discReplaceTime"/> <channel id="discReplaceTime" typeId="discReplaceTime"/>
<channel id="cleaningTime" typeId="cleaningTime"/> <channel id="cleaningTime" typeId="cleaningTime"/>
<channel id="serviceTime" typeId="serviceTime"/>
</channels> </channels>
<representation-property>macAddress</representation-property> <representation-property>macAddress</representation-property>