Hello all,
I managed to follow the various tutorials and flashed an Sonoff S20 and am able to switch it throug MQTT.fx.
Status updates can also be seen in mqtt sub.
Here is my problem:
I created a sitemap according to the tutorial and created a switch for the S20 but it doesn’t do anything.
In openhab.log I see the following entry:
[ERROR] [org.apache.felix.configadmin ] - Cannot use configuration org.openhab.mqtt for [org.openhab.core.scriptengine.action.ActionService, org.osgi.service.cm.ManagedService, id=392, bundle=207/mvn:org.openhab.action/org.openhab.action.mqtt/1.10.0]: No visibility to configuration bound to mvn:org.openhab.io/org.openhab.io.transport.mqtt/1.10.0
my mqtt.cfg looks like this
#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
<broker>.url=tcp://192.168.178.199:1883
# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
#<broker>.clientId=<clientId>
# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false
# Optional. User id to authenticate with the broker.
#<broker>.user=<user>
# Optional. Password to authenticate with the broker.
#<broker>.pwd=<password>
# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#<broker>.qos=<qos>
# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
<broker>.retain=<retain>
# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
<broker>.async=<async>
# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
broker>.lwt=<last will definition>
my .items file looks like this:
Switch ki_plug1_SWITCH "Küche Steckdose 1" <light> (LR,gLight)
{ mqtt=">[broker:cmnd/sonoff_ki_plug1/POWER:command:*:default],<[broker:stat/sonoff_ki_plug1/POWER:state:default]" }
Number ki_plug1_WIFI "Küche Steckdose 1: WIFI [%d %%]" (gRSSI)
{ mqtt="<[broker:tele/sonoff_ki_plug1/STATE:state:JSONPATH($.Wifi.RSSI)]" }
String ki_plug1_VERBOSE "Living Room Light: MQTT return message [%s]"
{ mqtt="<[broker:tele/sonoff_ki_plug1/INFO1:state:default],
<[broker:stat/sonoff_ki_plug1/STATUS2:state:default],
<[broker:stat/sonoff_ki_plug1/RESULT:state:default]" }
//Maintenance
String Sonoff_Action "Sonoff Action" <sonoff_basic>
my reachable.map looks like this:
Online=ON
Offline=OFF
my .rules file looks like this:
// Work with a list of selected Sonoff modules
val sonoff_device_ids = newArrayList(
"sonoff_ki_plug1",
"sonoff_sz_lightswitch"
//... add all your modules here!
)
// OR
// Work with the grouptopic, addressing ALL modules at once
//val sonoff_device_ids = newArrayList("sonoffs")
rule "Sonoff Maintenance"
when
Item Sonoff_Action received command
then
logInfo("sonoff.rules", "Sonoff Maintenance on all devices: " + receivedCommand)
for (String device_id : sonoff_device_ids) {
switch (receivedCommand) {
case "restart" :
publish("broker", "cmnd/" + device_id + "/restart", "1")
case "queryFW" :
publish("broker", "cmnd/" + device_id + "/status", "2")
case "upgrade" : {
publish("broker", "cmnd/" + device_id + "/otaurl", "http://sonoff.maddox.co.uk/tasmota/sonoff.ino.bin")
publish("broker", "cmnd/" + device_id + "/upgrade", "1")
}
}
}
Sonoff_Action.postUpdate(NULL)
end
Any suggestions?
Thank you in advance
Florian