mirror of https://github.com/arendst/Tasmota.git
Updated openHAB (markdown)
parent
fa6799c481
commit
0fb6148d49
50
openHAB.md
50
openHAB.md
|
@ -158,7 +158,7 @@ The example below includes upgrading the firmware of all modules. A shoutout to
|
|||
//... all the above
|
||||
|
||||
//Maintenance
|
||||
String Sonoff_Action "Sonoff Action" <sonoff_basic>
|
||||
String Sonoff_Action "Sonoff Action" <sonoff_basic>
|
||||
```
|
||||
|
||||
**yourhome.sitemap:**
|
||||
|
@ -230,13 +230,13 @@ With the item in your sitemap, you will now see the latest release/tag from the
|
|||
```java
|
||||
Bridge mqtt:broker:myMQTTBroker [ host="IPofBroker", secure=false, username="myUser", password="myPassword" , clientID="myMQTTClient" ]
|
||||
{
|
||||
Thing topic sonoff_TH_Thing "Light_TH" {
|
||||
Thing topic sonoff_TH_Thing "Light_TH" {
|
||||
Channels:
|
||||
Type switch : PowerSwitch [ stateTopic="stat/sonoff_TH/POWER" , transformationPattern="JSONPATH:$.POWER" , commandTopic="cmnd/sonoff_TH/POWER", on="ON", off="OFF" ]
|
||||
Type string : Version [stateTopic="stat/sonoff_TH/STATUS2", transformationPattern="JSONPATH:$.StatusFWR.Version"]
|
||||
Type string : Temperature [stateTopic="tele/sonoff_TH/SENSOR", transformationPattern="JSONPATH:$.AM2301.Temperature"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**.items File:**
|
||||
|
@ -253,33 +253,33 @@ String Sonoff_Version "Sonoff Version: [%s]" <sonoff_basic> { channel="mqtt:top
|
|||
```java
|
||||
// Work with a list of selected Sonoff modules
|
||||
val sonoff_device_ids = newArrayList(
|
||||
“sonoff-A00EEA”,
|
||||
//… add all your modules here!
|
||||
“sonoff-E8A6E4”
|
||||
"sonoff-A00EEA",
|
||||
//… add all your modules here!
|
||||
"sonoff-E8A6E4"
|
||||
)
|
||||
// OR
|
||||
// Work with the grouptopic, addressing ALL modules at once
|
||||
//val sonoff_device_ids = newArrayList(“sonoffs”)
|
||||
//val sonoff_device_ids = newArrayList("sonoffs")
|
||||
|
||||
rule “Sonoff Maintenance”
|
||||
rule "Sonoff Maintenance"
|
||||
when
|
||||
Item Sonoff_Action received command
|
||||
Item Sonoff_Action received command
|
||||
then
|
||||
logInfo(“sonoff.rules”, “Sonoff Maintenance on all devices: " + receivedCommand)
|
||||
val actionsBroker = getActions(“mqtt”,“mqtt:broker:MyMQTTBroker”) // change to your broker name!
|
||||
for (String device_id : sonoff_device_ids) {
|
||||
switch (receivedCommand) {
|
||||
case “restart” :
|
||||
actionsBroker.publishMQTT( “cmnd/” + device_id + “/restart”, “1”)
|
||||
case “queryFW” :
|
||||
actionsBroker.publishMQTT( “cmnd/” + device_id + “/status”, “2”)
|
||||
case “upgrade” : {
|
||||
actionsBroker.publishMQTT( “cmnd/” + device_id +”/otaurl", “http://sonoff.maddox.co.uk/tasmota/sonoff-DE.bin”)
|
||||
actionsBroker.publishMQTT( “cmnd/” + device_id + “/upgrade”, “1”)
|
||||
}
|
||||
}
|
||||
}
|
||||
Sonoff_Action.postUpdate(NULL)
|
||||
logInfo("sonoff.rules", "Sonoff Maintenance on all devices: " + receivedCommand)
|
||||
val actionsBroker = getActions("mqtt","mqtt:broker:MyMQTTBroker") // change to your broker name!
|
||||
for (String device_id : sonoff_device_ids) {
|
||||
switch (receivedCommand) {
|
||||
case "restart" :
|
||||
actionsBroker.publishMQTT( "cmnd/" + device_id + "/restart", "1")
|
||||
case "queryFW" :
|
||||
actionsBroker.publishMQTT( "cmnd/" + device_id + "/status", "2")
|
||||
case "upgrade" : {
|
||||
actionsBroker.publishMQTT( "cmnd/" + device_id + "/otaurl", "http://sonoff.maddox.co.uk/tasmota/sonoff-DE.bin")
|
||||
actionsBroker.publishMQTT( "cmnd/" + device_id + "/upgrade", "1")
|
||||
}
|
||||
}
|
||||
}
|
||||
Sonoff_Action.postUpdate(NULL)
|
||||
end
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue