Merci à tous pour vos réactions et conseils.
Je tache de prendre toutes les précautions d'usage lorsque j'interviens sur du 220 notamment l'arrêt de tension niveau compteur et je ne touche jamais le PCB lorsqu'il est alimenté.
@frenchyyii
Le PCB est disponible à cette adresse, environ 10 plaques pour 15 euros.
http://dirtypcbs.com/view.php?share=196 ... ecc2e5f983
@vil1driver
J'espérais une réponse de ta part d'autant qu'en parcourant le forum MySensors j'ai vu que tu t'étais intéressé à ce projet et qu'en autre tu faisais parti de ceux qui avaient suggéré un 2eme relais

.
Plutôt que de refaire des erreurs je préfère te suggérer le montage rectifié en fonction de tes directives

- IMG_20161102_201657.jpg (317.11 Kio) Consulté 10478 fois
Par ailleurs et peu être que c'est un élément important, j'ai configuré ma passerelle comme expliquer sur ce post
https://forum.mysensors.org/topic/2437/ ... ensors-1-x
Deuxième chose qui me dérange .. lorsque je branche le PCB, Domoticz me reconnaît bien les nodes comme je l'ai expliqué dans mon 1er post .. sauf que dans le moniteur série j ai des "fail"
Code : Tout sélectionner
send: 1-1-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=fail:0
send: 1-1-0-0 s=255,c=0,t=18,pt=0,l=5,sg=0,st=fail:1.5.4
send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:0
repeater started, id=1, parent=0, distance=1
send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=21,sg=0,st=fail:Double Relay & Button
send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=fail:0.1
send: 1-1-0-0 s=11,c=0,t=3,pt=0,l=0,sg=0,st=fail:
find parent
send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
send: 1-1-0-0 s=12,c=0,t=3,pt=0,l=0,sg=0,st=fail:
send: 1-1-0-0 s=11,c=1,t=2,pt=2,l=2,sg=0,st=fail:0
send: 1-1-0-0 s=12,c=1,t=2,pt=2,l=2,sg=0,st=fail:0
Par ailleurs en regardant le sketch je constate, sauf erreur de ma part qu'il est déjà adapté pour utiliser les pin 4 et 7. est ce que je me trompe ?
Code : Tout sélectionner
// Example sketch för a "light switch" where you can control light or something
// else from both vera and a local physical button (connected between digital
// pin 3 and GND).
// This node also works as a repeader for other nodes
#include <MySensor.h>
#include <SPI.h>
#include <Bounce2.h>
#define RELAY_PIN 3 // Arduino Digital I/O pin number for relay
#define RELAY_PIN_2 5
#define BUTTON_PIN 4 // Arduino Digital I/O pin number for button
#define BUTTON_PIN_2 7
#define CHILD_ID_2 12
#define CHILD_ID 11 // Id of the sensor child
#define RELAY_ON 1
#define RELAY_OFF 0
Bounce debouncer = Bounce();
int oldValue=0;
bool state;
Bounce debouncer2 = Bounce();
int oldValue2=0;
bool state2;
MySensor gw;
MyMessage msg(CHILD_ID,V_LIGHT);
MyMessage msg2(CHILD_ID_2,V_LIGHT);
void setup()
{
gw.begin(incomingMessage, AUTO, true);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Double Relay & Button", "0.1");
// Setup the button
pinMode(BUTTON_PIN,INPUT);
// Activate internal pull-up
digitalWrite(BUTTON_PIN,HIGH);
// Setup the button
pinMode(BUTTON_PIN_2,INPUT);
// Activate internal pull-up
digitalWrite(BUTTON_PIN_2,HIGH);
// After setting up the button, setup debouncer
debouncer.attach(BUTTON_PIN);
debouncer.interval(5);
debouncer2.attach(BUTTON_PIN_2);
debouncer2.interval(5);
// Register all sensors to gw (they will be created as child devices)
gw.present(CHILD_ID, S_LIGHT);
gw.present(CHILD_ID_2, S_LIGHT);
// Make sure relays are off when starting up
digitalWrite(RELAY_PIN, RELAY_OFF);
// Then set relay pins in output mode
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN_2, RELAY_OFF);
// Then set relay pins in output mode
pinMode(RELAY_PIN_2, OUTPUT);
// Set relay to last known state (using eeprom storage)
state = gw.loadState(CHILD_ID);
digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
state2 = gw.loadState(CHILD_ID_2);
digitalWrite(RELAY_PIN_2, state2?RELAY_ON:RELAY_OFF);
}
/*
* Example on how to asynchronously check for new messages from gw
*/
void loop()
{
gw.process();
debouncer.update();
debouncer2.update();
// Get the update value
int value = debouncer.read();
int value2 = debouncer2.read();
if (value != oldValue) {
gw.send(msg.set(state?false:true), true); // Send new state and request ack back
}
oldValue = value;
if (value2 != oldValue2) {
gw.send(msg2.set(state2?false:true), true); // Send new state and request ack back
}
oldValue2 = value2;
}
void incomingMessage(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_LIGHT && message.sensor == 11) {
// Change relay state
state = message.getBool();
digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
// Store state in eeprom
gw.saveState(CHILD_ID, state);
}
else if(message.type == V_LIGHT && message.sensor == 12){
state2 = message.getBool();
digitalWrite(RELAY_PIN_2, state2?RELAY_ON:RELAY_OFF);
// Store state in eeprom
gw.saveState(CHILD_ID_2, state2);
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
}
}