RelayWithButtonActuator (from Development branch) doesn't change the relay



  • Hello

    I am playing with RelayWithButtonActuator from Development branch.
    I have no radio connected to my arduino so meanwhile I use gateway mode via usb connection - that's why I took the code from the development branch

    https://github.com/mysensors/Arduino/tree/1.4.2

    I added/commented out the following definitions to disable radio and that way works for the example for relay without buttons:
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    // Enable and select radio type attached
    // #define MY_RADIO_NRF24 // Disable to switch into USB GW without radio

    When I control it from my controller (Domoticz) then the relay (which is modelled by LED pin 13) is reflecting any changes.

    When I push the button (by connecting two wires from GND and D3) then the update message is sent to the controller (slow reaction but it works and the light switch icon is changed) however the relay itself is still unchanged (LED ignores the button)!

    I am looking thru the code and see that there is no relay action in void loop() but such the activities are coded in void receive(const MyMessage &message)

    Is it normal to have relay specific code out of the loop?
    I guess that's the reason in my case because when I push the button then then only one way feedback is sent to the controller and no action message is sent back to the gateway, which could be received and processed to turn the relay on/off

    http://pastebin.com/Q42G9WwE


  • Admin

    You probably have a connectivity problem between your node and gateway. Have a look in the node/gateway log (with debug enabled).



  • I have no separate node and gateway - I am trying to reuse the gateway as the node.
    As I understand the concept, any gateway may also serve as a node.
    So I am trying to achieve the behaviour when the gateway (RelayWithButtonActuator modified with #define MY_GATEWAY_SERIAL) receives commands from the controller and physical push button, and switch the light on/off

    It works well when I control it from the controller (Domoticz) and the LED (pin 13) confirms the reaction perfectly. And when I press on the push button (D4 + GND) then the signal goes to the controller, however with no consequences!

    May I ask you please to explain a bit the idea behind the sketch logic RelayWithButtonActuator.ino?
    When I press the button then actually no signal is sent to the relay pin (LED pin in my case), right?
    How the node (coexisting with the gateway in my case) should receive the message back from the controller in order to turn the relay pin on/off? Is the logic relies on ACK mechanism, when we sent the push button message with the confirmation request (ACK) and expect to receive it back to change the relay pin?


  • Admin

    @Alex-B-Goode said:

    How the node (coexisting with the gateway in my case) should receive the message back from the controller in order to turn the relay pin on/off? Is the logic relies on ACK mechanism, when we sent the push button message with the confirmation request (ACK) and expect to receive it back to change the relay pin?

    Yes, correct. The gpio/pin won't switch state until the controller ack is received.

    So it seems something might be wrong using this mechanism on the gateway itself. Might be a bug.

    But you should be able to switch the pin directly on the gateway as no radio communication is involved.



  • Right, I can of course switch the relay pin directly in the loop() just after the push button was pressed.
    There will be no magic, meanwhile I am looking for a graceful scenario when everything works perfectly

    Well, now I understand that the node based on RelayWithButtonActuator.ino will only change the state after pressing the button when the ACK is received back from the controller...

    I this case I think I found a bug because I checked in MYSController and saw messages sent from my node/gateway like that 0;1;1;0;2;1

    It sends always value 1 because never receives ACK feedbacks from the controller, which should cause toggling the value.
    And It never receives ACK feedbacks from the controller because it actually doesn't request ACK - we can see fourth zero meaning no ACK required! And it should be different because ACK request is hardcoded in the RelayWithButtonActuator.ino :

    send(msg.set(state?false:true), true); // Send new state and request ack back


  • Admin

    Ok, I'll add this to known problems until fixed.



  • Thanks

    Maybe you also advice how to trick Master branch (not Development branch) on the same way to disable radio and achieve coexisting of the serial gateway and node on the same arduino connected to a controller via usb?

    Examples at the Development branch have explicit definitions for using radio, which I can comment out

    //#define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69

    Meanwhile the master branch examples have no such definitions and assume the radio is always present, so I cannot disable it and it cause radio init errors for my case


Log in to reply
 

Suggested Topics

  • 3
  • 5
  • 6
  • 2
  • 8

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts