Relays and Scene Controller on same Node v1.4



  • I all

    I have just moved over to version 1.4beta and is trying to make a multisensor.
    I would like to have a Node that is a Relay Sensor for 5 relays and I Scene Controller for 6 buttons

    Here is my code, but it don't Work, can any one se what is wrong:
    Scene_Controller_6_buttons_and_5_Relays.ino


  • Hero Member

    @Dalhoj

    Maybe a detailed explanation as to what's not working??


  • Admin

    More precisely, What is not working? What does the serial monitor say?

    Are you powering the relays for an external power source (not via Arduino)?

    Darn.. you beat me to it @ServiceXp .



  • @hek

    True, then I try to include the node, only some of the sensors is discovered. then I can try a second time and some more sensors are included, but I there is stile 2 relays missing.

    The setup is to 5v relays who is shareing power supply with the arduino (5V) and tre leds for showing status. The leds are directly on the arduino pins with a recistor.

    The Scene controller part looks like its working, but in the serial monitor there is some errors:

    send: 2-2-0-0 s=3,c=1,t=20,pt=2,l=2,st=ok:0
    send: 2-2-0-0 s=3,c=1,t=19,pt=2,l=2,st=fail:0
    send: 2-2-0-0 s=3,c=1,t=20,pt=2,l=2,st=ok:0
    send: 2-2-0-0 s=3,c=1,t=19,pt=2,l=2,st=fail:0
    send: 2-2-0-0 s=3,c=1,t=20,pt=2,l=2,st=fail:0
    send: 2-2-0-0 s=3,c=1,t=19,pt=2,l=2,st=ok:0

    The Relays there is showed up in Vera are working oppersit so off in vera is ON in arduino.


  • Hero Member

    @Dalhoj
    Can't help with the first part. Are the relays low or high activated? If low, then I think you can fix that by changing
    #define RELAY_ON 1 // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay

    TO

    	#define RELAY_ON 0  // GPIO value to write to turn on attached relay
    	#define RELAY_OFF 1 // GPIO value to write to turn off attached relay


  • I changed the relay_on to 0 and relay_off to 1, strange for in version 1.3 it should be the other way around, with the same hardware setup.

    I finialy managed to get all relays in Vera, just by trying to include the many times.

    I cant get the toggle function in advanced scenes to work on the arduino relay. It works fine on fibaro relays.
    is it a bug or?


  • Hero Member

    @Dalhoj

    1. Are the relay's in sync now with Vera?
    2. I'm not sure I understand the question, but it sounds like it may be a scene controller specific thing, which I have no experience with.


  • I can now see that the relays not allways are in sync on the vera. Some times when I press the ON button in the Vera GUI the still displays as OFF but the relay is on. Sometimes it changes to ON in the GUI after 5-10 sec. sometimes it never changes.

    About the Toggle I mean when you create a new scene in Vera, there is the "Advanced" tab where I add the arduino relay sensor and choose "ToggleState" from the dropdown menu. I cant get it to work,



  • @Dalhoj j

    Looking at your code from post #1 I think you have a sensor id conflict.

    The relays are presented in the loop in line 37:

    gw.present(sensor, S_LIGHT);
    

    where sensor is looping over 1 to 5

    But in line 62 the Scene Controller is presented with sensor id 3 (CHILD_ID defined in line 14 to 3)

    gw.present(CHILD_ID, S_SCENE_CONTROLLER); 
    

    So sensor id 3 is redefined. Will that work?

    Or do I misread your code?



  • Hi again

    I think so to, here is the new code.

    Scene_Controller_6_buttons_and_5_Relays.ino

    I reduced the relays to 3, and all the devices is in vera, but the relay status update is stile slow / not happing

    The scene controller has now child id = 0 and the relays 1-3.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.