I have some problems with all my relays see picture bellow. Before update there was no problem.
I have little knowledge how to program some help will be more than welcome
Some info:
My sensors version 1.5
Reinstalling domoticz doesn't help i have also windows version with same problem (of course i'm not using two gateways at the same time)
I'm using sketch from mysensors website with no changes.
Also i have erased the eeprom on all nodes and gateway but still i get error.
/**
* 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 <[email protected]>
* 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
*/
#include <MySigningNone.h>
#include <MyTransportNRF24.h>
#include <MyTransportRFM69.h>
#include <MyHwATMega328.h>
#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 4 // 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
// NRFRF24L01 radio driver (set low transmit power by default)
MyTransportNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);
//MyTransportRFM69 radio;
// Message signing driver (none default)
//MySigningNone signer;
// Select AtMega328 hardware profile
MyHwATMega328 hw;
// Construct MySensors library
MySensor gw(radio, hw);
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());
}
}
// 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 MOTOIN_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
#define RELAY_1 4 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define NUMBER_OF_RELAYS 4 // Total number of attached relays
#define RELAY_ON 0 // GPIO value to write to turn on attached relay
#define RELAY_OFF 1 // GPIO value to write to turn off attached relay
#define MOTION_CHILD_ID 9 // Id of the sensor child
#define RELAY_CHILD_ID 18 // Id of the sensor child
boolean lastMotion = false;
MySensor gw;
MyMessage msg(MOTION_CHILD_ID, V_TRIPPED);
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("Gang Pir and 4 realay", "1.0");
pinMode(MOTOIN_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
// Register all sensors to gw (they will be created as child devices)
gw.present(MOTION_CHILD_ID, S_MOTION);
// 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();
// Read digital motion value
boolean motion = digitalRead(MOTOIN_INPUT_SENSOR) == HIGH;
if (lastMotion != motion) {
lastMotion = motion;
gw.send(msg.set(motion ? "1" : "0" )); // Send motion value to gw
}
}
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());
}
}
// Example sketch showing how to control physical relays.
// This example will remember relay state even after power failure.
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
#define MY_NODE_ID 254
#include <MySensor.h>
#include <SPI.h>
#define MOTOIN_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
#define RELAY_1 4 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define NUMBER_OF_RELAYS 4 // Total number of attached relays
#define RELAY_ON 0 // GPIO value to write to turn on attached relay
#define RELAY_OFF 1 // GPIO value to write to turn off attached relay
#define MOTION_CHILD_ID 9 // Id of the sensor child
#define RELAY_CHILD_ID 18 // Id of the sensor child
boolean lastMotion = false;
MyMessage msg(MOTION_CHILD_ID, V_TRIPPED);
void setup()
{
}
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Test Switch", "1.0");
// Register all sensors to gw (they will be created as child devices)
present(MOTION_CHILD_ID, S_MOTION);
// 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)
present(sensor, S_LIGHT);
}
}
void loop()
{
// Alway process incoming messages whenever possible
wait(5000);
}
void incomingMessage(const MyMessage &message) {
// We only expect one type of message from controller. But we better check anyway.
Serial.print("Incoming message for sensor:");
Serial.print(message.sensor);
Serial.print(", data: ");
Serial.println(message.getString());
if (message.type==V_LIGHT) {
// Change relay state
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
}
}
Then i don't know what i'm doing wrong.
I just tested on clean os installation and still getting error. Im not using any repeater.
Testing it only with one arduino uno as gateway and one mini with just one relay attached to it.
Also tested with other controller (pimatic) with no problems.
Will be wonderful if you can add this option.
Yes i was following this tread but this guy with the same problem solved it with reinstalling domoticz in my case it doesn't help.
Is there any option to download old domoticz version for raspberry before adding ack option?
No, and you should fix somehow your sketches/gateway/repeater
sending with ACK is also default on homeseer, so it should work !
Edit: and also safe!
Edit2: i just tested with an example binary sketch, and it just works ! something is wrong there!
Is your node powered, do you call gw process ? or the wait function instead of sleep ?
if you try with an example sketch, is it working then ? If not which sketch did you try ?
gizmocuz wrote:No, and you should fix somehow your sketches/gateway/repeater
sending with ACK is also default on homeseer, so it should work !
Edit: and also safe!
Edit2: i just tested with an example binary sketch, and it just works ! something is wrong there!
Is your node powered, do you call gw process ? or the wait function instead of sleep ?
if you try with an example sketch, is it working then ? If not which sketch did you try ?
This are my steps:
Install Domoticz and mysensors library
upload gateway to arduino (just copy paste from mysensors website)
Upload sketch from mysensors website http://www.mysensors.org/build/relay
no custom code
What i see is that relays sometimes working for like one hour and than i get the error again like before.
Please help me out i'm sitting in the middle of house with all this stuff for 5 days my wife hates me now
I got same problem with sensors and latest version of domoticz..
what is strange:
- when I add new sensor to domoticz. it is working till I reset or restart domoticz. than it stops working...
- deleting and adding sensor again, it is working again till another restart (or update)...
in hardware->mysensors-> even if i tick OFF ACK, it is still ON ACK...
Hi I also have this problem and don't know what to do anymore. I reload my pi new image and Domoticz (new DB) the latest beta version V2.3589. I tested it with sketch in this post it works fine till I restart Domoticz and then the only why that I can get it to works again is to reset the node. Any ideas what I can do to fix the problem. I also disable the ack and it that also is not helping still getting the same error.
In the log file I get this error:
2015-11-14 12:34:03.020 Error: MySensors: Light command received for unknown node_id: 79, child_id: 2
Here I reset the node and the node is working again:
could you debug your node (connecting it to a pc with the arduin ide, and open the serial monitor)
if you send a command, what is displayed in the debug output ?
HI here is the output from the serial monitor for the one sensor I am working on to understand why this is happing. I even upgrade to MySensor beta 1.6.0 to see if there was not a problem in ver 1.5.
i think this all was not related to ACK.
The error came out of domoticz, because it did not receive the node/child yet, which is logical at startup,
you do not want to unplug/replug all your switch nodes
Just made a new beta version #3590, that now also loads the childs, that should hopefully solve this problem.
If it does, please enable ack, and tell if this works good, as you really want to have this on to make sure the command is received
My relay sensor is now working after I upgrade to v2.3590. Also my ack work as well. If I power the relay sensor off and send a command to the node I get an error. Once I reconnect the sensors and I send a command to it start working and no error message from Domoticz!!!
If you look at the serial debug log you will now see that I getting an send command where I did not before.