• header.categories
    • header.recent
    • header.tags
    • header.popular
    • register
    • login

    Relay Node

    scheduled pinned locked moved General Discussion
    15 posts 3 posters 9.8k views 1 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • F offline
      fwessels
      global:last-edited-by,

      @jkandasa I start to play with MyController today looks good what I am seeing so far. However i have a problem with the my relay node. I am running Mysensor beta version 2 on all my nodes. Mycontroller pick the relay up but is I look at the node info it say there is no sensors why will this be the case?

      Thanks

      Francois

      one-reply-to-this-post last-reply-time reply quote 0
      • jkandasaJ offline
        jkandasa
        global:last-edited-by,

        i believe we might have issue to display sensors count in node details page. let me have a look. thank you

        one-reply-to-this-post last-reply-time reply quote 0
        • F offline
          fwessels
          global:last-edited-by,

          @jkandasa do this version support relays and dimmer sensors? As I also don't get my dimmer sensor to work.

          jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
          • jkandasaJ offline
            jkandasa @fwessels
            global:last-edited-by,

            @fwessels yes this version should support dimmer and relay.

            one-reply-to-this-post last-reply-time reply quote 0
            • F offline
              fwessels
              global:last-edited-by,

              @jkandasa Are you using the standard sensors sketch or did you changes anything in the sketch as my relays and dimmers sensors are not working

              jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
              • jkandasaJ offline
                jkandasa @fwessels
                global:last-edited-by,

                @fwessels with standard sketch only. mycontroller will send set type message

                one-reply-to-this-post last-reply-time reply quote 0
                • F offline
                  fwessels
                  global:last-edited-by, fwessels

                  @jkandasa If I look at the Variables mapper I don't see anything for lights (relay) what Sensor type do you use for the relay?

                  Regards

                  Francois

                  one-reply-to-this-post last-reply-time reply quote 0
                  • jkandasaJ offline
                    jkandasa
                    global:last-edited-by,

                    sensor type S_BINARY and variable type V_STATUS

                    one-reply-to-this-post last-reply-time reply quote 0
                    • F offline
                      fwessels
                      global:last-edited-by,

                      @jkandasa I try everything and just cannot get the relay node working what can the issue be?

                      one-reply-to-this-post last-reply-time reply quote 0
                      • jkandasaJ offline
                        jkandasa
                        global:last-edited-by,

                        @fwessels can you share your node code?

                        one-reply-to-this-post last-reply-time reply quote 0
                        • F offline
                          fwessels
                          global:last-edited-by, fwessels

                          Hi @jkandasa here is my code

                          /**
                           * The MySensors Arduino library handles the wireless radio link and protocol
                           * between your home built sensors/actuators and HA controller of choice.
                           * The sensors forms a self healing radio network with optional repeaters. Each
                           * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                           * network topology allowing messages to be routed to nodes.
                           *
                           * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                           * Copyright (C) 2013-2015 Sensnology AB
                           * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                           *
                           * Documentation: http://www.mysensors.org
                           * Support Forum: http://forum.mysensors.org
                           *
                           * This program is free software; you can redistribute it and/or
                           * modify it under the terms of the GNU General Public License
                           * version 2 as published by the Free Software Foundation.
                           *
                           *******************************
                           *
                           * REVISION HISTORY
                           * Version 1.0 - Henrik Ekblad
                           * 
                           * DESCRIPTION
                           * Example sketch for a "light switch" where you can control light or something 
                           * else from both HA controller and a local physical button 
                           * (connected between digital pin 3 and GND).
                           * This node also works as a repeader for other nodes
                           * http://www.mysensors.org/build/relay
                           */ 
                          
                          // Enable debug prints to serial monitor
                          #define MY_DEBUG 
                          #define MY_NODE_ID 15
                          
                          // Enable and select radio type attached
                          //#define MY_RADIO_NRF24
                          #define MY_RADIO_RFM69
                          
                          // Enabled repeater feature for this node
                          //#define MY_REPEATER_FEATURE
                          
                          #include <SPI.h>
                          #include <MySensor.h>
                          #include <Bounce2.h>
                          
                          #define RELAY_PIN  4  // Arduino Digital I/O pin number for relay 
                          #define BUTTON_PIN  3  // Arduino Digital I/O pin number for button 
                          #define CHILD_ID 1   // Id of the sensor child
                          #define RELAY_ON 1
                          #define RELAY_OFF 0
                          
                          Bounce debouncer = Bounce(); 
                          int oldValue=0;
                          bool state;
                          
                          MyMessage msg(CHILD_ID,V_STATUS);
                          
                          void setup()  
                          {  
                            // Setup the button
                            pinMode(BUTTON_PIN,INPUT);
                            // Activate internal pull-up
                            digitalWrite(BUTTON_PIN,HIGH);
                            
                            // After setting up the button, setup debouncer
                            debouncer.attach(BUTTON_PIN);
                            debouncer.interval(5);
                          
                            // Make sure relays are off when starting up
                            digitalWrite(RELAY_PIN, RELAY_OFF);
                            // Then set relay pins in output mode
                            pinMode(RELAY_PIN, OUTPUT);   
                                
                            // Set relay to last known state (using eeprom storage) 
                           // state = loadState(CHILD_ID);
                           // digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
                          }
                          
                          void presentation()  {
                            // Send the sketch version information to the gateway and Controller
                            sendSketchInfo("Main Bedroom Relay & Button B2", "2.0");
                          
                            // Register all sensors to gw (they will be created as child devices)
                            present(CHILD_ID, S_BINARY);
                          }
                          
                          /*
                          *  Example on how to asynchronously check for new messages from gw
                          */
                          void loop() 
                          {
                            debouncer.update();
                            // Get the update value
                            int value = debouncer.read();
                            if (value != oldValue && value==0) {
                                send(msg.set(state?false:true), true); // Send new state and request ack back
                            }
                            oldValue = value;
                          } 
                           
                          void receive(const MyMessage &message) {
                            // We only expect one type of message from controller. But we better check anyway.
                            if (message.isAck()) {
                               Serial.println("This is an ack from gateway");
                            }
                          
                            if (message.type == V_STATUS) {
                               // Change relay state
                               state = message.getBool();
                               digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
                               // Store state in eeprom
                               //saveState(CHILD_ID, state);
                              
                               // Write some debug info
                               Serial.print("Incoming change for sensor:");
                               Serial.print(message.sensor);
                               Serial.print(", New status: ");
                               Serial.println(message.getBool());
                             } 
                          }
                          
                          
                          jkandasaJ G topic:replies-to-this-post, 2 last-reply-time reply quote 0
                          • jkandasaJ offline
                            jkandasa @fwessels
                            global:last-edited-by,

                            @fwessels I tested with MY_RADIO_NRF24 as I do not have MY_RADIO_RFM69. Everything works perfectly for me. Kindly check your radio and hardware circuits.

                            if you want to update sensors name by default write like this present(CHILD_ID, S_BINARY, "Relay Sensor");

                            one-reply-to-this-post last-reply-time reply quote 0
                            • G offline
                              greengo @fwessels
                              global:last-edited-by, greengo

                              anyone else noticed that it does not work here?

                              void receive(const MyMessage &message) {
                              // We only expect one type of message from controller. But we better check anyway.
                              if (message.isAck()) {
                              Serial.println("This is an ack from gateway");
                              }

                              server does not respond to a command (message.isAck())

                              it turns out that there is no certainty that my relays included.
                              MYCONTROLLER.ORG button in the interface does not show the correct status of the node.

                              jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
                              • jkandasaJ offline
                                jkandasa @greengo
                                global:last-edited-by,

                                @greengo

                                message.isAck() is all about mysensors framework. If it is ack message returns true otherwise false

                                G one-reply-to-this-post last-reply-time reply quote 0
                                • G offline
                                  greengo @jkandasa
                                  global:last-edited-by,

                                  @jkandasa
                                  in fact of the matter is that the server does not return the values, although the sensor sends.
                                  before, I used EasyIoT server http://iot-playground.com/download
                                  and there it works.

                                  one-reply-to-this-post last-reply-time reply quote 0
                                  • first-post
                                    last-post

                                  0

                                  online

                                  644

                                  users

                                  532

                                  topics

                                  3.4k

                                  posts
                                  Copyright © 2015-2025 MyController.org | Contributors | Localization