Got it working with this sleep function properly:
// Sleep until interrupt comes in on motion or water sensor. Send update every two minute.
gw.sleep(DIGITAL_INPUT_SENSOR - 2, CHANGE, DIGITAL_INPUT_WATER_SENSOR - 2, CHANGE, SLEEP_TIME);
Hi @pesh000, couple of remarks at your sketch
Did you try the RCSwitch code with out any MySensor stuff so for example the SendDemo sketch with for your garage door the correct ID and pin settings? And did the garage door open/close?
Why declaring 2 debouncer variables but still using digitalRead? Look at the MySensors RelayWithButtonActuator example for debouncer examples
Why using hard coded numbers in the incomingMessage switch to determine which sensor did broadcast the V_LIGHT message while you have CHILD_ID_RELAY1, CHILD_ID_RELAY2 and CHILD_ID_RELAY3 declared?
better use gw.wait(1000); in stead g delay(1000); during gw.wait() MySensors messages keep being processed. Even better do not use wait() functions or very short ones to keep your sketch responsive to triggers
And last but not least it will help if you can post some debug logging from your sketch. I hope these comments will help you to debug , good luck
Found the answer in this tread
https://forum.mysensors.org/topic/1086/getting-childid-from-incomingmessage/6
Will try this
if (message.type==V_LIGHT && message.sensor==3)
@martinhjelmare
Thank you!!!! I was getting crazy working only with the Serial monitor on both sides. I didn't know that the Controller is playing a key role on assigning the nodeID.
It is working now after connecting the gateway to HomeAssistant.
Thanks.
Regards.
Alfredo.
Thanks tekka! I have updated to IDE 1.6.9 (was on 1.6.7) and also found out I was using the wrong location for libraries (the libraries I copied to the program files folder in C:\Program Files(86)\Arduino, seems they belong in the documents folder of the user profile). After this indeed the example Sketch HumiditySensor now compiled without errors.
On my particular sketch (I want to use send locally attached sensors through the ethernet gateway) I stil got the error. Now I started to compare the two and the error disappears when I include the MY_RADIO library (#define MY_RADIO_NRF24) in my sketch.
Very happy that it's solved now. Thanks for your help!
Problem solved for my case. :smiley:
Just to give a hint to anyone who might have a similar problem, I had misconfigured the default pin assignments.
In particular the INCLUSION_MODE_PIN definition was colliding with one of the LED pins (maybe RADIO_RX_LED_PIN).
Hope this helps.
No, I'm not using MySensors on the Arduino, I'm using RadioHead. I posted on here as there seemed to be a lot of people using that module on this forum. But yes: the radios are both configured to 2Mbps. The fact that the RPi can receive even though not transmit certainly lends weight to @mfalkvidd's suggestion that it might be power-related. I'm getting some voltage regulators and will power it separately from the Pi to see if that improves anything.
On a related note ... why are 3.3V regulators so hard to come by!? It's been years since I last picked up a soldering iron... Grumble
@martinhjelmare I think you might be on to something, as I have noticed that other microcontroller modules point the antenna away from the PCB, where as the Sensebender and RF module are overlapping.
I will investigate by adding jumper wires from the SenseBender and the RF module to add some separation.
Thanks...
@vga The sensor you are referring to is working with "hall" effect. I can't find the internal schematics of the thing but I assume there are some active components to give you a nice square wave output. Another principle would be a magnet with reed (magnetic) contact which you can read with minimal current.
You can find the " rest" current by measuring the power line of the sensor .
Never mind figured it out.
There was a problem somewhere in that sketch. basically started from scratch again. merged the W5100 MQTT client gateway sketch and the relay sketch. then referred to here for serial MQTT syntax.
Hope anyone else thats struggling finds this info useful.