MySensorGateWay - some type of middleware



  • I started to to write on a middleware making it possible to communicate with the MySensor network since I don’t own a Vera and didn’t plan to buy one. This project started long before it actually become MySensor. Due to the few hours I have to spare it have taken sometime.

    I currently call the middleware msgw (MySensorGateWay)

    The middleware has evolved from being a solution where I had to write all the graphical presentation of the collected data to actually become a some type of middleware.

    Today it supports

    • bidirectional integration with Openhab
    • unidirectional integration with Domoticz
    • storing values in rrd files. You have to create your own rrd files.
    • assigning Radio IDs

    I spend the time integrating deeper to Openhab since that is what I plan to have as a frontend GUI. I will be fairly easy to add other integrations.

    The middleware is written in python and runs on a Raspberry connected to a Arduino UNO using usb.

    I’m currently running some battery test for my network, not turning out to be what I hoped for. Currently no battery driven sensor sensor have survived a week.

    I implemented RGB control from Openhab to a sensor (I call it a sensor, should maybe call it a node). By sending the RGB hex code as V_IR_SEND command to the sensor.

    I also implemented an RFID tag reader. that reads the ID of the fob and sends it to the gateway. Here I use the type V_IR_RECEIVE

    A combination node using both RFID and RGB can be found at https://github.com/wbcode/ham/blob/master/arduino/MySensorRFIDandRGB/RGBandRFID/RGBandRFID.ino

    For fun or testing purpose I used to fobs to control a relay switch. Depending on which fob were used. Openhub (it’s called a rule in openhab) sent a on or off to the relay through the mygm..

    rule RFID1
    when Item Info_Text_FV_Mancave changed 
    then
    	switch (Info_Text_FV_Mancave.state) {
    		case 'CD59469F' : {say("Card")
    						  sendCommand(Relay1_FV_Mancave,ON)
    						  }
    		case '9DF07DCC' : { say("Keyring")
    						  sendCommand(Relay1_FV_Mancave,OFF)
    						  }
    	}
    end    
    

    My goal is to monitor and automate my house. It will take a long time to get there since I only have a few hour now and then to work on the project. The msgw will only be a middleware that integrates between the sensor network and a GUI.

    All the code I have written can be found on github: https://github.com/wbcode/ham

    Some screenshots from the development of msgw as I call it now.

    veragw_poc3.JPG
    Debug functions and back when I still didn’t plan to integrate it to a GUI frontend.

    veragw_poc2.JPG
    Also old and will be modified to be proxy in through openhab. I want to have “map representing” of the current “now” status of all my sensors. The red over the WC is a motion sensor that have been triggered.

    d_dash.PNG
    Domoticz - dashboard using a domoticz dummy sensor.

    oh_now.PNG
    Openhab - current values received and controls to send commands into the network

    oh_rgb.PNG
    Openhab - RGB controler

    oh_chart.PNG
    RRD graphs generated and presented by Openhab. This one showing a humidity/temp battery driven sensor.

    IMAG0031_2.jpg
    Current lab corner, showing Raspberry, UNO, relay node and my combined RFID and RGB node. (Also some DVDs, who used DVDs today?)

    WB


  • Admin

    @wannabee

    Thanks!

    Is the OpenHab integration in a usable state? How complete is it?



  • @hek The openhab integration is stable, It’s some features that are missing, some mapping between openhab itemtypes and mysensor types.



  • Will there be a openhab binding of this?


  • Hero Member

    @wannabee I really like what you have done here, and I think that this will be my gateway of choice when I finish porting the sensor library to work with the radios I have. I have a few comments for how this could be made even better in the future.

    I think a good solution could be to model this on the Z wave binding and habmin integration. We can set up habmin to manage the network. This will allow us to view all the nodes, toggle inclusion mode, assign IDs, and so on.

    We would alsohave build a good binding which could take care of the automatic ID assignment and expose these through habmin.

    I'm not yet sure how this would be done, but it seems like something that would be really nice to have. Especially if we consider that OpenHAB is an open source initiative, and MySensors is a DIY approach to home automation I think good openhab integration would benefit the entire home automation community 🙂


Log in to reply
 

Suggested Topics

16
Online

11.2k
Users

11.1k
Topics

112.5k
Posts