relay statue doesn't change
- 
					
					
					
					
 hi everyone 
 i make a relay sensor this weekend but it doesn t work. The statue never change.
 This the log if someone can help me
 thinkssend: 136-136-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0 
 send: 136-136-0-0 s=255,c=0,t=18,pt=0,l=5,sg=0,st=ok:1.5.4
 send: 136-136-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
 read: 0-0-136 s=255,c=3,t=6,pt=0,l=1,sg=0:M
 repeater started, id=136, parent=0, distance=1
 send: 136-136-0-0 s=255,c=3,t=11,pt=0,l=5,sg=0,st=ok:Relay
 send: 136-136-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
 send: 136-136-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
 read: 0-0-136 s=1,c=1,t=2,pt=0,l=1,sg=0:0
 send: 136-136-0-0 s=1,c=1,t=2,pt=0,l=1,sg=0,st=ok:0
 Incoming change for sensor:1, New status: 0
 read: 0-0-136 s=1,c=1,t=2,pt=0,l=1,sg=0:0
 send: 136-136-0-0 s=1,c=1,t=2,pt=0,l=1,sg=0,st=ok:0
 Incoming change for sensor:1, New status: 0
 read: 0-0-136 s=1,c=1,t=2,pt=0,l=1,sg=0:0
 send: 136-136-0-0 s=1,c=1,t=2,pt=0,l=1,sg=0,st=ok:0
 Incoming change for sensor:1, New status: 0
 
- 
					
					
					
					
 Did you use the standard code from the example? 
 
- 
					
					
					
					
 @gohan yes standard code 
 
- 
					
					
					
					
 @ludoarchi 1.5.4 version 
 
- 
					
					
					
					
 nobody have idea ? 
 
- 
					
					
					
					
 Your only getting 0 sent for the relay so it certainly won't be changing status. Perhaps post the code you are using . 
 
- 
					
					
					
					
 
 
- 
					
					
					
					
 arduini 1.6.5 + Mysensors libraries 1.5.4 
 and relay actuator code come from mysensors 1.5.4 exemple
 
- 
					
					
					
					
 @boots33 i only used code from mysensors exemple. I tried exemples V1 and V2 and i always have only 0 sent. I don't understand. 
 
- 
					
					
					
					
 1.5.4 is a few versions back now so it will help if you post the code you are using, even if it is the standard version. That will give us a starting point to work from. 
 Also what controller are you using.
 
- 
					
					
					
					
 @ludoarchi Is there a reason why you don't update arduino to 1.8.5 and mysensors to 2.2? 
 
- 
					
					
					
					
 @gohan because i remenber that it used to work in that old version. But i have test yesterday with mysensors 2.2.0 et code V2 and it s ths same problem ... an idea ? 
 
- 
					
					
					
					
 @boots33 that s the code V1 // Example sketch showing how to control physical relays. // This example will remember relay state even after power failure. #include <MySensor.h> #include <SPI.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 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 MySensor gw; void setup() { // Initialize library and add callback for incoming messages gw.begin(incomingMessage, AUTO, true); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Relay", "1.0"); // Fetch relay status 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) gw.present(sensor, S_LIGHT); // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF); } } void loop() { // Alway process incoming messages whenever possible gw.process(); } void incomingMessage(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom gw.saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
 
- 
					
					
					
					
 @boots33 that s the code V2 /** * 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 showing how to control physical relays. * This example will remember relay state after power failure. * http://www.mysensors.org/build/relay */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable repeater functionality for this node #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 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 void before() { for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { } 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, S_BINARY); } } void loop() { } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_STATUS) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
 
- 
					
					
					
					
 @boots33 i m using mysensor 2.2 with jeedom last version on rpi3 (serial gateway and node with 4.7uf condo). 
 i also used my old rpi2 with Mysensors 1.5.4 for test
 
- 
					
					
					
					
 are you checking the right relay pin? Pls post a v2 node log 
 
