|
Post by computourist on Oct 25, 2015 19:42:55 GMT
This end node is the most simple end node possible. It has a single remote controllable digital output (relay) and a button. The button toggles the output. State changes are notified with a MQTT message. This node is basically the DTH-node with unnecessary code removed. I also fixed a bug in the retransmission part of the radio link. To have an idea on the quality of the transmission path I implemented system device 9, that exposes the number of retransmissions on the radio link. Minor changes in the gateway code were needed to facilitate this addition, so device 9 is only available when using gateway release 2.3. I will release new versions of other end nodes to incorporate this fix. New code is at: github.com/computourist/RFM69-MQTT-client
|
|
|
Post by papa on Oct 26, 2015 21:28:27 GMT
Thanks, CompuTourist for ALL your contributions.
|
|
|
Post by camblonie on Nov 10, 2015 3:22:36 GMT
Computourist, I'm only seeing state changes to OPEN. There is no notification for closed. Can you take a look? Thanks Scott
|
|
|
Post by computourist on Nov 10, 2015 7:20:30 GMT
Hi camblonie, Code seems OK. It is working in my setup. // DETECT INPUT CHANGE
//
curState = digitalRead(BTN); // Read button
msgBlock = ((millis() - lastBtnPress) < HOLDOFF); // hold-off time for additional button messages
if (!msgBlock && (curState != lastState)) { // input changed ?
delay(5);
lastBtnPress = millis(); // take timestamp
// send40 = true; // set button message flag
if (curState == LOW) {
if (toggleOnButton) { // button in toggle state ?
ACT1State = !ACT1State; // toggle output
digitalWrite(ACT1, ACT1State);
send16 = true; // send message on status change
} else
if (TIMinterval > 0 && !timerOnButton) { // button in timer state ?
timerOnButton = true; // start timer interval
ACT1State = HIGH; // switch on ACT1
digitalWrite(ACT1, ACT1State);
}}
lastState = curState;
} As you can see in line 178, a message for device 16 is sent on every output toggle, irrespective of output state. Maybe something wrong in your Openhab item configuration ?
|
|
|
Post by camblonie on Nov 11, 2015 14:10:32 GMT
You troubleshoot my system better than I can. Thanks.
|
|