Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Domoticz: Relay node doesn't show up in "devices"

Domoticz: Relay node doesn't show up in "devices"

Scheduled Pinned Locked Moved Troubleshooting
21 Posts 4 Posters 8.8k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gohanG Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #6

    Have you set the number of relays in the beginning of sketch?

    ? 1 Reply Last reply
    0
    • gohanG gohan

      Have you set the number of relays in the beginning of sketch?

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #7

      @gohan Yes: (I actually haven't modified the sample code, which has the number of relays defined allready)

      #define MY_REPEATER_FEATURE
      #include <MySensors.h>
      #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 1 // Total number of attached relays
      #define CHILD_ID 0
      #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

      1 Reply Last reply
      0
      • gohanG Offline
        gohanG Offline
        gohan
        Mod
        wrote on last edited by
        #8

        you need to look in the node log if it is actually sending the presentation and if the gateway is actually receiving the presentation. Use https://www.mysensors.org/build/parser if you don't understand the serial logs.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by A Former User
          #9

          @gohan Thank for taking some time. I did that already, and the output seemed ok, but I'll try again when I get back home. But I guess the presentation is well received, as the node appears properly in the gateway setup page (see screenshot a few posts above).
          Just to specify my setup: RPI running Domoticz, with RFLink GW & devices, some wifi devices (ESP8266 based) & now MySensors V2.1.1 Serial GW & nodes. At the moment I didn't yet tinker with the MySensors sketches: I'm running everything with sample sketches

          1 Reply Last reply
          0
          • gohanG Offline
            gohanG Offline
            gohan
            Mod
            wrote on last edited by
            #10

            so you actually have the child relay in Domoticz, you should be able to see in devices, if not try to go in setup>settings and press the Allow for 5 minutes button and restart the node and see if anything shows up

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by A Former User
              #11

              So I repeated the whole procedure:
              --> Relay sketch: never appears in devices
              --> Relay with button. pairs fine with the GW, appear in GW setup page, but not in devices. UNTIL... button is pressed. (i waited a few minutes to confirm). Afterwards the relay works as expected.
              I'm 100% sure of the behavior, I reproduced the scenario several times.
              So there's my way of getting a relay to show up in devices, even if it's not straightforward.
              So I guess the "simple relay" sketch needs to send something after it is paired with the GW in order to appear in "Devices". Any piece of code I should try?
              Topic half solved?

              mfalkviddM 1 Reply Last reply
              0
              • ? A Former User

                So I repeated the whole procedure:
                --> Relay sketch: never appears in devices
                --> Relay with button. pairs fine with the GW, appear in GW setup page, but not in devices. UNTIL... button is pressed. (i waited a few minutes to confirm). Afterwards the relay works as expected.
                I'm 100% sure of the behavior, I reproduced the scenario several times.
                So there's my way of getting a relay to show up in devices, even if it's not straightforward.
                So I guess the "simple relay" sketch needs to send something after it is paired with the GW in order to appear in "Devices". Any piece of code I should try?
                Topic half solved?

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #12

                @thierryd great work!

                How about trying to change

                present(sensor, S_BINARY);
                

                to

                present(sensor, S_LIGHT);
                

                ? Maybe Domoticz doesn't like BINARY. (You might need to use a new child id if Domoticz remembers the old id)

                If that doesn't help, just use the relay with button example but don't connect the button and add something like this in start of loop (delete the existing loop function):

                boolean first = true;
                void loop() {
                    if(first){
                        first=false;
                        send(msg.set(loadState(sensor)?RELAY_ON:RELAY_OFF), true);
                    }
                }
                
                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #13

                  Hello, Tried presenting as S_Light, doesn't work, but the piece of code in the loop() work great!
                  Nice workaround!
                  Thank you very much!

                  1 Reply Last reply
                  1
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by A Former User
                    #14

                    Ok I did try something else: in void presentation i replaced S_BINARY by pin (of course I deleted the piece of code in the loop()

                    I deleted the device and the node from domotics, cleared eeprom and tried. It works, the relay gets paired and is presented in devices... and works. does it make sense?

                    void presentation()
                    {
                    // Send the sketch version information to the gateway and Controller
                    sendSketchInfo("Relay", "1.0");
                    for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
                    // Register all sensors to gw (they will be created as child devices)
                    present(sensor, pin);
                    }
                    }

                    mfalkviddM 1 Reply Last reply
                    0
                    • ? A Former User

                      Ok I did try something else: in void presentation i replaced S_BINARY by pin (of course I deleted the piece of code in the loop()

                      I deleted the device and the node from domotics, cleared eeprom and tried. It works, the relay gets paired and is presented in devices... and works. does it make sense?

                      void presentation()
                      {
                      // Send the sketch version information to the gateway and Controller
                      sendSketchInfo("Relay", "1.0");
                      for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
                      // Register all sensors to gw (they will be created as child devices)
                      present(sensor, pin);
                      }
                      }

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by
                      #15

                      @thierryd if RELAY_1 is defined as 3 it does not make sense, because S_BINARY is an alias for 3 so you should get the exact same result as when using S_BINARY.

                      See https://www.mysensors.org/download/serial_api_20#presentation for how the various message types are defined.

                      1 Reply Last reply
                      0
                      • gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #16

                        Try changing node ID, just in case domoticz messed up something about that id

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #17

                          Thank you all for your answers. @gohan : I'll try changing node ID tomorrow, it's bed time in France :-)

                          1 Reply Last reply
                          0
                          • gohanG Offline
                            gohanG Offline
                            gohan
                            Mod
                            wrote on last edited by
                            #18

                            It's same time for Italy too

                            1 Reply Last reply
                            0
                            • mfalkviddM Offline
                              mfalkviddM Offline
                              mfalkvidd
                              Mod
                              wrote on last edited by mfalkvidd
                              #19

                              I learned some more about c programming and my code in the earlier post could be changed to this:

                              void loop() {
                                  static bool first = true;
                                  if(first){
                                      first=false;
                                      send(msg.set(loadState(sensor)?RELAY_ON:RELAY_OFF), true);
                                  }
                              }
                              
                              1 Reply Last reply
                              0
                              • ? Offline
                                ? Offline
                                A Former User
                                wrote on last edited by
                                #20

                                Guys I'm confused as @gohan suggested I tried again with a "blank" node (eeprom clearded, etc...) with 2 relays: worked. Then I cleared it again and tried with one: worked also. It's like Domoticz's bouncer now thinks relays are nice lads, everybody gets accepted!
                                So thank you all, and for people having the issue, there's some stuff:
                                1- clear node ID, and try again
                                2- Add a button (or simulate one with a wire, just for the sake of pairing)
                                3- Add a piece of code to send data to domoticz, as per @mfalkvidd 's code.
                                All those worked a some point :-)
                                Thank you again guys, I promise my next post will not be a cry for help (more likely improvement for battery percentage reporting - LiPo -, and/or improvement of BME280 handling - avoid sending data every minute -)

                                1 Reply Last reply
                                1
                                • gohanG Offline
                                  gohanG Offline
                                  gohan
                                  Mod
                                  wrote on last edited by
                                  #21

                                  I noticed that Domoticz sometime is picky and doesn't like nodes that change configuration too often, that's why I suggested to use a different ID just in case.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  20

                                  Online

                                  11.7k

                                  Users

                                  11.2k

                                  Topics

                                  113.1k

                                  Posts


                                  Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • MySensors
                                  • OpenHardware.io
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular