Is MySensors Binding needed in addition to MQTT Binding (in OpenHAB 2.5.5)? (aka request() node state via MQTT)



  • Hi gang,

    As an experiment in "distributed architecture" 😄 , I have a standalone MQTT broker (Mosquitto) running on one machine, OpenHAB itself running on a different machine, and then an Arduino Nano based MQTT/Ethernet gateway. Pure text file configuration in OpenHAB. Everything works just fine in and out of OpenHAB for simple cases like updating temperaturess, switching relays, etc.

    But now I want to do some (advanced?) things like request() from controller (OpenHAB) what the child (relay) state(s) are upon start-up, instead of storing them locally on the node in EEPROM.

    I can confirm messages are going from node to MQTT by monitoring serial output of node:

    Requesting initial value from controller
    6291 TSF:MSG:SEND,2-2-0-0,s=1,c=2,t=2,pt=0,l=0,sg=0,ft=0,st=OK:
    Requesting initial value from controller
    6305 TSF:MSG:SEND,2-2-0-0,s=2,c=2,t=2,pt=0,l=0,sg=0,ft=0,st=OK:
    Requesting initial value from controller
    6318 TSF:MSG:SEND,2-2-0-0,s=3,c=2,t=2,pt=0,l=0,sg=0,ft=0,st=OK:
    Requesting initial value from controller
    6331 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=2,pt=0,l=0,sg=0,ft=0,st=OK:
    

    Note: Requesting initial value from controller was something I put into my sketch with a Serial.println statement:

    Serial.println("Requesting initial value from controller");
    request(child, V_STATUS);
    

    I can also see the requests going across MQTT:

    $ mosquitto_sub -h 192.168.x.y -t +/# -v
    
    home/gateways/mysensors0-out/2/1/2/0/2 (null)
    home/gateways/mysensors0-out/2/2/2/0/2 (null)
    home/gateways/mysensors0-out/2/3/2/0/2 (null)
    home/gateways/mysensors0-out/2/4/2/0/2 (null)
    

    And I am pretty sure that they are actually reaching OpenHAB:

    ==> /var/log/openhab2/openhab.log <==
    2020-06-17 19:25:03.541 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.
    2020-06-17 19:25:03.554 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.
    2020-06-17 19:25:03.575 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.
    2020-06-17 19:25:03.580 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.
    

    Although as you can see, OpenHAB throws an error, because the payload is empty (Command ''). This can also be seen by (null) in MQTT output, above.

    So at this point, I guess I am assuming that perhaps the MySensors binding takes care of these sort of mappings (amongst other things)?

    And if so, are my options then to either:

    1. Install MySensors binding in OpenHAB. Or,
    2. Implement whatever transformations I need somehow manually. Or,

    I already do #2 for some other things like 433mhz devices, guess I am having a debate with myself which will be less bad, re-inventing the wheel or dealing with the MySensors OpenHAB binding.

    I am not trying to slight @TimO (who I think is == https://github.com/tobof (?) ), the developer of the binding. I just had some reliability issues with it in OpenHAB (2.4 maybe?) and from my searching on the Internet about it, seemed like I was certainly not the only one.

    @TimO, If you read this please don't take it the wrong way. I think you are a hero for your contributions. I read the whole pull request where you were trying to get the binding into OpenHAB. My heart goes out to you, man! What a long and sad saga it seemed...

    OTOH, this PR maybe indicates things are starting to look up? That would be wonderful if so; I really hope you are getting some help in your endeavour.

    Or maybe I am completely off base and there is some other solution I am overlooking here?

    I would greatly appreciate anyone who might be able to shed some light. After having some recent initial success I have now been struggling again for few days straight trying to get things working reliable, and frustration is again beginning to mount. 😞



  • I had initial problems with the 2.4 binding and went MQTT only.
    I can't help you at the moment with your problem but if it were me, I'd make it work with MQTT only rather than introduce another binding unless there was no other way. I think I do a couple things with null values and it works fine but I haven't touched it in months (since it just works) so i'm of no actual help right now 😆



  • @waspie said in Is MySensors Binding needed in addition to MQTT Binding (in OpenHAB 2.5.5)? (aka request() node state via MQTT):

    I had initial problems with the 2.4 binding and went MQTT only.

    Pretty much my exact experience as well. I've been really happy with the plain vanilla Ethernet / MQTT gateway (without MySensofs binding) so far this time around. But I'm easing into it slowly and lightly, bit by bit this time. But so far, so good! 🙂

    I probably have dug into the MQTT and MySensors protocols, as well as pure textual configuration of OpenHAB well enough to probably figure out the issue I originally posted about. But then I realized I probably don't need to get state from the controller...

    This node will be a 3 relay node to control my HVAC (fan, compressor, heat) and so it really doesn't need state on startup. They can just start up always off, and then when temperature, humidity or other settings / rules demand it, controller will just tell the relays to turn on.

    I think I was at the end of like a 14 hour bender of reading and working on stuff when I made that post. Some times, you should just go to bed, instead. 😄 😄 😄

    One thing I guess I am still curious on is: what functionality exactly does the OpenHAB binding provide, other than auto-discovery and (probably much) easier node management and creation?

    Because I struggled a bit at first, but now that I am over that hump, I am actually really glad all my config is in plain text files instead of some hidden automagical database deep inside the bowels of Java and OpenHAB. 😄


Log in to reply
 

Suggested Topics

  • 15
  • 4
  • 2
  • 5
  • 6
  • 22
  • 1
  • 3

120
Online

9.5k
Users

10.2k
Topics

105.6k
Posts