I read on the comments for the Openhab Controller page (http://www.mysensors.org/build/openhab) that Tim is working on a serial gateway connection to Openhab. Is anyone else working on something like this?
CARSTEN
@CARSTEN
Best posts made by CARSTEN
-
Serial Gateway connection to Openhab
Latest posts made by CARSTEN
-
Problem sending message via IDE to Relay Node
Hi
I am using the MYS API 1.5 with Arduino 1.77.
I have the Relay example runing on one node (node id 6) and the Serial Gateway on the other.
Looking at the Serial Gateway node serial monitor everything looks good:0;0;3;0;9;gateway started, id=0, parent=0, distance=0
0;0;3;0;14;Gateway startup complete.
0;0;3;0;9;read: 6-6-0 s=255,c=0,t=17,pt=0,l=3,sg=0:1.5
6;255;0;0;17;1.5
0;0;3;0;9;read: 6-6-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
6;255;3;0;6;0
0;0;3;0;9;read: 6-6-0 s=255,c=3,t=11,pt=0,l=5,sg=0:Relay
6;255;3;0;11;Relay
0;0;3;0;9;read: 6-6-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
6;255;3;0;12;1.0
0;0;3;0;9;read: 6-6-0 s=1,c=0,t=3,pt=0,l=0,sg=0:
6;1;0;0;3;
0;0;3;0;9;read: 6-6-0 s=2,c=0,t=3,pt=0,l=0,sg=0:
6;2;0;0;3;
0;0;3;0;9;read: 6-6-0 s=3,c=0,t=3,pt=0,l=0,sg=0:
6;3;0;0;3;I then try to send a message via the serial monitor of the Arduino IDE from the Serial Gateway to the the Relay Node to activate a relay. I type '6;1;1;0;2;1;' and click on the SEND button.
Following output in the log but no relay activated:
0;0;3;0;9;send: 0-0-6-6 s=1,c=1,t=2,pt=0,l=1,sg=0,st=ok:1
0;0;3;0;9;read: 6-6-0 s=255,c=0,t=17,pt=0,l=3,sg=0:1.5
6;255;0;0;17;1.5
0;0;3;0;9;read: 6-6-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
6;255;3;0;6;0
0;0;3;0;9;read: 6-6-0 s=255,c=3,t=11,pt=0,l=5,sg=0:Relay
6;255;3;0;11;Relay
0;0;3;0;9;read: 6-6-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
6;255;3;0;12;1.0
0;0;3;0;9;read: 6-6-0 s=1,c=0,t=3,pt=0,l=0,sg=0:
6;1;0;0;3;
0;0;3;0;9;read: 6-6-0 s=2,c=0,t=3,pt=0,l=0,sg=0:
6;2;0;0;3;
0;0;3;0;9;read: 6-6-0 s=3,c=0,t=3,pt=0,l=0,sg=0:
6;3;0;0;3;Can anyone help what I am doing wrong?
-
RFM69 with Binary Switch example requires additional code
Hi
I finally managed to try out the MySensors v1.5 library. I mainly was looking for the support of the RFM69 radios because of their better range and low power consumption.
The serial gateway worked like a charm out of the box. But then I struggled to get the binary switch example working. I mostly got an error 'Radio Init Fail'.
Looking into the code I also struggled to see where the code says that this should work with an RFM69 radio, like it does in the Serial Gateway code in "MyTransportNRF24 transport(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);"
So I eventually copied a whole bunch of lines from the Serial Gateway example and now it is working perfectly.I may have copied too many lines and perhaps there is a much smarterway of solving this but as a feedback of what I tried and what worked, herewith the code I eventually used in my Binary Switch node:
/**- The MySensors Arduino library handles the wireless radio link and protocol
- between your home built sensors/actuators and HA controller of choice.
- The sensors forms a self healing radio network with optional repeaters. Each
- repeater and gateway builds a routing tables in EEPROM which keeps track of the
- network topology allowing messages to be routed to nodes.
- Created by Henrik Ekblad henrik.ekblad@mysensors.org
- Copyright (C) 2013-2015 Sensnology AB
- Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
- Documentation: http://www.mysensors.org
- Support Forum: http://forum.mysensors.org
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
- DESCRIPTION
- Simple binary switch example
- Connect button or door/window reed switch between
- digitial I/O pin 3 (BUTTON_PIN below) and GND.
- http://www.mysensors.org/build/binary
*/
#include <MySigningNone.h>
#include <MyTransportRFM69.h>
#include <MyHwATMega328.h>
#include <MySigningAtsha204Soft.h>
#include <MySigningAtsha204.h>#include <MySensor.h>
#include <SPI.h>
#include <Bounce2.h>#define CHILD_ID 3
#define BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switchMyTransportRFM69 transport;
// Hardware profile
MyHwATMega328 hw;// Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
// To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
#ifdef WITH_LEDS_BLINKING
MySensor gw(transport, hw /, signer/, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
#else
MySensor gw(transport, hw /, signer/);
#endifBounce debouncer = Bounce();
int oldValue=-1;// Change to V_LIGHT if you use S_LIGHT in presentation below
MyMessage msg(CHILD_ID,V_TRIPPED);void setup()
{
gw.begin(NULL,3);// Setup the button
pinMode(BUTTON_PIN,INPUT);
// Activate internal pull-up
digitalWrite(BUTTON_PIN,HIGH);// After setting up the button, setup debouncer
debouncer.attach(BUTTON_PIN);
debouncer.interval(5);// Register binary input sensor to gw (they will be created as child devices)
// You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage.
// If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
gw.present(CHILD_ID, S_DOOR);
}// Check if digital input has changed and send in new value
void loop()
{
debouncer.update();
// Get the update value
int value = debouncer.read();if (value != oldValue) {
// Send in the new value
gw.send(msg.set(value==HIGH ? 1 : 0));
oldValue = value;
}
}I hope this helps somebody and perhaps somebody wants to advise on how to do this much better.
Anyhow, Big Thank You to the guys (@KOLAF,@YVEAUX, @HEK and a bunch of others) who made the effort to extend the library to RFM69. Much appreciated. -
RE: MQTT Broker gateway
@Damme I tried today the mysensor 1.4.1 library, uploaded with Arduino 1.5.8 to UNO with Ethernet Shield (W5100) and an NRF24L01+pa+lna. Compilation and upload worked fine.
I can ping the IP address defined in the MQTTGateway.ino sketch.
I maintained on my RPI the openhab.cfg file with the url and port number from the gateway.
When starting the openhab it shows:
... - MQTT Service initialization completed.
... - Starting MQTT broker connection 'mysensor'.Then a couple of message later:
...Mqtt Exception
Caused by: java.net.SocketTimeoutException: connect timed outAny suggestion what I could look at.
I also tried to work with the development library of Mysensors but did not get very far with that. My ultimate goal is to something like a moteino with the RFM69HW radio module in connection with either openhab or pidome.
I have a quite a bit of hardware lying around here so I am happy to do any testing if somebody gives me some guidance.
Thanks. -
RE: Porting MySensors to work with the RadioHead library
I used the Mysensors 1.4.1 library and managed to get a UNO with Ethernet shield and NRF24L01+PA+LNA working as an MQTT gateway.
I then changed the library to the latest development library (downloaded on 01.12.2014) and uploaded the MQTT gateway setch to the same hardware -> Also worked fine.
I then changed MyConfig.h to use the RF69 radio instead of NRF24 and just tried to compile. I got a lot of errors:
MQTT_Gateway_Compile_errors.txtI am using Arduino IDE 1.5.8
I am happy to help with testing, but I am afraid my programming skills are not good enough to assist with that.
-
RE: Serial Gateway connection to Openhab
@TimO Thanks a lot. I will definitely have a look at this. However I realized that I still have to go through quite a bit of a learning curve first. So I decided to first get the MQTT gateway woring and connecting to openhab.
I will definitely come back to your solution later as it would give me a more minimalistic hardware approach.
Thanks again. -
Serial Gateway connection to Openhab
I read on the comments for the Openhab Controller page (http://www.mysensors.org/build/openhab) that Tim is working on a serial gateway connection to Openhab. Is anyone else working on something like this?
-
RE: Porting MySensors to work with the RadioHead library
@bbbio24 Hi
I am running into the same " ISO C++ forbids initialization of member 'radio'" error. Did you manage to solve this issue? am using IDE version 1.0.6. What version should I use?Update: I managed to get past this error.
By the way I am woring with the latest develpment branch that I downloaded from here https://github.com/mysensors/Arduino/archive/development.zip.
To get past this problem I changed in MyDriverRF69.h the lne 40 to
RFM69 *radio;// = NULL;
This resolved the problem in the arduino IDE 1.0.6. Admittedly I am very new to this whole thing and am not sure what I potentially broe by changing the line bt at least I can explore further.