Domoticz: Relay node doesn't show up in "devices"
-
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? -
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?@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); } } -
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! -
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);
}
} -
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);
}
}@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.
-
Thank you all for your answers. @gohan : I'll try changing node ID tomorrow, it's bed time in France :-)
-
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 -)