ragoth
Junior Member
Posts: 64
|
Post by ragoth on Feb 19, 2016 14:51:08 GMT
Hi Lewishollow, Thank you for your guidance and now I got clear of my doubt. Thanks for your time, with best regards.
|
|
|
Post by papa on Feb 19, 2016 16:14:55 GMT
ragoth, I'm glad things seem better. This project has a lot to take in. As I well know from past experience (& even recent experience ), it's easy to get confused, frustrated, & trying everything & anything to get something to work. Reflecting about your posts on different threads, it seems like you were mixing things from my stuff & lewishollow's stuff. Not yet understanding what things worked together, you probably left out some needed things & mixed in some things that either did not help or even interfered. When you gave enough details on this forum of what you were trying & the results, that's when you probably got the most help. Keep at it & your understanding & confidence will grow. This project requires a lot from us, but it's so exciting when things start working.
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Feb 20, 2016 3:46:38 GMT
Dear Papa, I appreciate the amount of man hours you spent for publishing pages and pages of technical write ups covering even the small basic things that a newbie may need to proceed. I am sorry for my multiple postings, and it is just because of my over enthusiasm. With great regards for your interest and involvement. -ragoth.
|
|
|
Post by beckis on Feb 22, 2016 8:34:26 GMT
Hi guys, first of all many thanks to all of you. I am trying to build Home Automation System based on your posts, source codes, sketches...but I am not able to force my nodes to communicte with each other ;( still no connection, no connection, no connection...I have ordered new RFM69HW's in order to eliminate the possibility that I am using RFM's which are not working well. I was curuious, if you have ever tried to omit RFM/Ethernet gateway and use only RPi2+RFM69 and RFM69 node(Arduino+sensors). I have found something like this (https://github.com/abouillot/HomeAutomation), but I haven't tried it yet, because I am still trying to fix communication issue between RFM gateway and RFM node
|
|
|
Post by computourist on Feb 22, 2016 12:00:00 GMT
|
|
|
Post by papa on Feb 22, 2016 14:03:52 GMT
beckis, welcome to the DIY Home Automation party. From what I've seen on this forum & learned from personal experience, the computourist-derived schematics & sketches have the best rate of success: Using a Pi (or other computer) to host OpenHAB/MQTT, but using Arduino compatibles for Gateway & end nodes. I & others have tried in various places to help newcomers troubleshoot what is not working. If you have not already, I encourage you to read through some of those threads & maybe you'll pick up something that will turn the key for you. I posted a lot of details in my Success... thread including troubleshooting starting around Oct 8, 2015 at 2:59pm. This page of the Success... thread gives details on building a Gateway & a DHT End Node, a small, but functional network. In this Newbie... thread, we worked through a lot of troubleshooting. Then on this forum, you can post details of what you've tried & the results you get & that may give us more clues to make suggestions. You can start a new thread or tag on to a thread whose title seems close to what you are experiencing. Details like: What Arduino compatible & voltage are you using? Have you double checked your builds with the schematics? Have you used a multimeter's continuity setting to make sure assembly connects the right things & does not connect the wrong things Do you have a computourist Gateway built, programmed & connected to MQTT service on a computer (like Linux / Pi or Windows)? Sounds like you used the debug mode in the sketches to monitor nodes using the Arduino IDE Serial Monitor. What are ALL the messages you see first from the Gateway & then from the End node? Hang in there & (maybe with help), you'll get there. Best wishes from someone who was once frustrated & is now thrilled.
|
|
|
Post by beckis on Feb 24, 2016 20:36:59 GMT
Hi papa, computorist... I have read many times all forums I have found from both of you with hope that I will find what I did wrong but like everybody I do mistakes, for example I misunderstood that part with switchable Arduino Uno and I have used 5V version for my project (Arduino Mini Pro and Arduino Uno with 3.3V and 5V options are already ordered and I am waiting for them) and spent 4 days troubleshooting what's wrong, then I have read, that it is not enough to connect VCC on RFM to 3.3V because the logic is still 5V my fault, maybe I broke my RFM69HWs (I ordered new ones as well)... I use Raspberry Pi 2 B with OpenHab, Mosquitto installed, Arduino Uno clone (5V) with Ethernet Shield as Gateway, Arduino Uno clone with protoshield as Sensor Node both with Logic Level Converters connected, then DHT11, PIR sensor, button, other sensors...and of course RFM69HWs I see that RFM/Ethernet Gateway communicates with Mosquitto broker on my RPi2...I see that Sensor Node can read values from sensors...but they don't communicate with each other... THIS IS OUTPUT FROM GATEWAY: Gateway Software Version GW V2.3 Listening at 868 Mhz... Failed to configure Ethernet using DHCP connecting... connection failed... got connection with MQTT server Topic received from Mosquitto: home/rfm_gw/sb/node02/dev04 READ Value is: 0 No connection with node 2 Topic received from Mosquitto: home/rfm_gw/sb/node02/dev02 READ Value is: 0 No connection with node 2 Topic received from Mosquitto: home/rfm_gw/sb/node02/dev04 READ Value is: 0 No connection with node 2 .... THIS IS OUTPUT FROM SENSOR NODE: Node Software Version AIO V2.2 Transmitting at 868 Mhz... No connection... 99, 0, 0, 0.00, RSSI= 0 Node: 2 No connection... 48, 0, 0, 19.00, RSSI= 0 Node: 2 No connection... 49, 0, 0, 45.00, RSSI= 0 Node: 2 Do you have any idea what might be wrong? Is it possible that RFM69HW is out of order because it was connected to 5V before? Or what else could prevent them to communicate?
|
|
|
Post by computourist on Feb 24, 2016 21:05:07 GMT
Hello beckis , Your gateway is connected to mosquitto and receiving read requests. South Bound (sb) means from openhab to node. Your output states there is no connection with the end node. Your end node arduino is functioning; it tries to connect and send values. Temperature is 19 degrees and humidity is 45%.... The most likely conclusion is that your RFM modules did not survive 5 Volts. The datasheet states a maximum supply voltage of 3.9 volts....
|
|
|
Post by beckis on Feb 24, 2016 21:41:30 GMT
Hi guys, I changed FREQUENCY to RF69_433MHZ and I see some incoming messages on RFM Gateway but I always get "invalid message structure", while troubleshooting I found out that radio.DATALEN = 63 & sizeof(mes) = 46...so they are not the same that is why I get "invalid message structure"...and Gateway doesn't receive/read correct values which Node is telling that is sending...
RFM Gateway:
-------------------------
radio.DATALEN 63
sizeof(mes) 46
radio.SENDERID 255 mes.devID -1 mes.cmd -1 mes.intVal -1 mes.fltVal nan RSSI= -128
Node: -1 Version: invalid message structure..
MQTT message: : 0
Sensor Node: --------------------------------------- No connection...
48, 0, 0, 19.00, RSSI= 0
Node: 2
No connection...
64, 0, 0, 46.00, RSSI= 0
Node: 2
Do you have any idea what is wrong?
|
|
|
Post by blasted on Feb 26, 2016 11:12:43 GMT
Hello beckis,
i had the same problem. Problem disappeared when i connected both grounds from RFM to Arduino uno.
|
|
|
Post by blasted on Feb 26, 2016 11:35:46 GMT
I have the following setup: Raspberry pi 2 with OpenHAB and Mosquitto installed as OpenHAB_Server Arduino UNO with W5100 Ethernet shield and RFM69 radio transceiver as RFM_Gateway with Computorist Gateway v2.4 code Arduino UNO with RFM69 radio transceiver and DHT22 temperature/humidity sensor as RFM_Node with Lewishollows code
RFM_Gateway connects with Mosquitto. RFM_Node sends Temperature and Humidity values on regular intervals and OpenHAB registers them. So nb communication works ok.
When sb message is sent I get the following results:
1. From OpenHAB_server when the following message is sent mosquitto_pub -m READ -t home/rfm_gw/sb/node01/dev03 I get following results:
Client mosqsub/14095-rp1 received PUBLISH (d0, q0, r0, m0, 'home/rfm_gw/sb/node01/dev03', ... (4 bytes)) READ Client mosqsub/14095-rp1 received PUBLISH (d0, q0, r0, m0, 'home/rfm_gw/nb/node01/dev03', ... (7 bytes)) GW V2.4
so duplex communication works between mosquito broker and RFM_Gateway
2. When following message is sent from OpenHAB_server mosquitto_pub -m READ -t home/rfm_gw/sb/node11/dev03 I get following results: from mosquitto_sub -t "#" -d Client mosqsub/14095-rp1 received PUBLISH (d0, q0, r0, m0, 'home/rfm_gw/sb/node11/dev03', ... (4 bytes)) READ and log from syslog Feb 26 12:31:18 rp1 mosquitto[2088]: Received PUBLISH from mosqpub/15454-rp1 (d0, q0, r0, m0, 'home/rfm_gw/sb/node11/dev03', ... (4 bytes)) Feb 26 12:31:18 rp1 mosquitto[2088]: Sending PUBLISH to mosqsub/14095-rp1 (d0, q0, r0, m0, 'home/rfm_gw/sb/node11/dev03', ... (4 bytes)) Feb 26 12:31:18 rp1 mosquitto[2088]: Sending PUBLISH to RFM_gateway (d0, q0, r0, m0, 'home/rfm_gw/sb/node11/dev03', ... (4 bytes))
When RFM_Gateway is connected to serial monitor I can see that RFM_Gateway sends that message on node11, but I get no response from node11. When RFM_Node, node11, is connected to serial monitor i get nothing from debug.
I already spent days on this. Can You guys please help?
best regards
|
|
|
Post by beckis on Feb 27, 2016 18:12:10 GMT
Hi blasted, I tried to connect both GND on RFM to GND on Arduino, but it didn't help. I still get the same...
|
|
|
Post by papa on Feb 27, 2016 18:41:06 GMT
beckis, one more troubleshooting possibility for you: Did you see the need to make a couple small changes in the library file, w5100.h? Doing that can help prevent communication problems.
Apparently RFM69s are sensitive to how interrupts are handled.
|
|
|
Post by beckis on Feb 27, 2016 22:40:01 GMT
papa, yes I did this change DATALEN 63 MES 46 255, -1, -1, -1, nan, RSSI= -128 Node: -1 Version: ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ invalid message structure.. MQTT message: : DATALEN 63 MES 46 255, -1, -1, -1, nan, RSSI= -128 Node: -1 Version: ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ invalid message structure.. MQTT message: : DATALEN 63 MES 46 255, -1, -1, -1, nan, RSSI= -128 Node: -1 Version: ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ invalid message structure.. MQTT message: : DATALEN 63 MES 46 255, -1, -1, -1, nan, RSSI= 0 Node: -1 Version: ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ invalid message structure.. MQTT message: :
|
|
|
Post by papa on Feb 28, 2016 0:38:40 GMT
Seems like your RFM69s are functioning somewhat, but also seems a strong possibility they are damaged & not completely functioning. May be time to try some new RFM69s.
You could also double check how you wired the RFM69s, not only that they are connected correctly to the Arduino but also that there are no extra solder that connected the wrong things.
|
|
|
Post by blasted on Feb 29, 2016 14:12:04 GMT
Sensor Node: ---------------------------------------No connection... 48, 0, 0, 19.00, RSSI= 0 Node: 2 No connection... 64, 0, 0, 46.00, RSSI= 0 Node: 2 beckis, can u plase try with hardcoding ss pin in rfm69.h change this line in rfm69.h and set both NSS pins from Gateway and Node to D8 pin on arduino UNO. It should work. #define RF69_SPI_CS 8 // SS is the SPI slave select pin, for instance D10 on ATmega328This is how i solved my problem for now
|
|
|
Post by papa on Feb 29, 2016 20:46:21 GMT
blasted, interesting proposal about changing SS in rfm69.h. Should not change much for the Gateway because it already needs & depends upon D8 for NSS since the w5100 Ethernet Shield needs D10. Line 75 #define RFM_SS 8. Line 141, radio.setCS(RFM_SS);
However, I would think sketches like DHT End Node & DIG would need some change because they expect to check the push button on D8. I also wonder if the end node sketches would need something like the Gateway's lines 75 & 141
|
|
|
Post by blasted on Mar 1, 2016 7:49:36 GMT
papas, rfm69.h was changed before i buried my arduino with 24V power supply so i haven't tested modification with redefinition of SS (CS) pin "#define RFM_SS 2". Both gateway and node functioned perfectly wit hardcoded NSS pin. Push button pin can be easily changed. The problem is that my RFM69 libraries have no RFM_SS variable, there is only RF69_SPI_CS. Probably have a newer library, so i still haven't had time to test it with changes in gateway and node code, guess it should be #define RF69_SPI_CS 8 for the gateway and #define RF69_SPI_CS 10 for the node. beckis, can you please try to send message from openhab/mosquitto server mosquito_pub -m READ -t home/rfm_gw/nodeXX/dev02 and mosquito_pub -m READ -t home/rfm_gw/node01/dev03tail -f /var/log/syslog and see output from serial console - this way you are certain the message is in valid format and you can trace errors
|
|
|
Post by blasted on Mar 1, 2016 7:59:23 GMT
This forum was a great help, learned a lot along the way. Both Computorist and Lewishollows code are great. Best one could find after extensive searches on the internet. so far i got working duplex gateway from Computorist v2.4 a bit modified to enable ATC and disable those LEDs, some of debug messages were wrapped in F() to free up some memory RFM_Gateway_computorist_v2.4_Working_29022016.ino (16.89 KB) and Lewishollow node code also modified to enable ATC, minor changes to work with active low relay, and minor changes to libraries just #include "" -> #include <> RFM_node_dannyoleson_Working_29022016.ino (23.56 KB) I'm posting modified code if anyone is interested to try code was compiled on Arduino IDE 1.6.7. Ethernet library was modified to include w5100.h, and w5100.h was modified as suggested in Gateway code. rfm69.h was modified to hardcode NSS, slave select pin to pin D8 on arduino UNO. both gateway and node are arduino uno boards, ethernet shield on gateway is w5100 ver. 5 and radio is RFM69 433MHz.
|
|
|
Post by blasted on Mar 1, 2016 11:24:53 GMT
Hi Lewishollow,
can u please help me? when i set relay on Node to ON, Gateway doesn't get nb message on relay state (ON/OFF). How can one fix that?
ty
br
|
|
|
Post by papa on Mar 1, 2016 12:34:09 GMT
I'm not lewishollow, but maybe I can help if I understand what you're asking.
Do you mean that when you push the PHYSICAL push button on the end node, the Gateway AND the virtual switch on the User Interface (UI) do NOT get that data?
If the above is what you mean, the following might help (may need some adapting into lewishollow's stuff)
For each end node's device 16, I use two items. For example ...
Switch Act_Node02 {mqtt=">[mosquitto:home/rfm_gw/sb/node02/dev16:command:ON:ON],>[mosquitto:home/rfm_gw/sb/node02/dev16:command:OFF:OFF]"}
Switch Node02_Output { mqtt="<[mosquitto:home/rfm_gw/nb/node02/dev16:state:default]" }
The first item above plus this sitemap entry Switch item=Act_Node02 label="Node_02_Output" enables user interface toggling of the device 16 LED or relay
The second item above reads the node's device 16 state. When the PHYSICAL push button on the node is pushed, the second item plus the rule below make sure the OpenHAB User Interface gets that update via the Gateway
rule "Match UI & Act_Node02" // Rule records local state cause by button push when Item Node02_Output changed then if(Node02_Output.state==ON) { postUpdate(Act_Node02, ON) } if(Node02_Output.state==OFF) { postUpdate(Act_Node02, OFF) } end
Note: There is some delay between pushing the physical button & the change showing on the user interface. As the sketch is now, it must wait until the node next sends data, as controlled by the TXinterval variable. For example, if TXinterval = 60 [seconds] & you push the button 20 seconds after the last data send, it will be about 40 seconds until the next data send changes the user interface. Unless you're close to BOTH the UI & the node, you probably won't notice the delay.
|
|
|
Post by papa on Mar 1, 2016 12:46:01 GMT
PS, blasted, I just remembered I discovered a shorter way to accomplish what I put in the last post:
Seeing a post elsewhere I wondered, "Could I bind a switch to TWO mqtt bindings?" Turns out I could AND shorten my config files:
With this, we need only ONE item with two bindings (adding second item's binding to the first item): Switch Act_Node02 {mqtt=">[mosquitto:home/rfm_gw/sb/node02/dev16:command:ON:ON],>[mosquitto:home/rfm_gw/sb/node02/dev16:command:OFF:OFF]", mqtt="<[mosquitto:home/rfm_gw/nb/node02/dev16:state:default]"}
NO rule is needed for this approach.
Same sitemap entry: Switch item=Act_Node02 label="Node02_Output"
This makes OpenHAB configs shorter. However, the delay mentioned in the previous post will be the same for the same reasons unless the sketch code is changed to send that data immediately. Again, in real world usage, one probably won't notice the delay.
|
|
|
Post by blasted on Mar 1, 2016 13:16:04 GMT
Ty papa.
In this design physical PUSH button is not used. Just want to control relay on/off on digital output. Relay can be switched on/off via mqtt messages something like
mosquitto_pub -m ON -t home/rfm_gw/node11/dev18 - sets relay to off
since relay board is active low i had to inverse the logic.
part of item file
/* String to acquire the output state */ String getStateRelay27 "get StateRelay27" {mqtt=">[localbroker:home/rfm_gw/sb/node11/dev18:command:*:default]", activelow=yes}
/* RFM RELAYS connected */ Switch RELAY27 "Pumpa" {mqtt=">[localbroker:home/rfm_gw/sb/node11/dev18:command:ON:OFF],>[localbroker:home/rfm_gw/sb/node11/dev18:command:OFF:ON]", activelow=yes}
/* Contacts to read the output state */ Contact StateRelay27 "Status [%s]" "StateRelay27" {mqtt="<[localbroker:home/rfm_gw/nb/node11/dev18:state:OPEN:ON],<[localbroker:home/rfm_gw/nb/node11/dev18:state:CLOSED:OFF]"}
part of sitemap file
Frame label="Controls" { Switch item=RELAY27 label="Node 11" icon="switch" Text item=StateRelay27 label="status node11" icon="switch" } and finally part of rules file
rule "Update RELAY27" // update state RELAY27 after local node switch toggle when Item StateRelay27 received update then if (StateRelay27.state==OPEN) { postUpdate(RELAY27, OFF)} if (StateRelay27.state==CLOSED) { postUpdate(RELAY27, ON)} logInfo("StateRelay27 changed: ", StateRelay27.state.toString()) Problem is Node doesn't send any nb messages after it sets state to digital output.
P.S. Im definitely gonna try Your suggestion and use only one item line for state and switch!!! Ill post an update when its tested! Once more ty for Your help.
BR
|
|
|
Post by blasted on Mar 2, 2016 13:23:43 GMT
Hi Lewishollow,
think there is a bug in your code, when node is queried for software version it transmits wrong values wakeUp->getShouldSend()
made a fix for this. so ill post it here just in chunks (changes are marked in comments ending in - blasted). Correct me if I'm wrong. This was the best i could.
...
void setup() { // DO NOT MODIFY THE BELOW CODE UNTIL INDICATED // // instantiate node system devices uptimeData = new NodeSystemDataClass(UPTIMEDEVICEID, NULL, &getUptime); txIntervalData = new NodeSystemDataClass(TXINTERVALDEVICEID, NULL, &getTxInterval); rssiData = new NodeSystemDataClass(RSSIDEVICEID, NULL, &getSignalStrength); versionData = new NodeSystemDataClass(VERSIONDEVICEID, NULL, &getVersion); // replace NULL value with new function getVersion - blasted voltageData = new NodeSystemDataClass(VOLTAGEDEVICEID, NULL, &getVoltage); ackData = new NodeSystemDataClass(ACKDEVICEID, NULL, &getAck);
...
void sendMsg() { mes.nodeID = NODEID; mes.intVal = 0; mes.fltVal = 0; mes.cmd = 0; // '0' means no action needed in gateway
/* comment out this part of code - blasted int i; for (i = 0; i < sizeof(VERSION); i++) { mes.payLoad[i] = VERSION[i]; } mes.payLoad[i] = '\0'; // software version in payload string */
...
//at the end of RemoteNode.ino code add this function - blasted
float getVersion() { int i; for (i = 0; i < sizeof(VERSION); i++) { mes.payLoad[i] = VERSION[i]; } mes.payLoad[i] = '\0'; // software version in payload string return mes.payLoad[i]; }
|
|
|
Post by lewishollow on Mar 3, 2016 18:17:15 GMT
Thank you for pointing this out! I'll fix this in my next update.
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Mar 5, 2016 3:52:51 GMT
Hi lewisollow, I am learning to add a dimmer function to your RfmNode.ino sketch using deviceId 16 and the D6 PWM pin. When I move the slider in GUI, I get 0 to 100 dev16 command value in log but the Led at D6 stays in off state. Please check my changes from DigitalOutputDataClass to AnalogOutputDataClass for Device16. Correct if I am wrong.
//Edited part of your RfmNode.ino Sketch
// Binary output settings #ifdef DIMENABLED #define DIM1PIN 6 // Actuator pin (LED or relay) #define DIMDEVICEID 16 AnalogOutputDataClass *actuatorData; #endif //DIMENABLED
#ifdef DIMENABLED actuatorData = new AnalogOutputDataClass(DIMDEVICEID, DIM1PIN); #endif //DIMENABLED
//ITEM code used Dimmer itm_node2_dim_mqtt "Light Dimmer [%d %%]" {mqtt=">[mosquitto:home/rfm_gw/sb/node02/dev16:command:*:default]"}
// RULES code used var Boolean itm_node2_dim_mqtt_updated = false var Boolean itm_node2_dim_mqtt_update_lock = false rule "Slowly Dim Light" when // s m h Time cron "0 * 1,2,3 * * ?" // each min betw 9-11PM EST then if (itm_node2_dim_mqtt_update_lock == false) { itm_node2_dim_mqtt_update_lock = true logInfo("dimming", "waiting for polled state") // push a change after 2 consecutive updates for (i: 1..2) { itm_node2_dim_mqtt_updated = false while (itm_node2_dim_mqtt_updated == false) { logInfo("dimming", "waiting for poll " + i) Thread::sleep(1000) } } var Number brightness = 0 var Number new_brightness = 0 if (itm_node2_dim_mqtt.state instanceof DecimalType) { brightness = itm_node2_dim_mqtt.state as DecimalType } new_brightness = brightness – 1 if (new_brightness >= 0) { logInfo("dimming", "to " + new_brightness) sendCommand(itm_node2_dim_mqtt, new_brightness) postUpdate(itm_node2_dim_mqtt, new_brightness) } itm_node2_dim_mqtt_update_lock = false } // lock in place; don't dim end
|
|
|
Post by blasted on Mar 8, 2016 10:14:55 GMT
Hi all,
for successful relay implementation, in Lewishollows RfmNode, few changes in code are needed
// at device definition ...
#ifdef ACT2ENABLED #define ACT2PIN 7 // Actuator pin (LED or relay) #define ACT2DEVICEID 17 DigitalOutputDataClass *actuator2Data; #endif
#ifdef RELAY1ENABLED #define RELAY1PIN 5 // Relay output pin - change according to your design - blasted #define RELAY1DEVICEID 18 DigitalOutputDataClass *relay1Data; #endif //RELAY1ENABLED
...
// in setup function ...
#ifdef ACT2ENABLED actuator2Data = new DigitalOutputDataClass(ACT2DEVICEID, ACT2PIN); #endif
#ifdef RELAY1ENABLED pinMode(RELAY1PIN, OUTPUT); // set Relay 1 - blasted RELAY1STATE=1; // relay is active low so set state to 1 - blasted relay1Data = new DigitalOutputDataClass(RELAY1DEVICEID, RELAY1PIN); relay1Data->setState(RELAY1STATE); // start with Relay 1 off - blasted relay1Data->setShouldSend(true); // send relay1 status afrer reboot - blasted relay1Data->periodicSendEnabled = true; // refresh relay1 status periodicaly, def. 20sec - blasted #endif //RELAY1NENABLED
...
// and finally in parseCmd function ...
} digitalOutput->setState(mes.intVal); digitalOutput->setShouldSend(setAck); // acknowledge message ? txRadio(); // after cmd setState send status update nb message to all - blasted } } } } } if (!deviceFound) { unknownDevice->setShouldSend(true); } } // end parseCmd
....
changes in device definition and setup function define relay device, as i have relays that are active low so this is a place to change their state. periodicSend is there to update relay status every 20 secs. setSouldSend is set to send relay status after reboot - openHAB remembers last updated state, if arduino reboots it should send status update! and finaly in parseCmd function you should add txRadio(); after setting new state to notify all nodes and openHAB of this change - needed if few people operate.
sitemap
Frame label="Controls" { Switch item=itm_Node11_Relay01 label="Ventil" icon="switch" } items
/* String to acquire the output state */ String getStateNode11Relay01 "get StateNode11Relay01" {mqtt=">[localbroker:home/rfm_gw/sb/node11/dev18:command:*:default]"}
/* RFM RELAYS connected */ Switch itm_Node11_Relay01 {mqtt=">[localbroker:home/rfm_gw/sb/node11/dev18:command:ON:OFF],>[localbroker:home/rfm_gw/sb/node11/dev18:command:OFF:ON]"}
/* Contacts to read the output state */ Contact StateNode11Relay01 {mqtt="<[localbroker:home/rfm_gw/nb/node11/dev18:state:CLOSED:OFF],<[localbroker:home/rfm_gw/nb/node11/dev18:state:OPEN:ON]"}
rules
// // update whenever a relay state is toggled //
rule "Update itm_Node11_Relay01" // update state to Relay01 on Node11 after received update when Item StateNode11Relay01 received update then if (StateNode11Relay01.state==CLOSED) { postUpdate(itm_Node11_Relay01, ON)} if (StateNode11Relay01.state==OPEN) { postUpdate(itm_Node11_Relay01, OFF)} logInfo("StateNode11Relay01 changed: ", StateNode11Relay01.state.toString()) end
this much from me so far...
best of luck to ya all
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Mar 9, 2016 1:10:49 GMT
Hi blasted,
I appreciate your work on altering the RfmNode code for a better usage.
I am trying to include a dimmer function in Lewishollow's RfmNode by changing the digitalWrite function of a PWM port to analogWrite function, but no success. I requested Mr. lewishollow in this thread to help me on this, but he seems to be busy in his routines.
So I request you to add a LED dimmer option in his RfmNode making it a Versatile Node. I posted the code I tried, herein above.
Thanks and Best regards.
|
|
|
Post by beckis on Mar 10, 2016 15:11:15 GMT
Hi guys, I would like to make sure that you are using RfmGateway.ino and RfmNode.ino files downloaded from github.com/dannyoleson/RFM69-MQTT-client, am I right? If not, please advise from where should I download correct source codes. Thank you.
|
|
|
Post by lewishollow on Mar 14, 2016 4:38:37 GMT
Hi ragoth , blasted , beckis - Ragoth - I apologize for the delay. I will look at your problem asap. Possibly once my flight takes off and the wifi is turned on... Blasted - I just looked at your code that was meant to fix my get version bug. You're not returning the version - you're returning the int val for a null char converted to a float. I'm going to try to figure out a solution that returns the version. Beckis - the gateway in computpurist's git - the one I forked - is being updated. You can get the latest version there. It should be compatible with my RfmNode.
|
|