OH3 - MySensors Binding
-
After reinstalling the mqtt bindung the MQTT System Broker connection now could be established - strange, that a reinstall was required since I did several OpenHAB system restarts and those didn't fix it.
Well, now the MySensors binding is working with the system broker:

Here's a MySensors temperature item:

To sum up, here's what I did
- (manually) installed
MySensorsbinding - uninstalled
mqttbinding - installed
mqttbinding - set up the
MQTT system broker connection
4.1 setConnection Nametosystembroker
4.2 setBroker Hosttolocalhost(it's running on the same device)
4.3 Show advanced -> setBroker Portto1883since it was always using 8883 but I don't use a secure connection
(4.4 I didn't set a clientid, no user and no password) - set up the
MySensors MQTT Gatewaything
5.1 setBroker Nametosystembroker
@fabyte Nice work. I don't use mysensors-mqtt, but I do have a lot of tasmota devices using the generic mqtt binding.
I followed your directions to create system broker, then changed my existing mqtt broker connection to a "systemBroker" and referenced it by brokerid (Broker Name).
I had one other issue, the new system broker wouldn't start up. I had to manually add
secure="false"to /opt/openhab/userdata/config/org/openhab/mqttbroker.config .Maybe you can get away with toggling "Secure Connection?" a couple of times.
- (manually) installed
-
I just want you to know, that I'm still there, but out of time at the moment. My third child was born just recently and I don't have any time for the binding at the moment.
I'm really sorry you had to reverse engineer the binding to add your code. That's awfully wrong.
We need to create a new common base to continue the work on the binding.
I was not able to add the binding to the official repo because of the formal requirements from the Openhab Team. I'm sure these requirements are needed, but I'm no professional in java. I struggled mainly at the nonnull annotations that are needed. -
I just want you to know, that I'm still there, but out of time at the moment. My third child was born just recently and I don't have any time for the binding at the moment.
I'm really sorry you had to reverse engineer the binding to add your code. That's awfully wrong.
We need to create a new common base to continue the work on the binding.
I was not able to add the binding to the official repo because of the formal requirements from the Openhab Team. I'm sure these requirements are needed, but I'm no professional in java. I struggled mainly at the nonnull annotations that are needed.@TimO Congratulations on your child :clap:
I know it's an exciting time and definitely more important than developing a OH binding :grin:
Spending time with your family should always be number 1 priority and you can't blame anyone for taking time off from a internet community :) -
I just want you to know, that I'm still there, but out of time at the moment. My third child was born just recently and I don't have any time for the binding at the moment.
I'm really sorry you had to reverse engineer the binding to add your code. That's awfully wrong.
We need to create a new common base to continue the work on the binding.
I was not able to add the binding to the official repo because of the formal requirements from the Openhab Team. I'm sure these requirements are needed, but I'm no professional in java. I struggled mainly at the nonnull annotations that are needed.@TimO Congrats!
I've been looking some of the other addon-ons and your code actually looks a lot better than most. I think the base is pretty solid.
I'll take a look at the annotations, and maybe getting some more traditional unit tests in place.
If we get to a point where a merge is acceptable, maybe we can move the maintenance fork to the MySensors repo.
-
I have been trying to get MySensors working with OH3 for a few days now and have just stumbled upon this thread. How opportune!!!
I am just trying to get a temp/hum arduino nano with a NRF24L01 hooked up to PI400 with OH3 using this link:
https://www.smarthomeblog.net/diy-home-automation-sensors-first-node/
Since I am starting from scratch with a simple proof of concept there might be some easy testing to be done with my setup.
Do you have any suggestions for me?
Thanks!
-
I have been trying to get MySensors working with OH3 for a few days now and have just stumbled upon this thread. How opportune!!!
I am just trying to get a temp/hum arduino nano with a NRF24L01 hooked up to PI400 with OH3 using this link:
https://www.smarthomeblog.net/diy-home-automation-sensors-first-node/
Since I am starting from scratch with a simple proof of concept there might be some easy testing to be done with my setup.
Do you have any suggestions for me?
Thanks!
@haloway13 Glad to see you're diving in.
Have you set up your gateway yet? If not, try this https://www.mysensors.org/build/raspberry. I find it's easier to build and debug node with a working gateway.
-
@haloway13 Glad to see you're diving in.
Have you set up your gateway yet? If not, try this https://www.mysensors.org/build/raspberry. I find it's easier to build and debug node with a working gateway.
I believe so.
openhabian@openhabian:~/MySensors $ sudo ./bin/mysgw Feb 28 14:28:54 INFO Starting gateway... Feb 28 14:28:54 INFO Protocol version - 2.4.0-alpha Feb 28 14:28:54 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,FQ=NA,REL=0,VER=2.4.0-alpha Feb 28 14:28:54 DEBUG TSF:LRT:OK Feb 28 14:28:54 DEBUG TSM:INIT Feb 28 14:28:54 DEBUG TSF:WUR:MS=0 Feb 28 14:28:54 DEBUG TSM:INIT:TSP OK Feb 28 14:28:54 DEBUG TSM:INIT:GW MODE Feb 28 14:28:54 DEBUG TSM:READY:ID=0,PAR=0,DIS=0 Feb 28 14:28:54 DEBUG MCO:REG:NOT NEEDED Feb 28 14:28:54 DEBUG MCO:BGN:STP Feb 28 14:28:54 DEBUG MCO:BGN:INIT OK,TSP=1 Feb 28 14:28:54 DEBUG GWT:RMQ:CONNECTING... Feb 28 14:28:54 DEBUG connected to 192.168.1.151 Feb 28 14:28:54 DEBUG GWT:RMQ:OK Feb 28 14:28:54 DEBUG GWT:TPS:TOPIC=mygateway1-out/0/255/0/0/18,MSG SENT Feb 28 14:28:54 DEBUG TSM:READY:NWD REQ Feb 28 14:28:54 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: Feb 28 14:29:13 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:31.3 Feb 28 14:29:13 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Feb 28 14:29:23 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:31.4 Feb 28 14:29:23 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Feb 28 14:29:43 DEBUG TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:16.1 Feb 28 14:29:43 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/0/1/0/0,MSG SENT -
I believe so.
openhabian@openhabian:~/MySensors $ sudo ./bin/mysgw Feb 28 14:28:54 INFO Starting gateway... Feb 28 14:28:54 INFO Protocol version - 2.4.0-alpha Feb 28 14:28:54 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,FQ=NA,REL=0,VER=2.4.0-alpha Feb 28 14:28:54 DEBUG TSF:LRT:OK Feb 28 14:28:54 DEBUG TSM:INIT Feb 28 14:28:54 DEBUG TSF:WUR:MS=0 Feb 28 14:28:54 DEBUG TSM:INIT:TSP OK Feb 28 14:28:54 DEBUG TSM:INIT:GW MODE Feb 28 14:28:54 DEBUG TSM:READY:ID=0,PAR=0,DIS=0 Feb 28 14:28:54 DEBUG MCO:REG:NOT NEEDED Feb 28 14:28:54 DEBUG MCO:BGN:STP Feb 28 14:28:54 DEBUG MCO:BGN:INIT OK,TSP=1 Feb 28 14:28:54 DEBUG GWT:RMQ:CONNECTING... Feb 28 14:28:54 DEBUG connected to 192.168.1.151 Feb 28 14:28:54 DEBUG GWT:RMQ:OK Feb 28 14:28:54 DEBUG GWT:TPS:TOPIC=mygateway1-out/0/255/0/0/18,MSG SENT Feb 28 14:28:54 DEBUG TSM:READY:NWD REQ Feb 28 14:28:54 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: Feb 28 14:29:13 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:31.3 Feb 28 14:29:13 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Feb 28 14:29:23 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:31.4 Feb 28 14:29:23 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Feb 28 14:29:43 DEBUG TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:16.1 Feb 28 14:29:43 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/0/1/0/0,MSG SENT@haloway13 Looks good.
Next, I would get openhab ready for adding the mysensors addon. https://github.com/tobof/openhab2-addons/wiki/Installation
Via the openhab console run the following to install/activate the binding dependencies:
feature:install openhab-transport-serial
feature:install openhab-core-io-transport-mqtt
I recommend also settinglog:set DEBUG org.openhab.binding.mysensorsCreate a mqtt system connection in OpenHAB. Be sure to check advanced, and set the port.

Then you can drop the org.openhab.binding.mysensors.jar into the addons folder and it should auto install. You can start with the binding linked above.
Once all of that is done, you can configure your first thing, which would be a MySensors MQTT Bridge. (you should disable "Enables the startup check", I believe there is a bug)

-
@haloway13 Looks good.
Next, I would get openhab ready for adding the mysensors addon. https://github.com/tobof/openhab2-addons/wiki/Installation
Via the openhab console run the following to install/activate the binding dependencies:
feature:install openhab-transport-serial
feature:install openhab-core-io-transport-mqtt
I recommend also settinglog:set DEBUG org.openhab.binding.mysensorsCreate a mqtt system connection in OpenHAB. Be sure to check advanced, and set the port.

Then you can drop the org.openhab.binding.mysensors.jar into the addons folder and it should auto install. You can start with the binding linked above.
Once all of that is done, you can configure your first thing, which would be a MySensors MQTT Bridge. (you should disable "Enables the startup check", I believe there is a bug)

-
@ncollins I have had some issues getting this going. Am I running the development branch? Can you tell from the output?
@haloway13 you have any logs or screenshots of errors you're seeing?
-
@haloway13 you have any logs or screenshots of errors you're seeing?
@ncollins best I can do is say that it was a java io exception of some sort associated with the bridge or broker. I have since started from scratch several times and have not taken any screenshots.
I have faithfully followed directions from: https://github.com/tobof/openhab2-addons/wiki/Installation
Then it is a bit of a mystery to me how to finish up the configuration through the web pages.
Any help would be greatly appreciated!
-
Hmm, I don't use openhabian, but it looks like there is a log viewer built in: http://openhabian:9001 (maybe change openhabian to the IP of your pi).
Without logs or screenshots, it'll be impossible to help.
-
Hmm, I don't use openhabian, but it looks like there is a log viewer built in: http://openhabian:9001 (maybe change openhabian to the IP of your pi).
Without logs or screenshots, it'll be impossible to help.
openhab log:tail output
log:set DEBUG org.openhab.binding.mysensors openhab> log:tail 20:17:49.861 [INFO ] [b.core.internal.i18n.I18nProviderImpl] - Time zone set to 'America/Denver'. 20:17:49.924 [INFO ] [b.core.internal.i18n.I18nProviderImpl] - Location set to '39.82834020908714,-105.06875216960907'. 20:17:49.929 [INFO ] [b.core.internal.i18n.I18nProviderImpl] - Locale set to 'en_US'. 20:18:27.583 [INFO ] [b.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007 20:18:33.947 [INFO ] [org.openhab.ui.internal.UIService ] - Started UI on port 8080 20:18:35.072 [INFO ] [re.automation.internal.RuleEngineImpl] - Rule engine started. 20:18:36.112 [INFO ] [hab.ui.habpanel.internal.HABPanelTile] - Started HABPanel at /habpanel 20:25:15.958 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'mqtt:systemBroker:mosquitto' to inbox. 20:25:15.959 [INFO ] [openhab.event.InboxAddedEvent ] - Discovery Result with UID 'mqtt:systemBroker:mosquitto' has been added. 20:25:17.970 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid 86f6e016-3847-404f-80dc-a5abb81f6b2d 20:25:28.579 [INFO ] [t.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.1.151'. Next attempt in 60000ms 20:25:28.673 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid 86f6e016-3847-404f-80dc-a5abb81f6b2d 20:26:28.685 [INFO ] [t.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.1.151'. Next attempt in 60000ms 20:26:28.694 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid 86f6e016-3847-404f-80dc-a5abb81f6b2dBroker config screen:

Addition to the Inbox:

Clicking the inbox. This is where I have no clue as to how to proceed...
-
so to follow up:
Here is the log after adding the thing systembroker:
21:28:27.906 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid bd9a756d-5cf7-46b0-adaa-856d29f8b587 21:29:27.913 [INFO ] [t.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.1.151'. Next attempt in 60000ms 21:29:27.920 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid bd9a756d-5cf7-46b0-adaa-856d29f8b587 21:30:27.925 [INFO ] [t.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.1.151'. Next attempt in 60000ms 21:30:27.933 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid bd9a756d-5cf7-46b0-adaa-856d29f8b587 21:31:05.860 [INFO ] [openhab.event.InboxRemovedEvent ] - Discovery Result with UID 'mqtt:systemBroker:mosquitto' has been removed. 21:31:06.015 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:systemBroker:mosquitto' changed from UNINITIALIZED to INITIALIZING 21:31:06.072 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:systemBroker:mosquitto' changed from INITIALIZING to OFFLINE 21:31:06.079 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid bd9a756d-5cf7-46b0-adaa-856d29f8b587 21:31:06.130 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:systemBroker:mosquitto' changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): Timeout 21:31:06.135 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:systemBroker:mosquitto' changed from OFFLINE (COMMUNICATION_ERROR): Timeout to OFFLINE (COMMUNICATION_ERROR): java.io.IOException: Connection reset by peer 21:31:27.938 [INFO ] [t.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.1.151'. Next attempt in 60000ms 21:31:27.943 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:systemBroker:mosquitto' changed from OFFLINE (COMMUNICATION_ERROR): java.io.IOException: Connection reset by peer to OFFLINE 21:31:27.951 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid bd9a756d-5cf7-46b0-adaa-856d29f8b587 21:31:27.986 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:systemBroker:mosquitto' changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): java.io.IOException: Connection reset by peer 21:32:27.956 [INFO ] [t.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.1.151'. Next attempt in 60000ms 21:32:27.967 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid bd9a756d-5cf7-46b0-adaa-856d29f8b587 21:32:27.968 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:systemBroker:mosquitto' changed from OFFLINE (COMMUNICATION_ERROR): java.io.IOException: Connection reset by peer to OFFLINE 21:32:28.014 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:systemBroker:mosquitto' changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): java.io.IOException: Connection reset by peerHere is how I configured the thing:

-
After reinstalling the mqtt bindung the MQTT System Broker connection now could be established - strange, that a reinstall was required since I did several OpenHAB system restarts and those didn't fix it.
Well, now the MySensors binding is working with the system broker:

Here's a MySensors temperature item:

To sum up, here's what I did
- (manually) installed
MySensorsbinding - uninstalled
mqttbinding - installed
mqttbinding - set up the
MQTT system broker connection
4.1 setConnection Nametosystembroker
4.2 setBroker Hosttolocalhost(it's running on the same device)
4.3 Show advanced -> setBroker Portto1883since it was always using 8883 but I don't use a secure connection
(4.4 I didn't set a clientid, no user and no password) - set up the
MySensors MQTT Gatewaything
5.1 setBroker Nametosystembroker
- (manually) installed
-
also, is your MQTT broker password protected? if not, remove the username and password from your system broker configuration.
-
@haloway13 I had exactly the same problem.
Here is what I did to fix it:- uninstalled the mqtt binding
1.1 make sure the/opt/openhab/userdata/config/org/openhab/mqttbroker.configis removed - installed the mqtt binding
- setup the system broker
After that, the system broker connection could be established and the
Try to restore connection to '192.168.1.151'. Next attempt in 60000msmessaged disappeared.Then you can proceed and set up the MySensors MQTT Bridge.
- uninstalled the mqtt binding
