MySensors - Gateway to Domoticz

Moderator: leecollings

joshmosh
Posts: 19
Joined: Monday 06 April 2015 7:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by joshmosh »

Robbert,
thank for your help. But my understanding of the whole story is somewhat different. Perhaps one of the implementors of the gateway can chime in ;-)

Under another topic in this board I found the following comment:
Re: Supported sensors
by AWI » Thursday 26 March 2015 14:15

To answer you question: look at the beta code below (http://sourceforge.net/p/domoticz/code/ ... rsBase.cpp)
These are currently supported types for the "SET" function (Domoticz reads these sensors one way or another).

The "REQ" function is (and will be.. http://www.domoticz.com/forum/viewtopic ... =80#p37901 ) only supported for the V_LIGHT, V_DIMMER and V_VAR types.
So this says that there is a REQ funtion, although restricted to a few types, which is fine with me.
Flyingdodo wrote:Hi Josh,

I think you can send REQ to other Mysensors devices, not directly to domoticz. I think it is possible to do a request to the gateway and the gateway makes a request to domoticz, but you need to implement this yourself.
If you look in the Mysensors API youll find this at the requesting data tab:

Requests a variable value from gateway or some other sensor in the radio network. Make sure to add callback-method in begin-method to handle request responses. If you send this request to some other sensor-node you must handle the reply message yourself in the destination node.

Code: Select all

void request(uint8_t childSensorId, uint8_t variableType, uint8_t destination);
childSensorId - The unique child id for the different sensors connected to this Arduino. 0-254.
variableType - The variableType to fetch.
destination - The nodeId of other node to request data from in radio network. Default is gateway.

So you need to handle the request yourself.
I hope this helps you.

Robbert
From the quote above I deduct that you can send REQUEST messages to the controller (Domoticz). Domoticz only deals with a subset of types of variables - fine, no problem for me.
Your excerpt from the MySensors API says under destination: Default is gateway. My understanding is that the gateway passes it on to the controller, same as for example with SET messages. I am logging the serial interface to Domoticz and I can clearly see that a REQ is sent to the controller: 21;3;2;0;2 (21 is my node id, 3 is child id, 2 is REQ, 0 for no ack requested and 2 is variable type V_LIGHT)

Somewhere else on this board there is an example how to request variables from Domoticz, but since V_LIGHT is supported, there is obviously something that I am doing wrong.

So, Robbert, no offence :-) and again thank you for your help. Perhaps somebody can direct me to my misunderstanding.

Cheers
Josh
hahi
Posts: 12
Joined: Wednesday 08 April 2015 18:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by hahi »

I would say paste your serial monitor output from the node and a link to the sketch. The default relay sketch RelayActuator.ino handles incomming on/off messages from the controller and it should treat a response to the node request in the same maner. The serial monitor should tell you if Domoticz is responding to your requests.


http://sourceforge.net/p/domoticz/code/ ... .cpp#l1154
joshmosh
Posts: 19
Joined: Monday 06 April 2015 7:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by joshmosh »

hahi wrote:I would say paste your serial monitor output from the node and a link to the sketch. The default relay sketch RelayActuator.ino handles incomming on/off messages from the controller and it should treat a response to the node request in the same maner. The serial monitor should tell you if Domoticz is responding to your requests.


http://sourceforge.net/p/domoticz/code/ ... .cpp#l1154
Good idea. In fact, I will use the original default sketch for a test. Should have thought of it myself :oops:
Thanks. Will keep you posted ...
joshmosh
Posts: 19
Joined: Monday 06 April 2015 7:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by joshmosh »

OK, so here is the result:

Code: Select all

send: 27-27-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
                                                   repeater started, id 27
                                                                          send: 27-27-255-0 s=255,c=0,t=18,pt=0,l=5,st=fail:1.4.1
                                                 send: 27-27-255-0 s=255,c=3,t=6,pt=1,l=1,st=fail:255
                     send: 27-27-255-0 s=255,c=3,t=11,pt=0,l=14,st=fail:Relay & Button
      send: 27-27-255-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0
                                                           send: 27-27-255-0 s=1,c=0,t=3,pt=0,l=5,st=fail:1.4.1
I cannot really interpret what these numbers mean. st=fail suggests, that something is wrong, but on Domoticz everything looks fine.
Excerpts from the Domoticz log:

Code: Select all

2015-04-25 10:38:58.113 MySensors: Node: 27, Sketch Name: Relay & Button
2015-04-25 10:38:58.162 MySensors: Node: 27, Sketch Version: 1.0
2015-04-25 10:38:58.204 (Uno SerialGW) Lighting 2 (Unknown)
The device shows in Domoticz (as light) and I can switch it on and off in Domoticz, but in the output of the node nothing happens.
Strange ...
Cheers
Josh
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by ThinkPad »

Something is wrong with your hardware, look at the output you are getting.... Notice the:

Code: Select all

st=fail
That means it could not send or receive the command. Probably has to do with the powersupply to the nRF24L01+
Try using an external 3.3V power source for the nRF.
I am not active on this forum anymore.
joshmosh
Posts: 19
Joined: Monday 06 April 2015 7:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by joshmosh »

Hi ThinkPad,
you've made my day ! I thought that putting big fat (220 uF) capacitors across the supply pins of the nRF's would be sufficient, but I was totally wrong.
Now with a separate 3.3 V supply in addition to the capacitors did the show.

Thanks a bunch - I owe you.

Have a wonderful weekend - as I have now wit another roadblock removed.
Thank you
Cheers
Josh
slasklitta
Posts: 5
Joined: Tuesday 03 February 2015 19:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Sweden
Contact:

Re: MySensors - Gateway to Domoticz

Post by slasklitta »

How are you guys connecting the external power source for the radio?

I'm just using plain Apple USB chargers right now. Still not showing up.

Do I really need two outlets/chargers to run one sensor? :lol: Doesn't seem right to me
User avatar
Mediacj
Posts: 74
Joined: Wednesday 11 February 2015 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by Mediacj »

slasklitta wrote:How are you guys connecting the external power source for the radio?

I'm just using plain Apple USB chargers right now. Still not showing up.

Do I really need two outlets/chargers to run one sensor? :lol: Doesn't seem right to me
I am using the Apple iPad charger which effectively runs:
a Raspberry Pi 2, a external 2,5 inch harddisk and a Mysensors Gateway with the NRF24L01+/PA/LNA Antenne version which needs extra power to work.
slasklitta
Posts: 5
Joined: Tuesday 03 February 2015 19:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Sweden
Contact:

Re: MySensors - Gateway to Domoticz

Post by slasklitta »

Mediacj wrote:
slasklitta wrote:How are you guys connecting the external power source for the radio?

I'm just using plain Apple USB chargers right now. Still not showing up.

Do I really need two outlets/chargers to run one sensor? :lol: Doesn't seem right to me
I am using the Apple iPad charger which effectively runs:
a Raspberry Pi 2, a external 2,5 inch harddisk and a Mysensors Gateway with the NRF24L01+/PA/LNA Antenne version which needs extra power to work.
Cool!
I think I have an old Macbook charger.

So how did you do the wiring?
User avatar
Mediacj
Posts: 74
Joined: Wednesday 11 February 2015 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by Mediacj »

I have connected the main power to one of the four front USB ports, from one front USB port I connect the micro usb cable to the micro USB port to power up.

The gateway and external harddisk are also connected to the four front USB ports.
slasklitta
Posts: 5
Joined: Tuesday 03 February 2015 19:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Sweden
Contact:

Re: MySensors - Gateway to Domoticz

Post by slasklitta »

Mediacj wrote:I have connected the main power to one of the four front USB ports, from one front USB port I connect the micro usb cable to the micro USB port to power up.

The gateway and external harddisk are also connected to the four front USB ports.
But the NRF24L01+ is 3.3v. How do you power it?
lrybak
Posts: 40
Joined: Thursday 18 December 2014 20:12
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Poland
Contact:

Re: MySensors - Gateway to Domoticz

Post by lrybak »

Please refer mysensors website. They nicely described how to power radio
HW: HP dc7900 USD running ESXi, RaspberryPi (few of it), AEON S2 USB stick, Fibaro modules (Dimmers, switches), 1-wire (DS18B20, DS2423), DSC Alarm with Envisalink ethernet module, MySensors, RFLink
User avatar
Mediacj
Posts: 74
Joined: Wednesday 11 February 2015 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by Mediacj »

slasklitta wrote:
Mediacj wrote:I have connected the main power to one of the four front USB ports, from one front USB port I connect the micro usb cable to the micro USB port to power up.

The gateway and external harddisk are also connected to the four front USB ports.
But the NRF24L01+ is 3.3v. How do you power it?
I use a Arduino Nano as Gateway it has a 3.3V output but that is not powerful enough for the NRF24L01+ with the external Antenne version. For the standard version it works fine.

But as I use the external Antenne version you have to use a power source with enough amperage. My solution is to use the 5V output from the Nano and connect it to a power regulator (I used this one: http://www.aliexpress.com/item/3-3V-5V- ... 28385.html) and from the power regulator to the radio. And it works!
sebas
Posts: 117
Joined: Tuesday 17 September 2013 7:46
Target OS: Linux
Domoticz version:
Location: Deventer, The Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by sebas »

Do I need to modify the ethernet gateway code that's on MySensors.org for it to be able to work with Domoticz? I've created a ethernet gateway using an Arduino Mega2560 with an Ethernetshield and incoming messages aren't coming through correctly. I've attached some sensors and a relay. They show up correctly in Domoticz but when I click the switch to switch the relay nothing happens with the relay.

I've added some Serial.println() in the Arduino code to see what's being received by the Arduino and that doens't seem to be correct. This is what's written to the serial monitor:

Code: Select all

00;0;3;0;14;Gateway startup complete.
Incoming message
§Ñ©
Actually there is more in that message but the forum doesn't accept that. Those missing characters are blank squares.
It looks like the character encoding is off somehow. Also the part of the code that is outputting that message is the part that throws away the input because it's too long.

Full gateway code:

Code: Select all

#include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
#include <SPI.h>  
#include <MySensor.h>
#include <MyGateway.h>  
#include <stdarg.h>

// Use this if you have attached a Ethernet ENC28J60 shields  
//#include <UIPEthernet.h>  

// Use this fo WizNET W5100 module and Arduino Ethernet Shield 
#include <Ethernet.h>   


#define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
#define INCLUSION_MODE_PIN  3 // Digital pin used for inclusion mode button

#define RADIO_CE_PIN        5  // radio chip enable
#define RADIO_SPI_SS_PIN    6  // radio SPI serial select
#define RADIO_ERROR_LED_PIN 7  // Error led pin
#define RADIO_RX_LED_PIN    8  // Receive led pin
#define RADIO_TX_LED_PIN    9  // the PCB, on board LED

#define IP_PORT 5003        // The port you want to open 
IPAddress myIp (192, 168, 1, 7);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!

// The MAC address can be anything you want but should be unique on your network.
// Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
// Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x4A, 0x3E };  // DEAD BEEF FEED

// a R/W server on the port
EthernetServer server = EthernetServer(IP_PORT);

// No blink or button functionality. Use the vanilla constructor.
MyGateway gw(RADIO_CE_PIN, RADIO_SPI_SS_PIN, INCLUSION_MODE_TIME);

// Uncomment this constructor if you have leds and include button attached to your gateway 
//MyGateway gw(RADIO_CE_PIN, RADIO_SPI_SS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);

char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
int inputPos = 0;

String incoming;

void setup()  
{ 
  Ethernet.begin(mac, myIp);

  // give the Ethernet interface a second to initialize
  delay(1000);

  // Initialize gateway at maximum PA level, channel 70 and callback for write operations 
  gw.begin(RF24_PA_LEVEL_GW, RF24_CHANNEL, RF24_DATARATE, writeEthernet);

  // start listening for clients
  server.begin();
}

// This will be called when data should be written to ethernet 
void writeEthernet(char *writeBuffer) {
  server.write(writeBuffer);
}


void loop()
{
  // if an incoming client connects, there will be
  // bytes available to read via the client object
  EthernetClient client = server.available();

  if (client) {
    Serial.println("Incoming message");
    
      // if got 1 or more bytes
      if (client.available()) {
         // read the bytes incoming from the client
         char inChar = client.read();
         incoming = "Incoming char: " + inChar;
         Serial.println(incoming);
         if (inputPos<MAX_RECEIVE_LENGTH-1) { 
           // if newline then command is complete
           if (inChar == '\n') {  
             Serial.println("End if command");
              // a command was issued by the client
              // we will now try to send it to the actuator
              inputString[inputPos] = 0;

              // echo the string to the serial port
              Serial.print(inputString);

              gw.parseAndSend(inputString);

              // clear the string:
              inputPos = 0;
           } else {  
             // add it to the inputString:
             inputString[inputPos] = inChar;
             inputPos++;
           }
        } else {
           // Incoming message too long. Throw away 
           Serial.print(inputString);
           inputPos = 0;
        }
      }
   }  
   gw.processRadioMessage();    
}
Thomasdc
Posts: 133
Joined: Wednesday 11 March 2015 19:13
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: MySensors - Gateway to Domoticz

Post by Thomasdc »

rachmat wrote:Issue: Dimmable Led also not showing off at devices list, it show on log only this

Code: Select all

2015-02-08 21:06:38 MySensors: Node: 33, Sketch Name: DimmableLED
2015-02-08 21:06:38 MySensors: Node: 33, Sketch Version: 1.1
2015-02-08 21:06:52 MySensors: Node: 33, Sketch Name: DimmableLED
2015-02-08 21:06:52 MySensors: Node: 33, Sketch Version: 1.1
2015-02-08 21:07:00 Hardware Monitor: Fetching data (System sensors)
2015-02-08 21:07:30 Hardware Monitor: Fetching data (System sensors)

i have the same problem, it shows in the log, bot not in my devices,
Did you (or anyone) found a solution for this?
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

you have to present your sensors, like with s_dimmer or with s_light
Quality outlives Quantity!
joshimosh
Posts: 58
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by joshimosh »

Good morning,
on the webpage of MySensors http://www.mysensors.org/ there is an announcement that MySensors Version 1.5 has been released (on 30 July 2015). Has any brave soul already tested the compatibilty with the gateway to Domoticz ? A number of new features have been introduced, in particular new types of sensors, new variables and OTA updates (which is of particular interest if you have - like me - a number of fairly remote nodes).

My guess is that the new sensor types and new variables cannot (yet) be used, since they have to be integrated in the gateway as well.
Perhaps the developer can comment on this ?

Thank you and all the best
Josh

Addition: I should have read the announcement at MySensors more carefully :oops:
It says there that
This version should be backward compatible with 1.4 both over-the-air and sketch-vise unless you use the constructor arguments which has changed to cope with a more flexible architecture.
But anyway ...
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: MySensors - Gateway to Domoticz

Post by ThinkPad »

For the OTA you need a custom bootloader i read somewhere.
I am not active on this forum anymore.
joshimosh
Posts: 58
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by joshimosh »

Yes, I know. AFAIK there is a dual boot loader included in the new package, that will allow both standard and OTA loading.

Josh
Justintime
Posts: 228
Joined: Thursday 21 May 2015 9:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: MySensors - Gateway to Domoticz

Post by Justintime »

Is the IR sensor supported by Domoticz?

If so, are the IR commands visable in the Log?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest