OH3 - MySensors Binding
-
@TimO Great work.
I've had a merge request https://github.com/tobof/openhab2-addons/pull/141 floating around for months to add a wind direction channel to the my sensors binding.
Is your code in a shared repo? I'd love help add in my enhancement into your OH3 mysensors build.
-
Well, after a rather painful experience of manually upgrading and cherrypicking SerialPort changes from the decompiled OH3 mysensors jar posted above, I managed to get it a build working of the MySensors binding 3.1-SNAPSHOT.
This is the source: https://github.com/nikolac/openhab2-addons/tree/mysensors-oh3-migration/bundles/org.openhab.binding.mysensors
This fork has my addition, a direction channel on wind variables.
-
@ncollins Any chance this rebased work will be pushed upstream to the openhab/openhab-addons repo? Mainline support could help this binding with future framework changes and avoid reverse engineering of code changes and simplifies the binding installation.
Also any ideas on the MQTT bridge problem? Somehow the
broker name
cannot be resolved as also discussed here:
https://forum.mysensors.org/topic/10184/help-openhab-2-4-binding-mqtt
-
@fabyte I'd love to see this get pulled into the main repo. Not sure if @TimO plans to continue support, but I have no problem helping or even picking up where he leaves off.
I didn't contribute any MQTT specific fixes, and I don't recall manually migrating any MQTT fixes, but let me take a look.
-
@ncollins Thanks, really appreciate it Let me know if you need more info, here's the basic config I did:
- created a mqtt broker (not system broker) This thing is ONLINE
UID: mqtt:broker:mosquitto label: mosquitto thingTypeUID: mqtt:broker configuration: lwtQos: 0 publickeypin: true keepAlive: 60 clientid: 566e1af2-19c2-4596-904f-18b89c502e53 qos: 0 reconnectTime: 60000 host: localhost secure: false certificatepin: true lwtRetain: true enableDiscovery: true
- created a MySensors MQTT Bridge with default settings (brokername = mosquitto)
UID: mysensors:bridge-mqtt:01d212b118 label: MySensors MQTT Gateway thingTypeUID: mysensors:bridge-mqtt configuration: networkSanCheckSendHeartbeat: false topicPublish: mygateway1-in networkSanCheckInterval: 3 networkSanCheckSendHeartbeatFailAttempts: 10 topicSubscribe: mygateway1-out networkSanCheckEnabled: false networkSanCheckConnectionFailAttempts: 3 startupCheckEnabled: false brokerName: mosquitto imperial: false sendDelay: 100
Here's the logs:
09:59:32.973 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-mqtt:01d212b118' changed from UNINITIALIZED to INITIALIZING 09:59:32.980 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge 09:59:32.994 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached not exist. 09:59:32.995 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached not exist. Default passed, creating it... 09:59:32.997 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [] 09:59:32.998 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: [] 09:59:33.011 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Enabling connection watchdog 09:59:33.015 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE! 09:59:33.016 [DEBUG] [s.discovery.MySensorsDiscoveryService] - Starting MySensors discovery scan 09:59:33.022 [ERROR] [protocol.mqtt.MySensorsMqttConnection] - No connection to broker: mosquitto 09:59:33.027 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-mqtt:01d212b118' changed from INITIALIZING to OFFLINE 09:59:33.027 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [] 09:59:33.029 [ERROR] [protocol.mqtt.MySensorsMqttConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0)
I tried different broker names (like
mqtt:broker:mosquitto
, the clientid, different uid names, but the log always says the broker cannot be found. It maps to the following lines: linkI can provide more info if needed and try out debug versions of the binding if required.
-
Okay, now i tried to configure the
MQTT system broker connection
and this seems to work.- I set up the system broker and named it 'mosquitto'.
- in the MySensors MQTT bridge, as before, I used
mosquitto
as Broker Name. Now the Broker Name could be resolved and the Thing is online.
10:12:55.086 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge 10:12:55.089 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached not exist. 10:12:55.091 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached not exist. Default passed, creating it... 10:12:55.094 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [] 10:12:55.100 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: [] 10:12:55.103 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Enabling connection watchdog 10:12:55.106 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE! 10:12:55.108 [ERROR] [protocol.mqtt.MySensorsMqttConnection] - MQTT connection offline - Reason unknown 10:12:55.113 [DEBUG] [s.discovery.MySensorsDiscoveryService] - Starting MySensors discovery scan 10:12:55.117 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Adding consumer for topic: mygateway1-out/+/+/+/+/+ 10:12:55.127 [WARN ] [protocol.mqtt.MySensorsMqttConnection] - Skipping I_VERSION connection test, not recommended... 10:12:55.133 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-mqtt:84dd4a387f' changed from INITIALIZING to ONLINE 10:12:55.133 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [] 10:12:55.139 [INFO ] [protocol.mqtt.MySensorsMqttConnection] - Successfully connected to MySensors Bridge.
But
I'm having troubles with the MQTT system broker, it can't connect the broker instance.com.hivemq.client.mqtt.exceptions.ConnectionClosedException: java.io.IOException: Connection reset by peer Caused by: java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?] at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:?] at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276) ~[?:?] at sun.nio.ch.IOUtil.read(IOUtil.java:233) ~[?:?] at sun.nio.ch.IOUtil.read(IOUtil.java:223) ~[?:?] at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358) ~[?:?] at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:247) ~[bundleFile:4.1.42.Final] at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1147) ~[bundleFile:4.1.42.Final] at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347) ~[bundleFile:4.1.42.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148) [bundleFile:4.1.42.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [bundleFile:4.1.42.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) [bundleFile:4.1.42.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) [bundleFile:4.1.42.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [bundleFile:4.1.42.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [bundleFile:4.1.42.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.42.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.42.Final] at java.lang.Thread.run(Thread.java:834) [?:?]
Since this seems more a OpenHAB/mosquitto issue I will dig into it myself.
Edit
TheMQTT System Broker
seems to be a concept from OH2, where a MQTT broker was shipped internally with OpenHAB and it seems to be broken in OH3 (OH Forum).This leaves me with the following conclusions:
- The MySensors binding configuration references the
MQTT system broker connection
- With OH3, this MQTT System Broker is not working anymore.
I suppose the correct way of handling this issue is to make the MySensors binding reference a normal
MQTT Broker
bridge, not a System Broker bridge.
Anyone who knows what changes this would require? My guess is that it should be manageable -> Source Code
-
@fabyte this is helpful.
My intuition says the embedded mqtt broker and the generic mqtt binding create the same "mqtt" connection service behind the scenes. I'm guessing the generic mqtt binding isn't registering its service by name, or it's registering it by some other key.
I'd like to get the mysensors addon to work with both mqtt brokers if possible.
-
@ncollins Yes, it looks like some resources are blocked or not resolved correctly when using the system broker.
But the system broker functionality comes with the mqtt binding itself. Here is a screen of the settings when I deleted the mqtt binding:
Also I never got the system broker working, even without defining a generic mqtt broker 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
MySensors
binding - uninstalled
mqtt
binding - installed
mqtt
binding - set up the
MQTT system broker connection
4.1 setConnection Name
tosystembroker
4.2 setBroker Host
tolocalhost
(it's running on the same device)
4.3 Show advanced -> setBroker Port
to1883
since 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 Gateway
thing
5.1 setBroker Name
tosystembroker
- (manually) installed
-
@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.
-
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
I know it's an exciting time and definitely more important than developing a OH binding
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
-
@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.
-
@TimO & @fabyte I took a stab at making all of the classes/interfaces
@NonNullByDefault
and adding/overriding null checks throughout. It builds fine, seems to be working well with my ethernet gateway.I'm going to look at unit testing next.
-
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.
-
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.mysensors
Create 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?
-
@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.
-
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-a5abb81f6b2d
Broker 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 peer
Here is how I configured the thing:
-
-
One thing I had to do was explicitly set
secure="false"
into /opt/openhab/userdata/config/org/openhab/mqttbroker.config.Please try that, then restart.
-
also, is your MQTT broker password protected? if not, remove the username and password from your system broker configuration.
-
@ncollins
I will check tonight.I really appreciate all help so far.
When you refer to the broker password: do you mean when you install the mqtt using the openhabian-config utility from the command line while being logged in with ssh to the Pi?
-
@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.config
is 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 60000ms
messaged disappeared.Then you can proceed and set up the MySensors MQTT Bridge.
- uninstalled the mqtt binding
-
@haloway13 yeah, when you did the initial mqtt setup, did you protect it with a password? If not, make sure you clear out the username and password from the OpenHAB broker settings. (I’m not sure if it will fail if you provide credentials to an instance that is not password protected)
-
I am not showing such a file as mentioned in 1.1
2 & 3 refer to using the web interface?
Thanks!
-
@haloway13 Yes, everything via the web interface
-
@haloway13 Here are all of my settings in my sandbox environment.
A couple things to note, NO MQTT BINDING INSTALLED, no special MQTT thing configured, my mqtt install is not password protected.
My Gateway code:
// Enable debug prints to serial monitor #define MY_DEBUG // Enables and select radio type (if attached) //#define MY_RADIO_RF24 //#define MY_RADIO_RFM69 //#define MY_RADIO_RFM95 #define MY_GATEWAY_MQTT_CLIENT #define MY_GATEWAY_ESP8266 #define MY_BAUD_RATE 9600 #define MY_MQTT_CLIENT_ID "MYSGW01" // Set this node's subscribe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "tele/mysgw01-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "cmnd/mysgw01-in" // Set MQTT client id // Enable these if your MQTT broker requires username/password //#define MY_MQTT_USER "username" //#define MY_MQTT_PASSWORD "password" // Set WIFI SSID and password #define MY_WIFI_SSID "--------" #define MY_WIFI_PASSWORD "*********" // Set the hostname for the WiFi Client. This is the hostname // passed to the DHCP server if not static. #define MY_HOSTNAME MY_MQTT_CLIENT_ID // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) //#define MY_IP_ADDRESS 192,168,178,87 // If using static ip you can define Gateway and Subnet address as well //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1 //#define MY_IP_SUBNET_ADDRESS 255,255,255,0 // MQTT broker ip address. #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 62 //MQTT broker if using URL instead of ip address. // #define MY_CONTROLLER_URL_ADDRESS "test.mosquitto.org" // The MQTT broker port to to open #define MY_PORT 1883 // Enable inclusion mode //#define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) //#define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN D1 // Set blinking period //#define MY_DEFAULT_LED_BLINK_PERIOD 300 // Flash leds on rx/tx/err //#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 2 // the PCB, on board LED #include <ArduinoOTA.h> #include <MySensors.h> void setup() { pinMode(LED_BUILTIN, OUTPUT); // Setup locally attached sensors ArduinoOTA.setHostname(MY_HOSTNAME); ArduinoOTA.onStart([]() { Serial.println("ArduinoOTA start"); }); ArduinoOTA.onEnd([]() { Serial.println("\nArduinoOTA end"); }); ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100))); }); ArduinoOTA.onError([](ota_error_t error) { Serial.printf("Error[%u]: ", error); if (error == OTA_AUTH_ERROR) { Serial.println("Auth Failed"); } else if (error == OTA_BEGIN_ERROR) { Serial.println("Begin Failed"); } else if (error == OTA_CONNECT_ERROR) { Serial.println("Connect Failed"); } else if (error == OTA_RECEIVE_ERROR) { Serial.println("Receive Failed"); } else if (error == OTA_END_ERROR) { Serial.println("End Failed"); } }); ArduinoOTA.begin(); } void presentation() { // Present locally attached sensors here sendSketchInfo("MYSGW01-TEST Gateway","1.0"); present(0, S_BINARY); } void loop() { // Send locally attached sensors data here ArduinoOTA.handle(); } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_STATUS) { // Change relay state digitalWrite(LED_BUILTIN, message.getBool() ? LOW:HIGH); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
Thank you so much. This has gotten me so much closer to actually getting the test temp and humidity arduino thing working.
I am seeing this output from the mysensors gateway:
Mar 05 22:55:07 DEBUG GWT:RMQ:OK Mar 05 22:55:07 DEBUG GWT:TPS:TOPIC=mygateway1-out/0/255/0/0/18,MSG SENT Mar 05 22:55:07 DEBUG TSM:READY:NWD REQ Mar 05 22:55:07 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: Mar 05 22:55:07 DEBUG TSF:MSG:READ,1-1-0,s=255,c=3,t=21,pt=1,l=1,sg=0:0 Mar 05 22:55:07 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/255/3/0/21,MSG SENT Mar 05 22:55:41 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:34.0 Mar 05 22:55:41 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Mar 05 22:55:51 DEBUG TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:19.8 Mar 05 22:55:51 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/0/1/0/0,MSG SENT Mar 05 22:57:01 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:34.1 Mar 05 22:57:01 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Mar 05 22:57:11 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:34.0 Mar 05 22:57:11 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Mar 05 22:57:41 DEBUG TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:19.8 Mar 05 22:57:41 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/0/1/0/0,MSG SENT Mar 05 22:59:01 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:34.0 Mar 05 22:59:01 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Mar 05 22:59:21 DEBUG TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:19.9 Mar 05 22:59:21 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/0/1/0/0,MSG SENT Mar 05 22:59:41 DEBUG TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:19.8 Mar 05 22:59:41 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/0/1/0/0,MSG SENT Mar 05 23:00:51 DEBUG TSF:MSG:READ,1-1-0,s=1,c=1,t=1,pt=7,l=5,sg=0:34.0 Mar 05 23:00:51 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/1/1/0/1,MSG SENT Mar 05 23:01:11 DEBUG TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:19.7 Mar 05 23:01:11 DEBUG GWT:TPS:TOPIC=mygateway1-out/1/0/1/0/0,MSG SENT Mar 05 23:01:21 DEBUG TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:19.8
My Sensors Gateway configuration: not letting me upload the image/screenshot, getting an error.
![0_1615011411135_SS_2021-03-05_23-09-13.jpg](Uploading 100%)Humidity Sensor thing: same problem here.
![0_1615011449159_SS_2021-03-05_23-12-48.jpg](Uploading 100%)I will try to edit this in the morning
The short of it is that I am not seeing the values I am expecting from the sensor. I am leaning towards just not identifying the id/node for each of the things/channel.
-
Here is the humidity sensor thing page:
Here is the temperature:
Do I have the node and child id right? What should I check?
Or maybe I need to do a follow on configuration to see the values?
Thank you!
-
@haloway13 progress!
Check the channels tab of your temperature sensor thing:
"Add link to item" then follow the directions to create a new item
-
I tried just as you describe. However I think something is failing before this should be expected to succeed.
Thoughts?
openhab> log:tail 22:37:44.426 [DEBUG] [s.discovery.MySensorsDiscoveryService] - Starting MySensors discovery scan 22:37:44.428 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Adding consumer for topic: mygateway1-out/+/+/+/+/+ 22:37:44.434 [WARN ] [protocol.mqtt.MySensorsMqttConnection] - Skipping I_VERSION connection test, not recommended... 22:37:44.438 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-mqtt:3976df7e54' changed from INITIALIZING to ONLINE 22:37:44.446 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [] 22:37:44.443 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:temperature:7c6c709b27' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING 22:37:44.451 [INFO ] [protocol.mqtt.MySensorsMqttConnection] - Successfully connected to MySensors Bridge. 22:37:44.454 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING 22:37:44.460 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuration: MySensorsSensorConfiguration{nodeId=1, childId=1, requestAck=false, revertState=true, smartSleep=false, childUpdateTimeout=-1, nodeUpdateTimeout=-1, requestHeartbeatResponse=false, usePureWhiteLightInRGBW=false} 22:37:44.464 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Adding device MySensorsNode [nodeId=1, childNumber=1, chidldList={1=MySensorsChild [childId=1, nodeValue={V_VAR5=MySensorsVariableVVar5 [value=null], V_VAR1=MySensorsVariableVVar1 [value=null], V_VAR2=MySensorsVariableVVar2 [value=null], V_VAR4=MySensorsVariableVVar4 [value=null], V_VAR3=MySensorsVariableVVar3 [value=null], V_HUM=MySensorsVariableVHum [value=null]}]}] 22:37:44.465 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuration: MySensorsSensorConfiguration{nodeId=1, childId=0, requestAck=false, revertState=true, smartSleep=false, childUpdateTimeout=-1, nodeUpdateTimeout=-1, requestHeartbeatResponse=false, usePureWhiteLightInRGBW=false} 22:37:44.467 [DEBUG] [sensors.handler.MySensorsThingHandler] - Event listener for node 1-1 not registered yet, registering... 22:37:44.469 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Merging child map: {1=MySensorsChild [childId=1, nodeValue={V_VAR5=MySensorsVariableVVar5 [value=null], V_VAR1=MySensorsVariableVVar1 [value=null], V_VAR2=MySensorsVariableVVar2 [value=null], V_VAR4=MySensorsVariableVVar4 [value=null], V_VAR3=MySensorsVariableVVar3 [value=null], V_HUM=MySensorsVariableVHum [value=null]}]} with: {0=MySensorsChild [childId=0, nodeValue={V_VAR5=MySensorsVariableVVar5 [value=null], V_ID=MySensorsVariableVId [value=null], V_VAR1=MySensorsVariableVVar1 [value=null], V_VAR2=MySensorsVariableVVar2 [value=null], V_VAR4=MySensorsVariableVVar4 [value=null], V_VAR3=MySensorsVariableVVar3 [value=null], V_TEMP=MySensorsVariableVTemp [value=null]}]} 22:37:44.472 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from INITIALIZING to ONLINE 22:37:44.474 [DEBUG] [sensors.handler.MySensorsThingHandler] - Event listener for node 1-0 not registered yet, registering... 22:37:44.479 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:temperature:7c6c709b27' changed from INITIALIZING to ONLINE 22:41:47.918 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from ONLINE to UNINITIALIZED 22:41:47.936 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from UNINITIALIZED to UNINITIALIZED (DISABLED) 22:41:49.778 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from UNINITIALIZED (DISABLED) to INITIALIZING 22:41:49.786 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuration: MySensorsSensorConfiguration{nodeId=1, childId=1, requestAck=false, revertState=true, smartSleep=false, childUpdateTimeout=-1, nodeUpdateTimeout=-1, requestHeartbeatResponse=false, usePureWhiteLightInRGBW=false} 22:41:49.788 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Adding device MySensorsNode [nodeId=1, childNumber=1, chidldList={1=MySensorsChild [childId=1, nodeValue={V_VAR5=MySensorsVariableVVar5 [value=null], V_VAR1=MySensorsVariableVVar1 [value=null], V_VAR2=MySensorsVariableVVar2 [value=null], V_VAR4=MySensorsVariableVVar4 [value=null], V_VAR3=MySensorsVariableVVar3 [value=null], V_HUM=MySensorsVariableVHum [value=null]}]}] 22:41:49.791 [DEBUG] [sensors.handler.MySensorsThingHandler] - Event listener for node 1-1 not registered yet, registering... 22:41:49.795 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from INITIALIZING to ONLINE 22:41:51.075 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from ONLINE to UNINITIALIZED 22:41:51.090 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from UNINITIALIZED to UNINITIALIZED (DISABLED) 22:41:51.806 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from UNINITIALIZED (DISABLED) to INITIALIZING 22:41:51.814 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuration: MySensorsSensorConfiguration{nodeId=1, childId=1, requestAck=false, revertState=true, smartSleep=false, childUpdateTimeout=-1, nodeUpdateTimeout=-1, requestHeartbeatResponse=false, usePureWhiteLightInRGBW=false} 22:41:51.817 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Adding device MySensorsNode [nodeId=1, childNumber=1, chidldList={1=MySensorsChild [childId=1, nodeValue={V_VAR5=MySensorsVariableVVar5 [value=null], V_VAR1=MySensorsVariableVVar1 [value=null], V_VAR2=MySensorsVariableVVar2 [value=null], V_VAR4=MySensorsVariableVVar4 [value=null], V_VAR3=MySensorsVariableVVar3 [value=null], V_HUM=MySensorsVariableVHum [value=null]}]}] 22:41:51.819 [DEBUG] [sensors.handler.MySensorsThingHandler] - Event listener for node 1-1 not registered yet, registering... 22:41:51.825 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:humidity:3976df7e54:529c716d78' changed from INITIALIZING to ONLINE 22:42:06.748 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:temperature:7c6c709b27' changed from ONLINE to UNINITIALIZED 22:42:06.762 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:temperature:7c6c709b27' changed from UNINITIALIZED to UNINITIALIZED (DISABLED) 22:42:07.739 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:temperature:7c6c709b27' changed from UNINITIALIZED (DISABLED) to INITIALIZING 22:42:07.749 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuration: MySensorsSensorConfiguration{nodeId=1, childId=0, requestAck=false, revertState=true, smartSleep=false, childUpdateTimeout=-1, nodeUpdateTimeout=-1, requestHeartbeatResponse=false, usePureWhiteLightInRGBW=false} 22:42:07.751 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Adding device MySensorsNode [nodeId=1, childNumber=1, chidldList={0=MySensorsChild [childId=0, nodeValue={V_VAR5=MySensorsVariableVVar5 [value=null], V_ID=MySensorsVariableVId [value=null], V_VAR1=MySensorsVariableVVar1 [value=null], V_VAR2=MySensorsVariableVVar2 [value=null], V_VAR4=MySensorsVariableVVar4 [value=null], V_VAR3=MySensorsVariableVVar3 [value=null], V_TEMP=MySensorsVariableVTemp [value=null]}]}] 22:42:07.753 [DEBUG] [sensors.handler.MySensorsThingHandler] - Event listener for node 1-0 not registered yet, registering... 22:42:07.756 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:temperature:7c6c709b27' changed from INITIALIZING to ONLINE 22:51:49.195 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuation update for thing 1-1: {nodeUpdateTimeout=-1, smartSleep=false, requestHeartbeatResponse=false, childUpdateTimeout=-1, childId=18, nodeId=1, revertState=true, requestAck=false} 22:51:49.214 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuration: MySensorsSensorConfiguration{nodeId=1, childId=18, requestAck=false, revertState=true, smartSleep=false, childUpdateTimeout=-1, nodeUpdateTimeout=-1, requestHeartbeatResponse=false, usePureWhiteLightInRGBW=false} 22:51:49.217 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Adding device MySensorsNode [nodeId=1, childNumber=1, chidldList={18=MySensorsChild [childId=18, nodeValue={V_VAR5=MySensorsVariableVVar5 [value=null], V_VAR1=MySensorsVariableVVar1 [value=null], V_VAR2=MySensorsVariableVVar2 [value=null], V_VAR4=MySensorsVariableVVar4 [value=null], V_VAR3=MySensorsVariableVVar3 [value=null], V_HUM=MySensorsVariableVHum [value=null]}]}] 22:51:49.218 [DEBUG] [sensors.handler.MySensorsThingHandler] - Event listener for node 1-18 not registered yet, registering... 23:01:04.984 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: Temperature 23:01:08.762 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: TemperatureSensor_Temperature 23:04:05.921 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: TemperatureSensor_Variable1 23:05:12.626 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuation update for thing 1-18: {nodeUpdateTimeout=-1, smartSleep=false, requestHeartbeatResponse=false, childUpdateTimeout=-1, childId=0, nodeId=1, revertState=true, requestAck=false} 23:05:12.636 [DEBUG] [sensors.handler.MySensorsThingHandler] - Configuration: MySensorsSensorConfiguration{nodeId=1, childId=0, requestAck=false, revertState=true, smartSleep=false, childUpdateTimeout=-1, nodeUpdateTimeout=-1, requestHeartbeatResponse=false, usePureWhiteLightInRGBW=false} 23:05:12.638 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Adding device MySensorsNode [nodeId=1, childNumber=1, chidldList={0=MySensorsChild [childId=0, nodeValue={V_VAR5=MySensorsVariableVVar5 [value=null], V_VAR1=MySensorsVariableVVar1 [value=null], V_VAR2=MySensorsVariableVVar2 [value=null], V_VAR4=MySensorsVariableVVar4 [value=null], V_VAR3=MySensorsVariableVVar3 [value=null], V_HUM=MySensorsVariableVHum [value=null]}]}] 23:05:12.643 [DEBUG] [sensors.handler.MySensorsThingHandler] - Event listener for node 1-0 not registered yet, registering... 22:35:59.095 [WARN ] [orsAbstractConnection$MySensorsWriter] - Message returned from queue is null 22:37:44.434 [WARN ] [orsAbstractConnection$MySensorsWriter] - Message returned from queue is null
-
@haloway13 can you send a screenshot of your item?
-
-
@haloway13 Can you post your sketch?
Your humidity sensor and your temperature sensor Thing configurations both point to Child Id = 0. I think your humidity sensor should be Child Id = 1.
-
@ncollins
Fixed the child ID. Good catch. No change.Here is the sketch
#include <DHT.h> #define MY_DEBUG 1 #define MY_RADIO_NRF24 #define MY_NODE_ID 1 #define CHILD_ID_TEMP 0 #define CHILD_ID_HUM 1 #define DHT_DATA_PIN 3 #define SENSOR_TEMP_OFFSET 0 #include <MySensors.h> /**************************************************/ /****************** CONSTANTS *********************/ /**************************************************/ static const uint64_t UPDATE_INTERVAL = 10000; static const uint8_t FORCE_UPDATE_N_READS = 10; /**************************************************/ /****************** VARIABLES *********************/ /**************************************************/ float lastTemp; float lastHum; float temperature; float humidity; uint8_t nNoUpdatesTemp; uint8_t nNoUpdatesHum; /**************************************************/ /****************** MESSAGES **********************/ /**************************************************/ MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); DHT dht; void presentation() { present(CHILD_ID_HUM, S_HUM); present(CHILD_ID_TEMP, S_TEMP); } void setup() { delay(2000); //Wait 2 seconds before starting sequence if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) { Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!"); } sleep(dht.getMinimumSamplingPeriod()); dht.setup(DHT_DATA_PIN); } void loop() { sendTemperatureHumiditySensor(); wait(UPDATE_INTERVAL); } /**************************************************/ /**************** AUX. FUNCTIONS ******************/ /**************************************************/ void sendTemperatureHumiditySensor() { dht.readSensor(true); temperature = dht.getTemperature(); humidity = dht.getHumidity(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT!"); } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) { lastTemp = temperature; nNoUpdatesTemp = 0; temperature += SENSOR_TEMP_OFFSET; send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } else { nNoUpdatesTemp++; } if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) { lastHum = humidity; nNoUpdatesHum = 0; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } else { nNoUpdatesHum++; } }
I am able to see the debug output from the sensors
-
@haloway13 I mean, last suggestion is restarting your openhab instance. If that doesn't work, please post your openhab log.
-
@ncollins
My sdcard corrupted, had to restart from scratch. Hopefully, I can get back to the same point tonight.Thanks!
-
@ncollins QQ: Did you install mosquitto through the openhabian-config utility?
-
I assumed yes since the log was showing no connection to MQTT
I am now getting this error:
20:56:49.983 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.151' with clientid cc150d9b-7fcc-45d0-93d2-00ad80ddb9a9 20:56:50.005 [ERROR] [protocol.mqtt.MySensorsMqttConnection] - MQTT connection offline - {} com.hivemq.client.mqtt.exceptions.ConnectionClosedException: java.io.IOException: Connection reset by peer Caused by: java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?] at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:?] at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276) ~[?:?] at sun.nio.ch.IOUtil.read(IOUtil.java:233) ~[?:?] at sun.nio.ch.IOUtil.read(IOUtil.java:223) ~[?:?] at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358) ~[?:?] at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:247) ~[bundleFile:4.1.42.Final] at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1147) ~[bundleFile:4.1.42.Final] at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347) ~[bundleFile:4.1.42.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148) [bundleFile:4.1.42.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [bundleFile:4.1.42.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) [bundleFile:4.1.42.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) [bundleFile:4.1.42.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [bundleFile:4.1.42.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [bundleFile:4.1.42.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.42.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.42.Final] at java.lang.Thread.run(Thread.java:834) [?:?]
-
@haloway13
@ncollins
Woot!!! massive success!!!in /srv/openhab-userdata/config/org/openhab/mqttbroker.config
added at the end secure="false"
as you suggested.
21:42:04.192 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HumiditySensor_Humidity' changed from 33.1 to 33.3 21:42:54.224 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/1/1/1/0/1, Message: 33.2 21:42:54.226 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Message topic part: 1/1/1/0/1 21:42:54.228 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 1;1;1;0;1;33.2 21:42:54.231 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 1;1;1;0;1;33.2 21:42:54.234 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Node 1 found in gateway 21:42:54.236 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Child 1 found in node 1 21:42:54.238 [DEBUG] [sensors.handler.MySensorsThingHandler] - Updating channel: hum(V_HUM) value to: 33.2 21:42:54.244 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HumiditySensor_Humidity' changed from 33.3 to 33.2 21:42:54.246 [DEBUG] [sensors.handler.MySensorsThingHandler] - Setting last update for node/child 1/1 to 2021-03-11T21:42:54.000-0700 21:43:04.250 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/1/1/1/0/1, Message: 33.3 21:43:04.252 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Message topic part: 1/1/1/0/1 21:43:04.253 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 1;1;1;0;1;33.3 21:43:04.260 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 1;1;1;0;1;33.3 21:43:04.262 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Node 1 found in gateway 21:43:04.263 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Child 1 found in node 1 21:43:04.265 [DEBUG] [sensors.handler.MySensorsThingHandler] - Updating channel: hum(V_HUM) value to: 33.3 21:43:04.270 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HumiditySensor_Humidity' changed from 33.2 to 33.3 21:43:04.271 [DEBUG] [sensors.handler.MySensorsThingHandler] - Setting last update for node/child 1/1 to 2021-03-11T21:43:04.000-0700 21:43:14.266 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/1/1/1/0/1, Message: 33.2 21:43:14.268 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Message topic part: 1/1/1/0/1 21:43:14.271 [DEBUG] [protocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 1;1;1;0;1;33.2 21:43:14.276 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 1;1;1;0;1;33.2 21:43:14.278 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Node 1 found in gateway 21:43:14.280 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Child 1 found in node 1 21:43:14.281 [DEBUG] [sensors.handler.MySensorsThingHandler] - Updating channel: hum(V_HUM) value to: 33.2 21:43:14.285 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HumiditySensor_Humidity' changed from 33.3 to 33.2 21:43:14.286 [DEBUG] [sensors.handler.MySensorsThingHandler] - Setting last update for node/child 1/1 to 2021-03-11T21:43:14.000-0700
-
@haloway13 Yes!! Impressive perseverance.
Somehow I've become emotionally invested in your outcome, so this is extremely satisfying. Great work.
-
I could not have done it without you! I really appreciate the feedback and continued support. I would not have continued without it.
Now... to get the darn data to display both in C and F. I am missing something conceptually.
I should probably do this in another thread after I completely document all the steps I have done for posterity.
Thanks again!
-
@haloway13 oooof, I found that to be confusing too.
If your platform settings Settings -> Regional Settings [advanced] -> Metric / Imperial are set,
and you define your items as Number:Temperature, they should "magically" display in the correct format and auto converted, but I've had a lot of trouble with that.
There are also settings to have the gateway confirm "isMetric" and have you node respond in the appropriate unit.
Lastly, in your item definition, you can "Add Metadata" -> State Description, and set a display format that supposedly converts value, but I'm not sure I understand exactly when it's suppose to override platform settings.
More info here: https://community.openhab.org/t/solved-the-right-place-to-do-temperature-conversion/91233
-
You are correct about magic supposing to happen when adding an item with:
Number:Temperature with the correct regional imperial vs metric chosen.
I think the confusion is that the number gets converted but the units need to be overriden with metadata so that it makes sense.
Does that jive with what you understand?
Also, it is interesting that the metadata is defined at item/channel link time?
-
@haloway13 I really don't have an understanding of how it works. I'm not sure how OpenHAB knows when to convert a value from a sensor reading?
- When you set the platform level metric/imperial setting, is that establishing the assumption that all sensor values are metric/imperial?
- If the metadata override for a Number:Temperature doesn't match the platform setting, is openhab smart enough to do the conversion?
- When updating the metadata, does that convert the current value or only updates after setting the metadata?
In my limited experiments, changing the metadata just seems to change the label suffix to ˚C or ˚F
-
Hi,
I just upgraded Linux Openhab version from "openHAB 3.1.0.M2" to "openHAB 3.1.0.M3". Since upgrade I cannot use / activate MySensors binding anymore (it worked in previous version - M2).
I cleaned openhab cache, rebooted computer; feature:install openhab-transport-serial and feature:install openhab-core-io-transport-mqtt are properly installed and active. When I place Mysensors.jar to Addons folder the file gets recognized but it is listed only as Installed, not active.openhab> bundle:list | grep MySensors 266 x Installed x 80 x 3.1.0.202012312203 x openHAB Add-ons :: Bundles :: MySensors Binding
Log shows following error:
[WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.mysensors-3.1.0.jar org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [266] Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)" at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?] at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?] at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4] at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4] at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.4] at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4] at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]
Does anyone know how to resolve this issue / install missing requirement?
-
@niccodemi
same problem here
-
I've solved the dependency error and the package compiles fine, but I had no time for testing yet.
If you're willing to test: Download
-
Hi,
I have a problem with the binding. Sometimes it drops the connection to the broker without any error message.
System: OH 3.0.1 → MySensensors MQTT Bridge → Mosquitto → MySensors MQTT GatewayFresh OpenHab install on debian, system start without any error, running about 1 day, then cannot communicate via MQTT. Messages does not arrive from Mosquitto to OH, also no outgoing messages to the broker. Checked mosquitto with MQTT Explorer, thats seems working, there are messages from the MySensorsGW.
There aren’t any clue in logs ( working untill ~2021-04-13 10:27:12:757) :2021-04-13 10:27:00.947 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/11/5/1/1/2, Message: 0 2021-04-13 10:27:00.947 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Message topic part: 11/5/1/1/2 2021-04-13 10:27:00.947 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 11;5;1;1;2;0 2021-04-13 10:27:00.949 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 11;5;1;1;2;0 2021-04-13 10:27:00.949 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 11 found in gateway 2021-04-13 10:27:00.949 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 5 found in node 11 2021-04-13 10:27:00.949 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: status(V_STATUS) value to: OFF 2021-04-13 10:27:00.950 [DEBUG] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 11/5 to 2021-04-13T10:27:00.000+0200 2021-04-13 10:27:01.001 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;6;1;1;2;0 2021-04-13 10:27:01.002 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;6;1;1;2;0 2021-04-13 10:27:01.026 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/11/6/1/1/2, Message: 0 2021-04-13 10:27:01.026 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Message topic part: 11/6/1/1/2 2021-04-13 10:27:01.027 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 11;6;1;1;2;0 2021-04-13 10:27:01.031 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 11;6;1;1;2;0 2021-04-13 10:27:01.031 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 11 found in gateway 2021-04-13 10:27:01.031 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 6 found in node 11 2021-04-13 10:27:01.032 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: status(V_STATUS) value to: OFF 2021-04-13 10:27:01.032 [DEBUG] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 11/6 to 2021-04-13T10:27:01.000+0200 2021-04-13 10:27:01.102 [INFO ] [rsAbstractConnection$MySensorsWriter] - ACK received for message: 11;5;1;1;2;0 2021-04-13 10:27:01.103 [INFO ] [rsAbstractConnection$MySensorsWriter] - ACK received for message: 9;6;1;1;3;0 2021-04-13 10:27:01.103 [INFO ] [rsAbstractConnection$MySensorsWriter] - ACK received for message: 11;6;1;1;2;0 2021-04-13 10:27:02.727 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/11/13/1/0/24, Message: 0 2021-04-13 10:27:02.728 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Message topic part: 11/13/1/0/24 2021-04-13 10:27:02.728 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 11;13;1;0;24;0 2021-04-13 10:27:02.732 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 11;13;1;0;24;0 2021-04-13 10:27:02.733 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 11 found in gateway 2021-04-13 10:27:02.733 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 13 found in node 11 2021-04-13 10:27:02.734 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: var1(V_VAR1) value to: 0 2021-04-13 10:27:02.734 [DEBUG] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 11/13 to 2021-04-13T10:27:02.000+0200 2021-04-13 10:27:02.826 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/11/14/1/0/2, Message: 0 2021-04-13 10:27:02.826 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Message topic part: 11/14/1/0/2 2021-04-13 10:27:02.827 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 11;14;1;0;2;0 2021-04-13 10:27:02.836 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 11;14;1;0;2;0 2021-04-13 10:27:02.836 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 11 found in gateway 2021-04-13 10:27:02.837 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 14 found in node 11 2021-04-13 10:27:02.837 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: status(V_STATUS) value to: OFF 2021-04-13 10:27:02.838 [DEBUG] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 11/14 to 2021-04-13T10:27:02.000+0200 2021-04-13 10:27:04.050 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/7/255/3/0/22, Message: 1260498882 2021-04-13 10:27:04.051 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Message topic part: 7/255/3/0/22 2021-04-13 10:27:04.052 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 7;255;3;0;22;1260498882 2021-04-13 10:27:04.052 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 7;255;3;0;22;1260498882 2021-04-13 10:27:04.725 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - MQTT message received. Topic: mygateway1-out/9/255/3/0/22, Message: 568774403 2021-04-13 10:27:04.726 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Message topic part: 9/255/3/0/22 2021-04-13 10:27:04.726 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Converted MQTT message to MySensors Serial format. Sending on to bridge: 9;255;3;0;22;568774403 2021-04-13 10:27:12.747 [INFO ] [org.openhab.core.model.script.Info ] - Hot Water Heating: Off 2021-04-13 10:27:12.755 [DEBUG] [ensors.handler.MySensorsThingHandler] - Adapter: class org.openhab.binding.mysensors.converter.MySensorsOnOffTypeConverter loaded 2021-04-13 10:27:12.757 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 11 found in gateway 2021-04-13 10:27:12.757 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 6 found in node 11 2021-04-13 10:27:12.757 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;6;1;1;2;0 2021-04-13 10:27:12.757 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;6;1;1;2;0 2021-04-13 10:27:12.858 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;6;1;1;2;0 2021-04-13 10:27:12.858 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;6;1;1;2;0 2021-04-13 10:27:12.959 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;6;1;1;2;0 2021-04-13 10:27:12.960 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;6;1;1;2;0 2021-04-13 10:27:13.461 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;6;1;1;2;0 2021-04-13 10:27:13.462 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;6;1;1;2;0 2021-04-13 10:27:14.464 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;6;1;1;2;0 2021-04-13 10:27:14.464 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;6;1;1;2;0 2021-04-13 10:27:15.695 [INFO ] [org.openhab.core.model.script.Info ] - Nappali Heating Demand : 0 2021-04-13 10:27:15.697 [INFO ] [org.openhab.core.model.script.Info ] - Gyerekszoba Heating Demand set to: 0 2021-04-13 10:27:15.699 [INFO ] [org.openhab.core.model.script.Info ] - Haloszoba Heating Demand set to: 0 2021-04-13 10:27:15.703 [DEBUG] [ensors.handler.MySensorsThingHandler] - Adapter: class org.openhab.binding.mysensors.converter.MySensorsOnOffTypeConverter loaded 2021-04-13 10:27:15.703 [DEBUG] [ensors.handler.MySensorsThingHandler] - Adapter: class org.openhab.binding.mysensors.converter.MySensorsPercentTypeConverter loaded 2021-04-13 10:27:15.704 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 9 found in gateway 2021-04-13 10:27:15.704 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 11 found in gateway 2021-04-13 10:27:15.704 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 6 found in node 9 2021-04-13 10:27:15.705 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 5 found in node 11 2021-04-13 10:27:15.866 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 9;6;1;1;3;0 2021-04-13 10:27:15.867 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 9;6;1;1;3;0 2021-04-13 10:27:15.968 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;5;1;1;2;0 2021-04-13 10:27:15.969 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;5;1;1;2;0 2021-04-13 10:27:16.170 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 9;6;1;1;3;0 2021-04-13 10:27:16.171 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 9;6;1;1;3;0 2021-04-13 10:27:16.274 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;5;1;1;2;0 2021-04-13 10:27:16.274 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;5;1;1;2;0 2021-04-13 10:27:16.475 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 9;6;1;1;3;0 2021-04-13 10:27:16.476 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 9;6;1;1;3;0 2021-04-13 10:27:16.576 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;5;1;1;2;0 2021-04-13 10:27:16.577 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;5;1;1;2;0 2021-04-13 10:27:16.678 [WARN ] [rsAbstractConnection$MySensorsWriter] - NO ACK for message: 11;6;1;1;2;0 2021-04-13 10:27:16.679 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 11 found in gateway 2021-04-13 10:27:16.680 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 6 found in node 11 2021-04-13 10:27:16.680 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Variable MySensorsVariableVStatus found, it will be reverted to last know state 2021-04-13 10:27:16.681 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: status(V_STATUS) value to: OFF 2021-04-13 10:27:16.683 [WARN ] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 11/6 BACK (due to revert) to 2021-04-13T10:27:02.000+0200 2021-04-13 10:27:17.085 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 9;6;1;1;3;0 2021-04-13 10:27:17.086 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 9;6;1;1;3;0 2021-04-13 10:27:17.187 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;5;1;1;2;0 2021-04-13 10:27:17.188 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;5;1;1;2;0 2021-04-13 10:27:18.090 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 9;6;1;1;3;0 2021-04-13 10:27:18.091 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 9;6;1;1;3;0 2021-04-13 10:27:18.191 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 11;5;1;1;2;0 2021-04-13 10:27:18.192 [DEBUG] [rotocol.mqtt.MySensorsMqttConnection] - Sending MQTT Message: Topic: mygateway1-in, Message: 11;5;1;1;2;0 2021-04-13 10:27:20.095 [WARN ] [rsAbstractConnection$MySensorsWriter] - NO ACK for message: 9;6;1;1;3;0
-
@TimO thanks for your time, but I am sorry to say there is another one:
Unresolved requirement: Import-Package: org.osgi.framework; version="[1.9.0,2.0.0)"
-
This post is deleted!
-
This post is deleted!
-
This post is deleted!
-
@oljo I am very sorry to ask, but how does your post connect to the topic of this thread?
....you are not using the mysensors-binding....
-
This post is deleted!
-
This post is deleted!
-
This post is deleted!
-
This post is deleted!
-
This post is deleted!
-
This post is deleted!
-
@oljo as I already mentioned: your posts are 100% off topic, because ypu do not use the OH3-binding for mysensors. you did some text-file thing-definitions with the MQTT-binding... apples and not plums
-
This post is deleted!
-
Hi all.
Did anyone upgrade to OH 3.1.0 stable and managed to get the MySensors Binding 3.1.0 running yet?
Sind I've upgraded to OH 3.1.0 I'm getting the following error messages in the log when starting the openhab service:I'm using a MySensors Ethernet Gateway (no MQTT, although that souldn't really make a difference) and a raspberry pi 4b+ as OH 3 server.
2021-07-04 10:37:43.376 [ERROR] [Events.Framework ] - FrameworkEvent ERROR org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [237] Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)" at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1845) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1838) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1781) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1743) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1665) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) [org.eclipse.osgi-3.16.200.jar:?]
and then a little further down the log:
2021-07-04 10:38:04.300 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.mysensors-3.1.0.jar org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [237] Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)" at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:440) ~[org.eclipse.osgi-3.16.200.jar:?] at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.8] at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.8] at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.8] at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.8] at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.8] at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.8]
Any help is highly appreciated!
Thanks and kind regards,
Ralph...
-
P.S.:
Prior to upgrading from OH 3.0.2 to OH 3.1.0 everything worked fine...
-
Hi!
I've upgraded to OH 3.1.0 from OH 3.0.x
Installed openhab-transport-serial and openhab-core-io-transport-mqtt in Karaf console with:
feature:install openhab-transport-serial feature:install openhab-core-io-transport-mqtt
Tried to restart mysensors binding:
openhab> bundle:restart org.openhab.binding.mysensors Error executing command: Error restarting bundles: Unable to start bundle 29: Could not resolve module: org.openhab.binding.mysensors [29] Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)"
Checked that only org.apache.commons.lang3 is installed:
openhab> bundle:list org.apache.commons.lang3 START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name 66 │ Active │ 80 │ 3.12.0 │ Apache Commons Lang
Thanks
-
@Chacha the log says it all: in OH3 the required package org.apache.commons.lang is installed with version 3.12.0
the (very depreciated) binding does only support up to version 3.0.0
the bug has been known for several months now.
there are 2 ways out of that situation:
a) if possible recode your sensors without mysensors and use Homie instead
b) get rid of the binding and use plain mqtt
this also applys to @syntacrsc
-
Thanks @Peter-Loeffler !
I think I'll dive into mqtt than!
As I can see Homie is only for sensors. I use mySensors to control my rollershutters.
-
@Chacha
Same here, I use MySensors to control rollershutters, pool pump, HVAC and solar panels.Maybe we should collect some volunteers for a bounty to give to @TimO to enhance his beautiful mySensors binding to work with the recent OH 3.1.0 version??
@Peter-Loeffler
I used to use plain MQTT before I found the mySensors binding and don't really want go back to it.I'd be willing to throw 100 USD into the bounty pot to enhance MySensors to work with the recent version of OH3...
(I'd do it myself if I'd know how to )
-
@Chacha you are wrong: Homie is NOT ONLY for sensors.
-
@syntacrsc well, for me it's no solution to throw Dollars into a pot that a community-based software get's some updates. either the software is state of the art ro it is not. and MySensors turned out to be not
-
@syntacrsc @TimO My system just upgraded and killed all of mySensors, which is probably half of my system... so I would be in for $50 at least
-
i've managed to build new version from the sources found here https://github.com/nikolac/openhab-addons/tree/mysensors-oh3-migration
So far, so good - working with the latest OH 3.1.0
please download from https://disk.yandex.ru/d/Yq3gn8N7tXSQxA
-
@vores8 just down loaded it and installed. Showing up online with my serial gateway. Gonna let it run but looks like it’s working now. Nice work, and thank you.
-
@TimO After my system upgrade yesterday the mysensor binding stopt working. after I replaced the binding with your new download, it started working again. Thanks, you are a real hero (at least for me).
-
Hi
Just tested out the mysensors openhab binding (org.openhab.binding.mysensors-3.2.0-SNAPSHOT) in the link provided by vores8 a few messages above.
Testing with the serial gateway, openhab 3.2 latest snapshot running pi 4.
Another detail for new users setting up by following the instruction, in the openhab install wiki (https://github.com/tobof/openhab-addons/wiki/Installation) here. This line does not work
feature:install openhab-transport-serial and feature:install openhab-core-io-transport-mqtt.
From other comments I found it is overcome by installing the openhab serial and mqtt bindings .
-
@ncollins said in OH3 - MySensors Binding:
One thing I had to do was explicitly set
secure="false"
into /opt/openhab/userdata/config/org/openhab/mqttbroker.config.Please try that, then restart.
Just had a whole load of trouble getting the binding working using MQTT - this was the solution in case anyone else hits this!
-
@vores8 said in OH3 - MySensors Binding:
i've managed to build new version from the sources found here https://github.com/nikolac/openhab-addons/tree/mysensors-oh3-migration
So far, so good - working with the latest OH 3.1.0
please download from https://disk.yandex.ru/d/Yq3gn8N7tXSQxA
For anyone interested, I just installed the latest version of OpenHabian on a raspberry pi and it is running OH 3.1.0. The Openhab 3.1 MySensors binding from the Mysensors website was not working (same error as @Chacha).
I have now installed the version that @vores8 has provided and MySensors is up and running properly.
Thanks for the help.
-
Hi,
just tested OH3 (3.1.0) on PI3 with mysensors openhab binding (org.openhab.binding.mysensors-3.2.0-SNAPSHOT) in the link provided by vores8.
feature:install openhab-transport-serial and feature:install openhab-core-io-transport-mqtt. done. It's all up and running . bundle:list shows all active.
But the "MySensors Serial Gateway" which I intend to use in OH3 will not keep ONLINE.
It always goes back to offline...11:48:29.035 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge mysensors:bridge-ser:6e5dca16a9 DONE! 11:48:29.035 [DEBUG] [ocol.serial.MySensorsSerialConnection] - Connecting to /dev/ttyUSB1 [baudRate:115200] 11:48:29.045 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-ser:6e5dca16a9' changed from OFFLINE to ONLINE 11:48:29.062 [ERROR] [ocol.serial.MySensorsSerialConnection] - Exception found java.lang.IllegalStateException: Serial Port Identifier not found at org.openhab.binding.mysensors.internal.protocol.serial.MySensorsSerialConnection.establishConnection(MySensorsSerialConnection.java:59) [bundleFile:?] at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection.connect(MySensorsAbstractConnection.java:145) [bundleFile:?] at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection.run(MySensorsAbstractConnection.java:124) [bundleFile:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:829) [?:?] 11:48:29.073 [DEBUG] [ors.internal.gateway.MySensorsGateway] - MySensorsGateway connection status update -connected: false 11:48:29.077 [DEBUG] [s.discovery.MySensorsDiscoveryService] - Stopping MySensors discovery scan 11:48:29.080 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mysensors:bridge-ser:6e5dca16a9' changed from ONLINE to OFFLINE 11:48:29.081 [DEBUG] [ysensors.internal.event.EventRegister] - Listener org.openhab.binding.mysensors.discovery.MySensorsDiscoveryService@b2d6b0 not present, cannot remove it 11:48:29.086 [DEBUG] [ensors.handler.MySensorsBridgeHandler] - Connection status mysensors:bridge-ser:6e5dca16a9 updated to false 11:48:29.090 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [0,4] 11:48:29.095 [ERROR] [ocol.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0)
any ideas?
-
@forexsieno Is the device accessible by the user that Openhab is running with?
-
@TimO said in OH3 - MySensors Binding:
Is the device accessible by the user that Openhab is running with?
@TimO Yes it is. This behaviour is not reproduceable for me. Sometimes after reboot Serial gateway keeps online. in other cases it switches to OFFLINE. I assume anything is wrong with serial driver.
-
Openhab 3.2 now contains a community marketplace for bindings, perhaps the mysensors binding can be made available there?
-
Someone have working mysensors binding in openhab 3.3 ?
-
@Jarosław-Narbut Yes, I have.
-
@CyborgAndy could you please share?
-
Im receiving following error in openhab:
[protocol.mqtt.MySensorsMqttConnection] - Can't send message, connection writer is null
Did you have the same? What did you do to resolve this?Using addon: org.openhab.binding.mysensors-3.2.0-SNAPSHOT.jar
Thanks
-
@daanjjansen I'm using OpenHAB 3.3.0
Information from OpenHAB 3.3.0 release notes:
Support for the MQTT System Broker has been removed. Replace 'mqtt:systemBroker' things with 'mqtt:broker' things.I fixed this error with MqttConnection. Your need remove MQTT System Broker and create new MQTT Broker.
Download fixed org.openhab.binding.mysensors-3.3.0-SNAPSHOT.jar from my Google Disk
-
It seems that still some people are interested in this MySensors binding being updated further.
I'm currently using in openHAB 3.2 the version that @vores8 kindly provided in post #109 on 21/07/2022, based on the source fork from @ncollins (https://github.com/nikolac/openhab2-addons/tree/mysensors-oh3-migration).
Now I noticed that there seems to be a bug in the ethernet gateway with reconnecting after the TCP connection is lost. The loss of the connection is detected, but it is not disconnected and re-established afterwards.
I would like to look at this in the " current" source code and if possible develop a fix and provide it.
Therefore the question to the community and especially to @vores8 and @ncollins, if the source code adapted to OH 3.2 or now to OH 3.3 has been uploaded by you to GitHub. If so, under which repository and branch? If not, please catch up on it for us so that we can merge the adaption you have made to the source and possibly bundle and ensure further development.
Thanks a lot in advance!
-
@mbedarff good question. Seems @CyborgAndy is keeping the addon alive? If so, @CyborgAndy are you publishing your changes to a public branch/fork?
-
@forexsieno Did you solve this one?
I'm still getting the same error.
Using 3.3.0-SNAPSHOT
2022-08-08 02:21:23.200 [ERROR] [col.serial.MySensorsSerialConnection] - Exception found java.lang.IllegalStateException: Serial Port Identifier not found at org.openhab.binding.mysensors.internal.protocol.serial.MySensorsSerialConnection.establishConnection(MySensorsSerialConnection.java:59) [bundleFile:?] at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection.connect(MySensorsAbstractConnection.java:145) [bundleFile:?] at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection.run(MySensorsAbstractConnection.java:124) [bundleFile:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:829) [?:?]
-
Hi.
@mbedarff I fix gateway connection checking issue.
You can download the fixed version from my Google Disk@mbedarff @ncollins I published all changes to GitHub, "mysensors-binding-addon" branch.
@forexsieno I tested my 3.3.0-SNAPSHOT in different environments (Arduino Nano as serial gateway, OH 3.3 installed on Windows 10 and Ubuntu Server 20.04) and did not find such a problem.
-
@CyborgAndy Glad to hear, that you have published all your fixes and upgrades to GitHub! So we have a current source code base to continue development or for debugging.
Thank you for the gateway connection fix! I just upgrade my OH instance from 3.2 to 3.3 and successfully tested your snapshot.
Have a nice weekend!
-
After upgrading OH from 3.2.0 to 3.3.0 and placing latest Mysensors binding (3.3.0-SNAPSHOT) into addon folder I can only get it to "Installed" status but not "active".
Any advise how to remove following issues?
openhab> feature:install openhab-transport-serial openhab> feature:install openhab-core-io-transport-mqtt openhab> diag 291 openHAB Add-ons :: Bundles :: MySensors Binding (291) ----------------------------------------------------- Status: Installed Unsatisfied Requirements: osgi.wiring.package; filter:="(osgi.wiring.package=org.openhab.binding.mqtt.handler)" osgi.wiring.package; filter:="(osgi.wiring.package=org.openhab.binding.mysensors.action)" osgi.wiring.package; filter:="(osgi.wiring.package=org.openhab.binding.mysensors.config)" osgi.wiring.package; filter:="(osgi.wiring.package=org.openhab.binding.mysensors.factory)" Declarative Services
-
@CyborgAndy work perfectly here.
Thanks for you effort!
-
@CyborgAndy @vores8 and @TimO and everyone else that worked on getting this binding to work on OH3, you guys are rockstars. I fubar'd my OH2 installation and decided that i might as well upgrade to OH3. I'm so glad that the mysensors binding works with it. I'm running a Raspberry Pi Serial Gateway which amazingly also installed with only a few minor hick-ups. Thank you all so much!