|
Post by computourist on Feb 6, 2015 14:59:24 GMT
I just put up Release 2 of the MQTT gateway/node on github.com/computourist/RFM69-MQTT-clientChanges: - increased payload size to 32 bytes - changed integer in payload to long integer - defined standard devices and device numbers; these are implemented in the gateway, so no more need for gateway changes when adding standard devices/nodes. - implemented uptime counter in node & gateway - implemented version reporting in gateway - removed leading spaces in decimal sensor value - check for empty MQTT-message; this evaluated to 0 in earlier version - error checking & reporting - Computourist
|
|
|
Post by camblonie on Feb 9, 2015 0:21:59 GMT
Computourist this is great work! I haven't had a lot of time to play with it but I've got the basic sketches running on a couple nodes and reporting through OpenHAB. Next step is to add light sensors and PIR. Thanks for your hard work!
|
|
|
Post by camblonie on Feb 10, 2015 23:33:47 GMT
Any ideas on why signal strength isn't working with the latest release for me?
|
|
|
Post by computourist on Feb 11, 2015 10:17:18 GMT
Here it's working without problems. Are you sure you are addressing the right node/device ? - Computourist Any ideas on why signal strength isn't working with the latest release for me?
|
|
|
Post by camblonie on Feb 12, 2015 2:00:41 GMT
For signal I'm using: Number itm_new_signal "3 Signal [%.1f dB]" (ALL, Signal) {mqtt="<[mymosquitto:home/rfm_gw/nb/node03/dev02:state:default]"} Thats straight forward on Node 3 and it registers a values of 0.0 so there's more going on than just a blank "-".
My light sensor is reading the same as my voltage 3.3 Number itm_new3_light_mqtt "Light Sensor [%.1f]" (ALL) {mqtt="<[mymosquitto:home/rfm_gw/nb/node03/dev41:state:default]"}
|
|
|
Post by demondreamer on Feb 12, 2015 7:35:45 GMT
The new release looks superb computourist! With the gateway devices standardised it's become very simple to add new devices.
I can confirm that the rssi is working. The node sketch not set by default to report the rssi on a timed interval though. You'll have to send a read request to the node for it, or add the device into the timed-send part of the sketch.
-demondreamer
|
|
|
Post by computourist on Feb 12, 2015 14:50:05 GMT
RSSI is an Integer number. You're trying to read it as a float. Try %d iso %.1f , that might do the trick.... - Computourist For signal I'm using: Number itm_new_signal "3 Signal [%.1f dB]" (ALL, Signal) {mqtt="<[mymosquitto:home/rfm_gw/nb/node03/dev02:state:default]"} Thats straight forward on Node 3 and it registers a values of 0.0 so there's more going on than just a blank "-". My light sensor is reading the same as my voltage 3.3 Number itm_new3_light_mqtt "Light Sensor [%.1f]" (ALL) {mqtt="<[mymosquitto:home/rfm_gw/nb/node03/dev41:state:default]"}
|
|
|
Post by demondreamer on Feb 12, 2015 15:55:58 GMT
Here's the relevant lines from my OpenHAB configuration. Replace "node17" with your node number. .items file: Number shop_rssi_mqtt "RSSI [%.1f db]" {mqtt="<[mymosquitto:home/rfm_gw/nb/node17/dev02:state:default]"} .sitemap file: Text item=shop_rssi_mqtt icon="network" This matches yours so that's probably not the issue. You're not going to get any data though unless you enable the periodic transmission in the node sketch by uncommenting // send2 = true; // signal strength or send the node a read request like Topic: home/rfm_gw/sb/node17/dev02 Payload: READ OpenHAB can publish MQTT messages as well as receive them so it's possible to have it send the RSSI READ request on demand. I don't have much experience with this as yet so I don't have many working examples to post. The one I do have toggles the actuator state of dev16 in response to a ON/OFF switch on my sitemap. .items file: Switch shop_switch_01 "Switch 1" {mqtt=">[mymosquitto:home/rfm_gw/sb/node17/dev16:command:ON:ON],>[mymosquitto:home/rfm_gw/sb/node17/dev16:command:OFF:OFF]"} .sitemap file Switch item=shop_switch_01 Notice the > that tells OpenHAB to publish as opposed to < which means subscribe. Commands sent to the node are southbound "sb" so make sure you observe that in your publish topic. Whatever is after the last colon : is the payload. In the above example, it's :ON and :OFF. In sending a request for the RSSI, you would use :READ Here's the link to the OpenHAB MQTT binding wiki page for more details. github.com/openhab/openhab/wiki/MQTT-BindingAnd here's a link to a method of making a "pushbutton" type switch in OpenHAB. (I've not tried it yet) code.google.com/p/openhab-samples/wiki/ItemDef#How_to_configure_a_switch_to_be_a_pushbutton:As for the light sensor reading the same as voltage, That sounds to me like a sketch programming error or a wiring error. Your OpenHAB item looks fine. I don't think it's possible to diagnose further without more information like your sketch code and what type of sensor you're using. Adafruit's got a pretty good writeup of using bare CDS photocells here: learn.adafruit.com/photocells/using-a-photocell-Demondreamer
|
|
|
Post by computourist on Feb 12, 2015 20:32:05 GMT
Found out what's probably going on.
The RSSI value is not 'broadcasted' by the node on a regular basis, so Openhab initially has no value to show, hence the "-" for the value. By sending a READ command to "home/rfm_gw/sb/node03/dev02" using another MQTT-client (MQTT.FX), the value gets sent and displayed in Openhab. I guess there should be a way for Openhab to request this value from time to time....
- Computourist
|
|
|
Post by camblonie on Feb 13, 2015 22:11:25 GMT
Well I fixed the light sensor but I'm not sure what the issue was. Failed on the southbound READ thing although I tried every combination I could find. The RSSI is a nice to have, did you guys get a PIR working? I can get IR to work in a separate sketch and report thru the serial monitor but the result is something other than 1 or 0 in the MQTT bus.
|
|
|
Post by computourist on Feb 14, 2015 17:06:48 GMT
To update the RSSI value in Openhab on a regular interval: - define an openhab item: (in xxx.items) String getRSSI "get rssi" {mqtt=">[mosquitto:home/rfm_gw/sb/node03/dev02:command:*:default]"}- make a rule, FE an automatic query every 5 minutes: (in xxx.rules) rule "refresh RSSI" when Time cron "0 0/5 * * * ?" then sendCommand(getRSSI, "READ") end- Computourist Found out what's probably going on. The RSSI value is not 'broadcasted' by the node on a regular basis, so Openhab initially has no value to show, hence the "-" for the value. By sending a READ command to "home/rfm_gw/sb/node03/dev02" using another MQTT-client (MQTT.FX), the value gets sent and displayed in Openhab. I guess there should be a way for Openhab to request this value from time to time.... - Computourist
|
|
|
Post by camblonie on Feb 15, 2015 16:39:24 GMT
Didn't seem to work. The UI shows a value of 0 rather than "-" and I see the value being reported as 0 over MQTT. Do you guys have it working? Arduino code looks the same as when it was working with version 1.
|
|
|
Post by Admin on Feb 15, 2015 18:22:51 GMT
I just put up Release 2 of the MQTT gateway/node on github.com/computourist/RFM69-MQTT-clientChanges: - increased payload size to 32 bytes - changed integer in payload to long integer - defined standard devices and device numbers; these are implemented in the gateway, so no more need for gateway changes when adding standard devices/nodes. - implemented uptime counter in node & gateway - implemented version reporting in gateway - removed leading spaces in decimal sensor value - check for empty MQTT-message; this evaluated to 0 in earlier version - error checking & reporting - Computourist I'll sticky this one and unsticky the previous post - that sound good?
|
|
|
Post by demondreamer on Feb 15, 2015 18:45:32 GMT
Didn't seem to work. The UI shows a value of 0 rather than "-" and I see the value being reported as 0 over MQTT. Do you guys have it working? Arduino code looks the same as when it was working with version 1. If you mean the RSSI, yes it's working for me, both in periodic sketch-driven send and when I poll the node for it manually. -Demondreamer
|
|
|
Post by traver on Feb 18, 2015 6:24:02 GMT
Hello,
This is great Work!
I'd still like to build several sensors.
PIR, for example, how can I build this?
Thank You and Best Regards, Traver
|
|
|
Post by computourist on Feb 18, 2015 8:29:05 GMT
Hi Traver, most PIR-sensors have a relay- or digital output, that can be hooked up to an input of the Arduino. It can be treated as a switch/button for input, as shown in the DHT-node sketch. On each activation of the PIR-sensor a message will be sent over MQTT. - Computourist Hello, This is great Work! I'd still like to build several sensors. PIR, for example, how can I build this? Thank You and Best Regards, Traver
|
|
|
Post by traver on Feb 18, 2015 10:11:01 GMT
Thank you for the fast answer!
I'll test it once if I can do it
Best Regards, Traver
|
|
|
Post by Tobias on Feb 19, 2015 9:17:50 GMT
Hello, I have tested it, but I still have a problem. After a few seconds I get from the Broker MQTT the message that the MQTT GW is disconnected timout.
What can I do?
Thank You
|
|
|
Post by computourist on Feb 19, 2015 13:42:40 GMT
Instability in the MQTT-link is often caused by problems with interrupts generated by the RFM module. Have you changed W5100.h before compiling the gateway code ? Changes are listed in: harizanov.com/2012/04/rfm12b-and-arduino-ethernet-with-wiznet5100-chip/- Computourist Hello, I have tested it, but I still have a problem. After a few seconds I get from the Broker MQTT the message that the MQTT GW is disconnected timout. What can I do? Thank You
|
|
|
Post by Tobias on Feb 19, 2015 14:18:01 GMT
No..
I need to replace these lines?
private: #if defined(ARDUINO_ARCH_AVR) #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) inline static void initSS() { DDRB |= _BV(4); }; inline static void setSS() { PORTB &= ~_BV(4); }; inline static void resetSS() { PORTB |= _BV(4); }; #elif defined(__AVR_ATmega32U4__) inline static void initSS() { DDRB |= _BV(6); }; inline static void setSS() { PORTB &= ~_BV(6); }; inline static void resetSS() { PORTB |= _BV(6); }; #elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__) inline static void initSS() { DDRB |= _BV(0); }; inline static void setSS() { PORTB &= ~_BV(0); }; inline static void resetSS() { PORTB |= _BV(0); }; #else inline static void initSS() { DDRB |= _BV(2); }; inline static void setSS() { PORTB &= ~_BV(2); }; inline static void resetSS() { PORTB |= _BV(2); }; #endif
to thes lines:
private: #if defined(ARDUINO_ARCH_AVR) #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) inline static void initSS() { DDRB |= _BV(4); }; inline static void setSS() { PORTB &= ~_BV(4); }; inline static void resetSS() { PORTB |= _BV(4); }; #elif defined(__AVR_ATmega32U4__) inline static void initSS() { DDRB |= _BV(6); }; inline static void setSS() { PORTB &= ~_BV(6); }; inline static void resetSS() { PORTB |= _BV(6); }; #elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__) inline static void initSS() { DDRB |= _BV(0); }; inline static void setSS() { PORTB &= ~_BV(0); }; inline static void resetSS() { PORTB |= _BV(0); }; #else inline static void initSS() { DDRB |= _BV(2); }; inline static void setSS() { cli(); PORTB &= ~_BV(2); }; inline static void resetSS() { PORTB |= _BV(2); sei(); }; #endif
is it right?
Thank You
|
|
|
Post by computourist on Feb 19, 2015 16:45:50 GMT
Yes, replace: #else inline static void initSS() { DDRB |= _BV(2); }; inline static void setSS() { PORTB &= ~_BV(2); }; inline static void resetSS() { PORTB |= _BV(2); }; #endif with: #else inline static void initSS() { DDRB |= _BV(2); }; inline static void setSS() { cli(); PORTB &= ~_BV(2); }; inline static void resetSS() { PORTB |= _BV(2); sei(); }; #endif - Computourist No.. I need to replace these lines? private: #if defined(ARDUINO_ARCH_AVR) #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) inline static void initSS() { DDRB |= _BV(4); }; inline static void setSS() { PORTB &= ~_BV(4); }; inline static void resetSS() { PORTB |= _BV(4); }; #elif defined(__AVR_ATmega32U4__) inline static void initSS() { DDRB |= _BV(6); }; inline static void setSS() { PORTB &= ~_BV(6); }; inline static void resetSS() { PORTB |= _BV(6); }; #elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__) inline static void initSS() { DDRB |= _BV(0); }; inline static void setSS() { PORTB &= ~_BV(0); }; inline static void resetSS() { PORTB |= _BV(0); }; #else inline static void initSS() { DDRB |= _BV(2); }; inline static void setSS() { PORTB &= ~_BV(2); }; inline static void resetSS() { PORTB |= _BV(2); }; #endif to thes lines: private: #if defined(ARDUINO_ARCH_AVR) #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) inline static void initSS() { DDRB |= _BV(4); }; inline static void setSS() { PORTB &= ~_BV(4); }; inline static void resetSS() { PORTB |= _BV(4); }; #elif defined(__AVR_ATmega32U4__) inline static void initSS() { DDRB |= _BV(6); }; inline static void setSS() { PORTB &= ~_BV(6); }; inline static void resetSS() { PORTB |= _BV(6); }; #elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__) inline static void initSS() { DDRB |= _BV(0); }; inline static void setSS() { PORTB &= ~_BV(0); }; inline static void resetSS() { PORTB |= _BV(0); }; #else inline static void initSS() { DDRB |= _BV(2); }; inline static void setSS() { cli(); PORTB &= ~_BV(2); }; inline static void resetSS() { PORTB |= _BV(2); sei(); }; #endif is it right? Thank You
|
|
|
Post by Tobias on Feb 19, 2015 19:22:51 GMT
Perfekt it Works!
But the next Problem is.
This Message i get.
2, 48, 0, 0, nan, RSSI= -30 Node: 2 Version: DHT V2.0 MQTT message: home/rfm_gw/nb/node02/dev48: NAN 2, 49, 0, 0, 0.00, RSSI= -30 Node: 2 Version: DHT V2.0 MQTT message: home/rfm_gw/nb/node02/dev49: 0.00
The Sensor in the test Skatch is Working!
- Tobias
|
|
|
Post by Tobias on Feb 20, 2015 6:43:14 GMT
I have found the failure!
- Tobias
|
|
|
Post by traver on Feb 23, 2015 6:48:52 GMT
Can i use this with batteries or must i implemented any sleeps and longer intervals?
Best Regards Traver
|
|
|
Post by computourist on Feb 23, 2015 20:32:46 GMT
Can i use this with batteries or must i implemented any sleeps and longer intervals? Best Regards Traver No special energy-saving features have been implemented in the end-nodes. I look forward to example code of energy-saving versions - Computourist
|
|
|
Post by gandalph on Jun 12, 2015 13:35:05 GMT
I have incorporated code for a PIR and DS18 temp sensors, and integrated sleep mode. Sleep mode is based on the watchdog timer functionality. I still need to do real life tests with my node to see what the energy consumption is, but for your entertainment hereby attached! This code is fully integrated with the 2.1 computourist node code btw... happy coding! edit: make sure to supply enough voltage otherwise the PIR becomes erratic...
|
|
|
Post by papa on Jun 18, 2015 5:11:04 GMT
GW 22 includes ethernet.h In my current Arduino IDE 1.6.4 (& todays arduino-nightly-windows.zip), the ethernet.h comments out inclusion of w5100.h //#include "w5100.h" (I assume there's a reason for disabling the inclusion of w5100.h, but my search did not discover why) So anyway, will the recommended changes in w5100.h actually be included in GW 22 sketch Or in ethernet.h do we need to change //#include "w5100.h" to #include "w5100.h" ?? Thanks for your attention to this
|
|
|
Post by rhyssman on Jun 20, 2015 23:57:43 GMT
GW 22 includes ethernet.h In my current Arduino IDE 1.6.4 (& todays arduino-nightly-windows.zip), the ethernet.h comments out inclusion of w5100.h //#include "w5100.h" (I assume there's a reason for disabling the inclusion of w5100.h, but my search did not discover why) So anyway, will the recommended changes in w5100.h actually be included in GW 22 sketch Or in ethernet.h do we need to change //#include "w5100.h" to #include "w5100.h" ?? Thanks for your attention to this Papa I was having issues with stability on my Gateway (RFM69HW+Arduino+W5100) using GW version 22. My end nodes would loose connection to the gateway after a few updates. I had not made the change to the W5100 library and from your post I checked my ethernet.h and W5100 was not included. I made the changes and uploaded them. Instant improvement. I would recommend including the W5100 library and modifying it as per the above posts. One thing to note also. The standard library I had installed W5100.h was filed in the utility folder. I modified my include line to read #include "utility/w5100.h" from #include "w5100.h" Rhyssman
|
|
|
Post by papa on Jun 22, 2015 4:03:01 GMT
Yes, Ryssman,
Thanks for responding to my post.
Not hearing a for a while, I made the instructed changes in w5100.h even though it is commented out in ethernet.h
Like you I found that my radio connection was much improved.
my w5100 file is in "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility
However I did not change Ethernet.h accordingly & it all worked fine.
|
|
|
Post by Nawab arzoo on Aug 30, 2015 23:27:19 GMT
Hey, I was just inspired from user home automation but as time changed many things has also being changed in the project. Can anyone tell me where I will get those updates as I want to build almost complete home automation as my project including lights switching with dimming.. Controlling sockets and with security also. So please help me with this project what I should do and what I should not..
Thanks in advance..
|
|