- 
					
					
					
					
 @gohan 16 MCO:BGN:INIT REPEATER,CP=RNNRA---,VER=2.2.0 
 26 MCO:BGN:BFR
 27 TSM:INIT
 28 TSF:WUR:MS=0
 35 TSM:INIT:TSP OK
 37 TSF:SID:OK,ID=136
 39 TSM:FPAR
 75 TSF:MSG:SEND,136-136-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
 2083 !TSM:FPAR:NO REPLY
 2085 TSM:FPAR
 2121 TSF:MSG:SEND,136-136-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
 2568 TSF:MSG:READ,0-0-136,s=255,c=3,t=8,pt=1,l=1,sg=0:0
 2573 TSF:MSG:FPAR OK,ID=0,D=1
 2842 TSF:MSG:READ,5-5-136,s=255,c=3,t=8,pt=1,l=1,sg=0:2
 2851 TSF:MSG:READ,45-45-136,s=255,c=3,t=8,pt=1,l=1,sg=0:1
 4129 TSM:FPAR:OK
 4130 TSM:ID
 4131 TSM:ID:OK
 4133 TSM:UPL
 4136 TSF:MSG:SEND,136-136-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
 4148 TSF:MSG:READ,0-0-136,s=255,c=3,t=25,pt=1,l=1,sg=0:1
 4153 TSF:MSG:PONG RECV,HP=1
 4156 TSM:UPL:OK
 4157 TSM:READY:ID=136,PAR=0,DIS=1
 4162 TSF:MSG:SEND,136-136-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
 4169 TSF:MSG:READ,0-0-136,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
 4179 TSF:MSG:SEND,136-136-0-0,s=255,c=0,t=18,pt=0,l=5,sg=0,ft=0,st=OK:2.2.0
 4195 TSF:MSG:SEND,136-136-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
 4220 TSF:MSG:READ,0-0-136,s=255,c=3,t=6,pt=0,l=1,sg=0:M
 4228 TSF:MSG:SEND,136-136-0-0,s=255,c=3,t=11,pt=0,l=5,sg=0,ft=0,st=OK:Relay
 4236 TSF:MSG:SEND,136-136-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
 4244 TSF:MSG:SEND,136-136-0-0,s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
 4251 MCO:REG:REQ
 4254 TSF:MSG:SEND,136-136-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
 4261 TSF:MSG:READ,0-0-136,s=255,c=3,t=27,pt=1,l=1,sg=0:1
 4267 MCO:PIM:NODE REG=1
 4269 MCO:BGN:STP
 4271 MCO:BGN:INIT OK,TSP=1
 22720 TSF:MSG:READ,0-0-136,s=1,c=1,t=2,pt=0,l=1,sg=0:0
 22724 TSF:MSG:ACK REQ
 22737 TSF:MSG:SEND,136-136-0-0,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
 Incoming change for sensor:1, New status: 0
 31295 TSF:MSG:READ,0-0-136,s=1,c=1,t=2,pt=0,l=1,sg=0:0
 31299 TSF:MSG:ACK REQ
 31337 !TSF:MSG:SEND,136-136-0-0,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:0
 Incoming change for sensor:1, New status: 0
 
- 
					
					
					
					
 The last you got was a NACK btw. Have you tried a different controller like domoticz or MyController? Also remember to check your logs on https://www.mysensors.org/build/parser if you meed help decoding it 
 
- 
					
					
					
					
 @gohan i think the nack came when i unplleged the node but i will try again. 
 there is no nack in the V1log
 i would like to try myscontroler but i m not able to start with it ... i ve configured the COM but nothing happened ... i don't find How To for it i also try Double State Relay code V2 and it s the same think ... no statue change 
 
- 
					
					
					
					
 I am talking about MyController, not MySController 
 
- 
					
					
					
					
 @gohan oups ! sorry no i don't have try another controller yet 
 
- 
					
					
					
					
 try it, it is quite simple to run 
 
 
					
				
 
					
				