Mysensors - Relay Switch
Moderator: leecollings
-
- Posts: 8
- Joined: Thursday 12 February 2015 9:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.2317
- Contact:
Mysensors - Relay Switch
Hello
I have connected my sensors gateway via usb, and it seems to be working fine for a temp/humidy sensor. Unfortunately it doesn't work for a Relay Actuator. I can see under domoticz log that Relay is detected (see attachment), but It doesn't appear under devices list. Can someone help please?
I have connected my sensors gateway via usb, and it seems to be working fine for a temp/humidy sensor. Unfortunately it doesn't work for a Relay Actuator. I can see under domoticz log that Relay is detected (see attachment), but It doesn't appear under devices list. Can someone help please?
- Attachments
-
- Domoticz device list
- domoticz device.jpg (268.63 KiB) Viewed 14894 times
-
- Domoticz log
- domoticz.jpg (93.15 KiB) Viewed 14894 times
- gizmocuz
- Posts: 2350
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Mysensors - Ralay Switch
The log displays that there is a node plugged in, and its reporting the sketch name/version.
However, it does not receive anything (as i can see in the log)
I think this 'relay' (switch) node, is not sending the 'current' switch state to the serial controller ?
Please modify your code a little bit
Do you load/save the state (as in the RelayActuator example) ?
(strongly advised)
Then after sending the sketch info, load the current state,
gw.loadState
- set this state to the real output (digitalWrite or similar call)
- send this state to the serial controller
// Change to V_LIGHT if you use S_LIGHT in presentation below
MyMessage msg(CHILD_ID,V_TRIPPED);
gw.send(msg.set(value==HIGH ? 1 : 0));
When you receive a command from the serial controller (to switch a relay), store this state
gw.saveState(message.sensor, message.getBool());
This has multiple advantages:
- when there is a power failure, the relays will automatically be set to the last state
- and domoticz always has the current state
However, it does not receive anything (as i can see in the log)
I think this 'relay' (switch) node, is not sending the 'current' switch state to the serial controller ?
Please modify your code a little bit
Do you load/save the state (as in the RelayActuator example) ?
(strongly advised)
Then after sending the sketch info, load the current state,
gw.loadState
- set this state to the real output (digitalWrite or similar call)
- send this state to the serial controller
// Change to V_LIGHT if you use S_LIGHT in presentation below
MyMessage msg(CHILD_ID,V_TRIPPED);
gw.send(msg.set(value==HIGH ? 1 : 0));
When you receive a command from the serial controller (to switch a relay), store this state
gw.saveState(message.sensor, message.getBool());
This has multiple advantages:
- when there is a power failure, the relays will automatically be set to the last state
- and domoticz always has the current state
Quality outlives Quantity!
-
- Posts: 2
- Joined: Monday 23 February 2015 9:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Mysensors - Ralay Switch
Maybe this could be the case for my request too. http://www.domoticz.com/forum/tracker.php?p=2&t=447
I'll try tonight or tomorrow.
EDIT:
tried, this works. In the setup part, after the presentation, send the state back, and domoticz will show the actuator.
I'll try tonight or tomorrow.
EDIT:
tried, this works. In the setup part, after the presentation, send the state back, and domoticz will show the actuator.
- gizmocuz
- Posts: 2350
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Mysensors - Ralay Switch
as long as you also implement the load/save state then your fine
Quality outlives Quantity!
-
- Posts: 8
- Joined: Thursday 12 February 2015 9:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.2317
- Contact:
Re: Mysensors - Ralay Switch
Thanks for that.
Can you send/show your sketch Pino? I'm getting some errors on mine when compiling. Not sure what I'm doing wrong.
Can you send/show your sketch Pino? I'm getting some errors on mine when compiling. Not sure what I'm doing wrong.
-
- Posts: 8
- Joined: Thursday 23 January 2014 22:23
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Mysensors - Relay Switch
Same as filipq I have some errors in my relay sketch
I don't really understand the gizmocuz's response
Pino, if you have some example it's more easy for me (us ?)
I don't really understand the gizmocuz's response
Pino, if you have some example it's more easy for me (us ?)
Domoticz blog & forum in french
http://easydomoticz.com/
http://easydomoticz.com/
-
- Posts: 75
- Joined: Sunday 30 November 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hoorn, Netherlands
- Contact:
Re: Mysensors - Ralay Switch
+1! thanks! ,, Floristhegritche wrote:Hello
Same as filipq I have some errors in my relay sketch
I don't really understand the gizmocuz's response
Pino, if you have some example it's more easy for me (us ?)
Thanks
-
- Posts: 8
- Joined: Thursday 12 February 2015 9:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.2317
- Contact:
Mysensors - Relay Switch
I have managed to get it working. Could you check on yours and post your reply?
- Attachments
-
- RelayActuatorDomoticz.zip
- MySensors Relay - Domoticz
- (1.09 KiB) Downloaded 732 times
-
- Posts: 75
- Joined: Sunday 30 November 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hoorn, Netherlands
- Contact:
Mysensors - Relay Switch
It didnt work with me.. I still can t see the relays in domoticz. I can see it in MYScontroller. weird...
-
- Posts: 18
- Joined: Saturday 04 January 2014 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Mysensors - Relay Switch
try to trigger the relay one time, so domoticz see state changing
CubieTruck with Domoticz
RfxTrx 433Mhz Usb, Rfx Sensor, Z-Wave
Slave Raspberry Pi with Domoticz, Piface, P1 usb
RfxTrx 433Mhz Usb, Rfx Sensor, Z-Wave
Slave Raspberry Pi with Domoticz, Piface, P1 usb
-
- Posts: 75
- Joined: Sunday 30 November 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hoorn, Netherlands
- Contact:
Re: Mysensors - Relay Switch
eehhhh, how can i trigger the relay? when i power on the arduino, the relay switches on, and that is not notifided. stange.
edit;
i did "Clearing EEPROM" and after uploading the sketch, i can see the switch, as a security-sensor. but i cant controll it with domoticz.... any help?
edit;
when i restart the adruino, it doesn't sent each time the switch-state, while the relay is switching on, as progammed in the sketch...
edit;
i did "Clearing EEPROM" and after uploading the sketch, i can see the switch, as a security-sensor. but i cant controll it with domoticz.... any help?
edit;
when i restart the adruino, it doesn't sent each time the switch-state, while the relay is switching on, as progammed in the sketch...
-
- Posts: 2
- Joined: Monday 23 February 2015 9:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Mysensors - Relay Switch
Code: Select all
// 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 0 // GPIO value to write to turn on attached relay
#define RELAY_OFF 1 // GPIO value to write to turn off attached relay
MySensor gw;
MyMessage msg(1,V_LIGHT);
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)
boolean savedState = gw.loadState(sensor);
digitalWrite(pin, savedState?RELAY_ON:RELAY_OFF);
gw.send(msg.set(savedState? 1 : 0));
}
}
void loop()
{
// Alway process incoming messages whenever possible
gw.process();
}
void incomingMessage(const MyMessage &message) {
if (message.type==V_LIGHT) {
boolean relayState = message.getBool();
digitalWrite(message.sensor-1+RELAY_1, relayState?RELAY_ON:RELAY_OFF);
gw.saveState(message.sensor, relayState);
gw.send(msg.set(relayState? 1 : 0));
-
- Posts: 75
- Joined: Sunday 30 November 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hoorn, Netherlands
- Contact:
Mysensors - Relay Switch
Thanks Pino, hope it Will work....
#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
Might That be my problem? I have a ethernet gateway. Mysensors is not connected by GPIO. I dont have a Pi at all.
edit; i can see the switch as a light, but i still can't controll the relay....
edit again.... created a serial gateway instead of a ethernetgateway... Voilá!!! It worked!!!! Only problem is that my ethernet-gateway is central located, and my server is on the 2th floor. any idea why it's not working with the ethernetgateway?
#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
Might That be my problem? I have a ethernet gateway. Mysensors is not connected by GPIO. I dont have a Pi at all.
edit; i can see the switch as a light, but i still can't controll the relay....
edit again.... created a serial gateway instead of a ethernetgateway... Voilá!!! It worked!!!! Only problem is that my ethernet-gateway is central located, and my server is on the 2th floor. any idea why it's not working with the ethernetgateway?
- gizmocuz
- Posts: 2350
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Mysensors - Relay Switch
I just build my first mysensors ethernet gateway
It is working
i had a W5100 ethernet shield (for uno), and a arduino nano.
http://i.ebayimg.com/00/s/NjAwWDYwMA==/ ... 880000500F
i connected the shield with the arduino via the ISCP connector, and also wired pin 10 (nothing more is needed to get the ethernet part working)
connected the NRF24L01 Radio module.
Loaded the MySensors ethernet sketch, modified:
- ip address, nothing more
But, you also need to modify the below files (and revert the changes when you have uploaded the sketch)
- libraries/MySensors/MyConfig.h -> remark the #define DEBUG
- libraries/MySensors/Utility/RF24_config.h -> unmark/remove the slashes in front of #define SOFTSPI
Uploaded the sketch, and in domoticz added the MySensors with Lan interface hardware type, ip address, port = 5003
working perfectly
Not sure if i will use this big shield, there is also a small one
Ps. there is a new beta that should work better with the V_LIGHT/S_LIGHT examples
/Rob
It is working
i had a W5100 ethernet shield (for uno), and a arduino nano.
http://i.ebayimg.com/00/s/NjAwWDYwMA==/ ... 880000500F
i connected the shield with the arduino via the ISCP connector, and also wired pin 10 (nothing more is needed to get the ethernet part working)
connected the NRF24L01 Radio module.
Loaded the MySensors ethernet sketch, modified:
- ip address, nothing more
But, you also need to modify the below files (and revert the changes when you have uploaded the sketch)
- libraries/MySensors/MyConfig.h -> remark the #define DEBUG
- libraries/MySensors/Utility/RF24_config.h -> unmark/remove the slashes in front of #define SOFTSPI
Uploaded the sketch, and in domoticz added the MySensors with Lan interface hardware type, ip address, port = 5003
working perfectly
Not sure if i will use this big shield, there is also a small one
Ps. there is a new beta that should work better with the V_LIGHT/S_LIGHT examples
/Rob
Quality outlives Quantity!
-
- Posts: 75
- Joined: Sunday 30 November 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hoorn, Netherlands
- Contact:
Re: Mysensors - Relay Switch
Hi,
thanks a lot! It's getting pretty stable now with my usb-gateway. Maybe later i'll start the adventure again with the ethernet. I did all the modifications, except:
-libraries/MySensors/MyConfig.h -> remark the #define DEBUG
so probably that was my problem.
thanks a lot for the new beta. i have a working 2-relay sensor node now. and a motion-relay sensor node.
Floris
thanks a lot! It's getting pretty stable now with my usb-gateway. Maybe later i'll start the adventure again with the ethernet. I did all the modifications, except:
-libraries/MySensors/MyConfig.h -> remark the #define DEBUG
so probably that was my problem.
thanks a lot for the new beta. i have a working 2-relay sensor node now. and a motion-relay sensor node.
Floris
-
- Posts: 1
- Joined: Tuesday 28 April 2015 20:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.24
- Contact:
Re: Mysensors - Relay Switch
@gizmocuz Are you able to turn relay on and off? I've tried to make the EthernetGW work but It seems that I only get oneway communciation, sensors logs to Domoticz but I can't send anything to the sensors, I have a LED attached to a sensor with the Relay software on it. It works using serialgateway and the ethernetGW works when testing with the MYSController . Is there any setting in Domoticz to turn on/off twoway communication when using ethernet?
-
- Posts: 75
- Joined: Sunday 30 November 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hoorn, Netherlands
- Contact:
Re: Mysensors - Relay Switch
Damn!!! after upgrading my relays arent working anymore! GizMoGuz, any help??
-
- Posts: 12
- Joined: Wednesday 08 April 2015 18:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Mysensors - Relay Switch
I recently updated and saw the same issue with alerts not fireing. What I did was upgrade again to Domoticz V2.2416. After upgrading to the lattest version, go into settings and email alerts. Save the email settings and send a test message. I was able to get an alert after doing these.
-
- Posts: 75
- Joined: Sunday 30 November 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hoorn, Netherlands
- Contact:
Re: Mysensors - Relay Switch
Ehhhh... Does That make mysensors relays work again???
-
- Posts: 12
- Joined: Wednesday 08 April 2015 18:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Mysensors - Relay Switch
Just notifcations. My relays work most of the time.
Who is online
Users browsing this forum: No registered users and 1 guest