Connect sensors directly to the Gateway (again)
-
@Mihai258, I can't seem to compile your MySensor2_GatewayMQTT_Sensors_Mega.ino
It gives me these errors error : 'send' was not declared in this scope (and the same error for 'present' and 'ServerUpdate') I must be overlooking something obvious ?So my goal is to make build a Mega 2560 based MQTT client gateway WITHOUT radio and WITH local sensors (mostly contact-inputs) & actuators (relays). All this offcourse in development branch libs.
My starting point would be Mihai258's example and then simply remove the MY_RADIO_NRF24 -#define's.
Will this work ?Thanks,
DirkB19@DirkB19 , I just compile again this file and it works fine for me using Arduino IDE 1.6.5 on Linux, MySensors 2.0.0 beta, set Arduino/Genuino Mega or Mega 2560:
Sketch uses 40,046 bytes (15%) of program storage space. Maximum is 253,952 bytes. Global variables use 1,404 bytes (17%) of dynamic memory, leaving 6,788 bytes for local variables. Maximum is 8,192 bytes.I saw this library is continuously changed, while still beta and still the same version number from long tome ago! You may remove some important definition or included libs, or the actual MySensor development version need something different into the code. I may ZIP and send to you my working version of MySensors, but should this be the right approach?
-
@DirkB19 , I just compile again this file and it works fine for me using Arduino IDE 1.6.5 on Linux, MySensors 2.0.0 beta, set Arduino/Genuino Mega or Mega 2560:
Sketch uses 40,046 bytes (15%) of program storage space. Maximum is 253,952 bytes. Global variables use 1,404 bytes (17%) of dynamic memory, leaving 6,788 bytes for local variables. Maximum is 8,192 bytes.I saw this library is continuously changed, while still beta and still the same version number from long tome ago! You may remove some important definition or included libs, or the actual MySensor development version need something different into the code. I may ZIP and send to you my working version of MySensors, but should this be the right approach?
-
@Mihai
I just updated the libs from the development branch. Still the same errors.
I'm on Windows 10 with Arduino 1.6.6
Not sure but if you could send me a ZIP I'll give it a try.
Grtz -
@DirkB19 when you update the libraries, do you delete the entire MySensors folder first? Adding the new version on top of the old doesn't work, the old version must be obliterated first :)
@mfalkvidd
aha ! That trick worked ! Thanks a lot !
I guess 'newbie' is the word for me :)But coming back to my second question about this MQTT Client Gateway without radio and with local sensors and actuators ... will it work ?
If I have the time I will find out by trial-and-error tonight.Bye
-
Ok, so I tried MQTT Client Gateway without radio and with local sensors and actuators and it works !!
The MQTT topic shows the node-id as 0, which makes sense as it is a gateway.
One thing I noticed, is that the Gateway occasionally seems to loose connection with the MQTT broker and then it shows "Attempting to connnect to MQTT broker ..." in the serial log.
I suspect that my heavy void loop() occupies the CPU too much ?
(I'm debouncing 16 contact inputs without the debounce library, without waits, without interrupts)Also sending a relais change status from OpenHab takes a few seconds before it actually gets changed on the Mega.
OpenHab publishes right away (I see it on the MQTT monitor), but then it seems to take time before the
void receive(const MyMessage &message) picks it up and changes the relais.I will do some more testing to see where the problem lies.
Grtz,
DirkB -
Ok, so I tried MQTT Client Gateway without radio and with local sensors and actuators and it works !!
The MQTT topic shows the node-id as 0, which makes sense as it is a gateway.
One thing I noticed, is that the Gateway occasionally seems to loose connection with the MQTT broker and then it shows "Attempting to connnect to MQTT broker ..." in the serial log.
I suspect that my heavy void loop() occupies the CPU too much ?
(I'm debouncing 16 contact inputs without the debounce library, without waits, without interrupts)Also sending a relais change status from OpenHab takes a few seconds before it actually gets changed on the Mega.
OpenHab publishes right away (I see it on the MQTT monitor), but then it seems to take time before the
void receive(const MyMessage &message) picks it up and changes the relais.I will do some more testing to see where the problem lies.
Grtz,
DirkB@DirkB19 It may take some time to follow the debounce procedure for each of the 16 inputs. For me, I have no big problems with delay, the commands act almost instantly. I do not use debounce, since no physical input there, while my node use 4 relays, several sensors, IR receiver (this take some time, but no big delay).
-
hi. now that 2.0 it 's released .I'm upgrading my few sensors. But i was reading about diferences i couldn't find any example of a gateway + node integrated.
my doubt is how to send sensor mensage? send() is used to send message to the air ,but if the node is the same as the gw what command do i use?the same? -
hi. now that 2.0 it 's released .I'm upgrading my few sensors. But i was reading about diferences i couldn't find any example of a gateway + node integrated.
my doubt is how to send sensor mensage? send() is used to send message to the air ,but if the node is the same as the gw what command do i use?the same?@Tmaster said:
hi. now that 2.0 it 's released .I'm upgrading my few sensors. But i was reading about diferences i couldn't find any example of a gateway + node integrated.
my doubt is how to send sensor mensage? send() is used to send message to the air ,but if the node is the same as the gw what command do i use?the same?If you read at the top of this thread, there's a post from @Mihai - there's a very good example there - look at this:
And yes, you still use send() to send messages.
- Jan
-
but how gateway node knows that what i send from "embebbed sensor" is to "process" there and will not send through air? its on code that will stay on id 0(gateway)?
I know it can be an stupid question for who know the mysensors library in "its core" but not for me :PI want assure that my power meter is uploading measures by serial and not by air,and making unnecessary use from nrf24 modules that cam be used for receive messages from the other nodes .