Local sensor (no radio)



  • I have a RPi 2 controller connected to a uno that has the radio (serial GW). I also have a arduino mega that controls all my heating zones in the house (11). Right now the mega is just spewing out debug on the serial port but I would love to connect it to the RPi and integrate it into my mysensors network. Is there any libraries for doing this or has anyone done similar? I don't want to add a radio to the mega as it is sitting right beside the controller.

    Thanks!


  • Admin

    @shabba

    Depending on how curious you are, and how advanced a setup you want, You could make a mockup that emulates the serialport protocol, it should be pretty easy to do. Or you could make a nodered flow, that picks up data from your mega, and remaps it to mysensor protocol, and then inject that into the data stream in to you controller of choice.



  • Yeah - I guess I was hoping someone else had pioneered it 🙂
    It is interesting though. I'll try and send the wife and kids away for a week!


  • Admin

    You should have a look at the "gateway-refactoring" branch. Over there it is possible to create a node without radio.

    A serially attached gateway motion sensor would look like this:

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    #include <MySensor.h>  
    
    #define CHILD_ID 1  
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()  
    { 
      sendSketchInfo("Motion Sensor", "1.0");
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);     
      present(CHILD_ID, S_MOTION);
    }
    
    void loop()  
    { 
      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
      send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
      sleep(INTERRUPT,CHANGE, SLEEP_TIME);
    }
    
    


  • @hek
    And what or how do you register this sensor in domoticz?


  • Admin

    Sorry, haven't used Domoticz myself.


 

258
Online

7.9k
Users

8.7k
Topics

93.7k
Posts