I have recently installed the latest version of openHAB on a raspberry pi 3 b+. all the add ons were installed as well as mqtt binding. the consol from my Sonoff says it is connected via mqtt to openhab.
I am trying to get the the switch into opneHAB UI but am so far unsuccessful. the below content in the file “sonoff4ch.items” I created in the items folder.
These items will never show in paperUI because they are manually created in a text file for a 1.9x binding.
You should see them in the sitemap though once you get the syntax right
Again, the switches will NEVER appear on paperUI, but they should be on your sitemap
The events.log in is /var/log/openhab2/events.log
ssh in and do tail /var/log/openhab2/events.log
That will keep a running screen with what happens in the log
Do you have an MQTT client installed like mqtt.fx or mqtt-spy
Install one and subscribe to your mqtt broker witht the topic #
Action the switches on the sonoff, what do you get on mqtt.fx?
Can you show the contents of your mqtt.cfg file, please?
The sitemap folder has only one readme and a file called sitemap which is empty
The following is from
tail /var/log/openhab2/events.log
2018-05-13 11:29:29.485 [vent.ItemStateChangedEvent] - sonoff_MasterBedroom2 changed from ON to OFF
2018-05-13 11:29:30.083 [ome.event.ItemCommandEvent] - Item 'sonoff_MasterBedroom3' received command OFF
2018-05-13 11:29:30.095 [vent.ItemStateChangedEvent] - sonoff_MasterBedroom3 changed from ON to OFF
2018-05-13 11:29:30.750 [ome.event.ItemCommandEvent] - Item 'sonoff_MasterBedroom' received command OFF
2018-05-13 11:29:30.761 [vent.ItemStateChangedEvent] - sonoff_MasterBedroom changed from ON to OFF
2018-05-13 11:29:38.642 [vent.ItemStateChangedEvent] - sonoff_MasterBedroom changed from OFF to ON
2018-05-13 11:29:38.645 [vent.ItemStateChangedEvent] - sonoff_MasterBedroom1 changed from OFF to ON
2018-05-13 11:29:38.667 [vent.ItemStateChangedEvent] - sonoff_MasterBedroom4 changed from OFF to ON
2018-05-13 11:29:38.671 [vent.ItemStateChangedEvent] - sonoff_MasterBedroom2 changed from OFF to ON
2018-05-13 11:29:38.675 [vent.ItemStateChangedEvent] - sonoff_MasterBedroom3 changed from OFF to ON
the file from mqtt.cfg has no settings activated. all fields contain a # in front.
#
# 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://<host>: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>
You need to put the same settings as your sonoff in the mqtt.cfg file:
Name your broker as it is named in your items: broker
Remove the # in the following lines and write the same value
Save
In your log you should see that OH connects to your broker
2018-05-13 14:01:17.259 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sonoff.sitemap'
2018-05-13 14:01:17.565 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
2018-05-13 14:01:17.568 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Date' for widget org.eclipse.smarthome.model.sitemap.Text
2018-05-13 14:01:17.570 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Date' for widget org.eclipse.smarthome.model.sitemap.Text
2018-05-13 14:01:17.572 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Date' for widget org.eclipse.smarthome.model.sitemap.Text
2018-05-13 14:01:17.574 [WARN ] [basic.internal.render.SwitchRenderer] - Cannot determine item type of 'Sonoff4ch_4Channel1'
org.eclipse.smarthome.core.items.ItemNotFoundException: Item 'Sonoff4ch_4Channel1' could not be found in the item registry
at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.getItem(ItemRegistryImpl.java:70) [109:org.eclipse.smarthome.core:0.10.0.b1]
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getItem(ItemUIRegistryImpl.java:724) [155:org.eclipse.smarthome.ui:0.10.0.b1]
at org.eclipse.smarthome.ui.basic.internal.render.SwitchRenderer.renderWidget(SwitchRenderer.java:55) [217:org.eclipse.smarthome.ui.basic:0.10.0.b1]
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.renderWidget(PageRenderer.java:172) [217:org.eclipse.smarthome.ui.basic:0.10.0.b1]
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:137) [217:org.eclipse.smarthome.ui.basic:0.10.0.b1]
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:158) [217:org.eclipse.smarthome.ui.basic:0.10.0.b1]
at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processPage(PageRenderer.java:100) [217:org.eclipse.smarthome.ui.basic:0.10.0.b1]
at org.eclipse.smarthome.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:159) [217:org.eclipse.smarthome.ui.basic:0.10.0.b1]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [88:org.eclipse.jetty.servlet:9.3.22.v20171030]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [88:org.eclipse.jetty.servlet:9.3.22.v20171030]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [191:org.ops4j.pax.web.pax-web-jetty:6.0.7]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [85:org.eclipse.jetty.security:9.3.22.v20171030]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [191:org.ops4j.pax.web.pax-web-jetty:6.0.7]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [88:org.eclipse.jetty.servlet:9.3.22.v20171030]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [191:org.ops4j.pax.web.pax-web-jetty:6.0.7]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.eclipse.jetty.server.Server.handle(Server.java:534) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [87:org.eclipse.jetty.server:9.3.22.v20171030]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [79:org.eclipse.jetty.io:9.3.22.v20171030]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [79:org.eclipse.jetty.io:9.3.22.v20171030]
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [79:org.eclipse.jetty.io:9.3.22.v20171030]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [90:org.eclipse.jetty.util:9.3.22.v20171030]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [90:org.eclipse.jetty.util:9.3.22.v20171030]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [90:org.eclipse.jetty.util:9.3.22.v20171030]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [90:org.eclipse.jetty.util:9.3.22.v20171030]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [90:org.eclipse.jetty.util:9.3.22.v20171030]
at java.lang.Thread.run(Thread.java:748) [?:?]
also there is the following error in the logs.
2018-05-13 14:12:18.579 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'sonoff4ch.items'
2018-05-13 14:12:18.628 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'sonoff4ch.items' has errors, therefore ignoring it: [1,57]: missing EOF at '<'
2018-05-13 14:12:18.655 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'sonoff4ch.items' has errors, therefore ignoring it: [1,57]: missing EOF at '<'
I think there is a problem with linking the switches. where am I going wrong here. Also in the basic UI it does show the switches now.
First and second is mandatory while all other arguments are optional, but you mustn’t change the order.
Jfyi:
There is a new task ‘quantitytype’ which is defined in items as well: