No triggering Door, Window and Push-button Sensor
-
Hello,
I just build a ESP8266 GW connected to my Vera Ui7 so far so good, made a sensor Relay, perfect it worked well,
But now when I try to build a Door, Window and Push-button Sensor i don´t get any event triggering in Vera.
I detect the sensor correct in devices, i can see 2 devices (arduino node 4 and Arduino motion 3 (4) ) i see that arduino node 4 "Last update" changes datetime when i change the sensor pinout (button) but somehow my scene doesn´t work.
I have a small scene where when Arduino Motion 3(4) detect motion armed or not it should turn on a Lamp but nothing happens, even in the log file from VERA i see that " Evaluate 4 scene Test Sensor is false " i always get false.Does nyone understands why?
Am I missing something.Thank you for your help.
RegardsSensor Code:
#include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #define CHILD_ID 3 #define BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch MySensor gw; Bounce debouncer = Bounce(); int oldValue=-1; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg(CHILD_ID,V_TRIPPED); void setup() { gw.begin(); // Setup the button pinMode(BUTTON_PIN,INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); // Register binary input sensor to gw (they will be created as child devices) // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. gw.present(CHILD_ID, S_MOTION); } // Check if digital input has changed and send in new value void loop() { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { // Send in the new value gw.send(msg.set(value==HIGH ? 1 : 0)); oldValue = value; } }Scene Vera:
Log in VERA:AlarmManager::AddRelativeAlarm current time 1456336378 delay 0 type 45 <0x7502e520>
AlarmManager::AddAbsoluteAlarm alarm 0xb36dc8 entry 0xd72f60 id 322 type 45 param=(nil) entry->when: 1456336378 time: 1456336378 bCancelFirst 0=0 <0x7502e520>
AlarmManager::Run 0xb36dc8 notified of a change entry 0x10200a0 id 312 deleted 0 <0x77a2e520>
AlarmManager::Run callback for alarm 0xb36dc8 entry 0xd72f60 type 45 id 322 param=(nil) entry->when: 1456336378 time: 1456336378 tnum: 1 slow 0 tardy 0 <0x77a2e520>
AlarmManager::Run finish callback for alarm 0xb36dc8 entry 0xd72f60 type 45 id 322 param=(nil) entry->when: 1456336378 time: 1456336378 tnum: 1 slow 0 duration 0 <0x77a2e520>
AlarmManager::Run 0xb36dc8 notified of a change entry 0x110fb78 id 303 deleted 0 <0x7782e520>
Device_Variable::m_szValue_set device: 88 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: [35;1mTripped[0m was: 536870913 now: 536870912 #hooks: 1 upnp: 0 skip: 1 v:0xc49ad8/NONE duplicate:0 <0x7502e520>
UserData::m_iDataVersion_Variables_incr Tripped user data 335633001 variables 335633212 <0x7502e520>
UserData::DataIsDirty UpdateStateList was 1 incr 0 user data 335633001 variables 335633212 <0x7502e520>
Device_Variable::m_szValue_set device: 88 VV: 1 <0x7502e520>
Event::Evaluate 4 scene Test Sensor is false repeat 0/-1 <0x7502e520> -
@toinobcool said: try sending "0" and "1" so strings i.s.o. numbers
BTW your loop can be optimized to this:
// Check if digital input has changed and send in new value void loop() { if (debouncer.update()) { // Send in the new value gw.send(msg.set(debouncer.read() ? "1" : "0")); } } -
thnaks @BartE .
I will give a try.I found some topic in the forum that there is a problem with the ESP8266 GW code.
The Development Code fix some bugs in the gateway. Is it something related to this issue ? -
It is working now.
If I have to send the value as a string and not int will it work if i send string values of temperature where it should be a int ?
That will be my next test :)@BartE thank you very much for the help.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login