💬 OpenHAB


  • Admin

    This thread contains comments for the article "OpenHAB" posted on MySensors.org.



  • Can you please add a link/button at the top of the page - Download and installation - that links to https://github.com/tobof/openhab2-addons/wiki
    It is a very useful page but also very hard to find.
    The two middle buttons should preferably be removed as the "Support Forum" button is sufficient.

    • "OpenHAB binding" links to instructions for OpenHAB v1.x which is obsolete
    • "OpenHAB 2 binding" links to instructions for an old version of the plugin

  • Admin

    Thanks @fredswed, updated.


  • Plugin Developer



  • Hi guys, several updates on the OpenHAB front, being MQTT one of the biggest. Where can I update some of this outdated info?

    I highly recommend OpenHAB for mysensors, but for what you read here is not so tempting 😉

    regards



  • @guillermo-schimmel updating how to use the OpenHab 2.4 MQTT would be wonderful. Just updated OpenHab, and the new MQTT broke everything I had setup. I'm sure there is a step I missed, but the new bindings and embedded broker and MQTT Things has be wondering if there is an easier controller to use.



  • @leitefrog Hi there. Hold on.

    I'm testing two variants:

    1. openhab-mysensors binding. This is non-official but will try it today to see what happens. Looks promising.

    2. New mqtt binding. It's working already. You have to use the paper UI. First create the mqtt broker "thing" and then manually one channel for every mysensors variable. And then on the items definitions (files), the format changes:

    //Number tanque_temperatura      "Temperatura [%.1f °C]"   <temperature> {mqtt="<[mosquitto:mygateway1-out/10/2/1/0/0:state:default]",    expire="5m"}
    Number tanque_temperatura      "Temperatura [%.1f °C]"   <temperature> { channel="mqtt:topic:efe295fe:tanque_temperatura",    expire="5m"}
    

    After my tests today with (1) I will try to write about my experiences.



  • hi @Guillermo-Schimmel thanks for the info, I searched for a while but didn't understod what to do with channels. Do you have an example or perhaps a list of the channels that should be added, and what the values are?
    Thanks!



  • @dakipro I have still to write a decent tutorial but if you follow the docs for mysensors binding is pretty straightforward.

    What I can do is show you some of my files:

    1. Things
    Bridge mysensors:bridge-mqtt:gateway2 [ brokerName="mosquitto", topicPublish="mygateway1-in", topicSubscribe="mygateway1-out", startupCheckEnabled=false ] 
    
    1. Items
    Rollershutter Persiana24 "Persiana escritorio [%d %%]" (PERSIANAS) { channel="mysensors:cover:gateway2:cover_12_1:cover" }
    

    cover_12_1 is the channel name, you have to look at that in the Paper UI.

    1. Sitemap
    Frame label=Persianas {
    
            Slider item=Persiana24 icon="rollershutter"
            Switch item=Persiana24
            Switch item=Persiana24 icon="rollershutter" mappings=[0="Abierta", 10="10%", 25="25%", 50="50%", 90="90%", 100="Cerrada"]
        }
    

    This is all working.



  • Hi @hek, can I send you some images in order to update the very old that are showing here?


  • Admin

    Sure!

    henrik.ekblad@mysensors.org

    .. and any updates you want to see in the text as well.



  • thanks @Guillermo-Schimmel , what I have so far is
    MQTT Binding from paperUi
    MQTT Broker - added from paperUI where I input my ip adress
    Then I should add channels from PaperUi as well?
    If I try that, only option I have is Publish Trigger. There should I put topic i guess?
    Or should I just add Things as you described and something new appears?

    I can wait for tutorial if that is easier for you, I have just a few non-vital devices in mysensors.
    Thanks again!



  • @dakipro Well let me try to clarify that, because I have been there.

    Once you went the MQTT way (same as I did), you have two methods for connecting OpenHAB to the MySensors network.

    1. MQTT Binding
      Here you have sadly two flavors
      1.a.) Old mqtt 1.0 binding
      1.b.) New mqtt 2.x binding

    2. MySensors Binding

    The 1.a. route: MQTT using old MQTT 1.0 binding

    If you go the 1.a route. You can manage without using Paper UI. I did that, and it worked pretty good. The downside? You don't have integration with Paper UI, and you have to discover every mqtt topic by hand. You end with things like *mysensors1-out/10/23/0/0/3/17

    You should try to avoid that route, but do know that it works.

    The 1.b. route: MQTT using new MQTT 2.x binding

    The 1.b route. It also works fine, you define the broker via Paper UI and/or files, and you then define every channel by hand, the easier way is via PaperUI.

    This is awful.

    The 2.x route:

    And finally in order to be on the bleeding edge, you can have the new mqtt 2.x binding for other stuff, but for MySensors please install the mysensors-binding. Unfortunately is not official but you can find it here in the forums.

    It works great. You define the broker via PaperUI or files, then you define the mqtt gateway thing and then magic, autodiscover of mysensors nodes and sensors.

    Once they are discovered you can browse them on the Paper UI and then use them either via Paper UI or files (take a look at my examples).

    This is the binding. It doesn't have much documentation but there is some, please look for it, I can't seem to find it now. You have to enter the openhab cli in order to activate it.

    http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.4.0-SNAPSHOT.jar

    Item files for each mode:

    1.a)

    Number tanque_distanciaalagua  "Distancia [%.0f cm]"     <length>      {mqtt="<[mosquitto:mygateway1-out/10/1/1/0/13:state:default]",   expire="5m"}
    

    1.b)

    Number tanque_distanciaalagua  "Distancia [%.0f cm]"     <length>      { channel="mqtt:topic:efe295fe:tanque_distancia",   expire="5m"}
    
    Number tanque_distanciaalagua  "Distancia [%.0f cm]"     <length>      { channel="mysensors:distance:gateway2:distance_10_1:distance",   expire="5m"}
    

    Hope this makes some sense. Do not hesitate in writing me.

    Regards and happy OpenHAB'in.

    Guille



  • @guillermo-schimmel said in 💬 OpenHAB:

    The 1.b. route: MQTT using new MQTT 2.x binding
    The 1.b route. It also works fine, you define the broker via Paper UI and/or files, and you then define every channel by hand, the easier way is via PaperUI.
    This is awful.

    It looks that I was using 1.a, as this is how I already have items defined from before, f.eks.
    Number Temp_03 "Temperatura [%.1f °C]" {mqtt="<[mosquito:mygateway1-out/3/1/1/0/0:state:default]"}

    but I do agree, this is a bit... time consuming to figure out which value should be sent when.

    To migrate from this to 1.b, I would have to define every channel in the things file?
    I am not a fan of PaperUi , and would like to have a official bindings when possible. It is always annoying to update openhab, and I would like to keep it as less complicated as possible.

    Do you have an example (or give some tips) on how to go with 1.b route, either via PaperUi, or things file? What do I write there for one, f.eks. temperature-humidity sensor?

    I like having good control over each node, so defining each channel should be fine for me, I am just struggling to get started, then I can copy-paste from there 🙂

    Thanks!



  • @dakipro

    @dakipro said in 💬 OpenHAB:

    @guillermo-schimmel said in 💬 OpenHAB:

    It looks that I was using 1.a, as this is how I already have items defined from before, f.eks.
    Number Temp_03 "Temperatura [%.1f °C]" {mqtt="<[mosquito:mygateway1-out/3/1/1/0/0:state:default]"}

    but I do agree, this is a bit... time consuming to figure out which value should be sent when.

    To migrate from this to 1.b, I would have to define every channel in the things file?

    Yes, like this:

    Thing mqtt:topic:miscosas {
            Channels:
                Type number : ecovacs_1_battery_level "Ecovacs 01 Battery Level"  [ stateTopic="ecovacs/E0000693817701104736/battery_level" ]
                Type string : ecovacs_1_charge_status "Ecovacs 01 Charge Status"  [ stateTopic="ecovacs/E0000693817701104736/charge_status" ]
    

    Or via Paper UI, which is slower and painful.

    I am not a fan of PaperUi , and would like to have a official bindings when possible. It is always annoying to update openhab, and I would like to keep it as less complicated as possible.

    Do you have an example (or give some tips) on how to go with 1.b route, either via PaperUi, or things file? What do I write there for one, f.eks. temperature-humidity sensor?

    The "1.b" is just like I said. Define your .things and then is identical to the 2. From things you go to items and then sitemap.

    I like having good control over each node, so defining each channel should be fine for me, I am just struggling to get started, then I can copy-paste from there 🙂

    There you have an example, which I actually use with and old mysensor node which I modifyed (bad)

    a. Things:

    Thing mqtt:topic:miscosas {
            Channels:
                Type string : porton_a_mano           "Garage Porton a Mano"      [ stateTopic="mygateway1-out/11/3/1/0/16" ]
           }
    

    b. Items

    String item_porton_a_mano       "porton a mano"           { channel="mqtt:topic:miscosas:porton_a_mano"}
    

    c. Sitemap

    Frame label="Garage" {
        Default item=item_porton_a_mano icon="garagedoor" valuecolor=[CLOSED="green",OPEN="red" ]    
    }
    

    Thanks!



  • @guillermo-schimmel Hi! Thanks a lot for your examples!

    I currently trying to upgrade my system from method 1a (old mqtt binding, lots of items with cryptic topic definitions) to a brand new installation using method 2 (in theory, organized things/channels, autodiscovery, smartsleep support). I managed to get something kind of working but I'm not sure if I'm doing int the right way.

    • In a situation that I have one arduino, with a dht sensor (providing temperature + humidity) will I have to create separates things to get both values? ( autodiscovery did like that). Or will it be possible to have a thing representing the physical node (with nodeid), with multiple channels for each of its sensors (childs ids) ?

    • Also, do you have a working example of a MySensor thing file? looks like your examples cover mqtt2 things + items + sitemap and MySensor items (taking channel from PaperUI things page, I suppose)

    Thanks again !



  • Some time passed by but I just wanted to thank you @guillermo-schimmel , I've finally managed to connect sensors properly (at least one of them).

    I had to do some changes based on official documentation, so what I did is I just installed mqtt binding from paperUI, and then added one mysensors.things file with fallowing

    
    
    Bridge mqtt:broker:mosqbroker "Work Broker" [ host="192.168.1.ip", port="1883", secure=false, username="myuser", password="mypassword", clientID="OPENHAB", startupCheckEnabled=false  ]
    
    Thing mqtt:topic:mosqbroker:ChargingStation_Switch4h_raw_thing "Charging station button" (mqtt:broker:mosqbroker) @ "Home" {
        Channels:
            Type string : ChargingStation_Switch4h_raw_button "Charging station 4h button" [ stateTopic="mygateway1-out/31/4/1/0/16"]
    }
    
    

    and then in my items file I had this

    
    String ChargingStation_Switch4h_raw_converted       "ChargingStation Switch4h"           { channel="mqtt:topic:mosqbroker:ChargingStation_Switch4h_raw_thing:ChargingStation_Switch4h_raw_button"}
    
    

    and I get the value of the item properly (note I have string for testing, number might be more appropriate here, but that will be fixed another day)


Log in to reply
 

Suggested Topics

  • 3
  • 164
  • 584
  • 5
  • 2
  • 110

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts