SensorMotion to send both tripped and not tripped
-
@Sergio-Rius FYI I've just merged into the development branch a pretty massive change in the way interrupts are handled, conforming the behavior between sleeping and not sleeping nodes (more information on https://github.com/mysensors/NodeManager/pull/151). If you will pull the updated development branch, you should get the new changes as well. No major changes in the API, it is more related to what happens behind the scene. Thanks
@user2684 Thanks for the info, I've udpated my local copy for using the last changes. I see that the presence sensor work properly with the dev branch.
-
@user2684 Thanks for the info, I've udpated my local copy for using the last changes. I see that the presence sensor work properly with the dev branch.
@Sergio-Rius cool, glad to hear this is working fine with the dev branch
-
@Sergio-Rius thanks a lot for the debugging so far. The only difference I clearly see is the mode which is reported when waking up. In your case is always 3 (RISING), in mine and with your custom sketch is instead 1 (CHANGE). Would you mind commenting out setMode(RISING) in the constructor of SensorMotion in your NodeManager.cpp?
My concern is that with v1.5 setMode just changing the local variable and not the interrupt's setting which is what is used to wake up when passing it to MySensors' sleep(). The other try would be to see if with https://github.com/mysensors/NodeManager/tree/development the situation changed since that part of the code has been almost completely rewritten.Thanks!
@user2684 said in SensorMotion to send both tripped and not tripped:
Would you mind commenting out setMode(RISING) in the constructor of SensorMotion in your NodeManager.cpp?
I've checked it and if commenting the line, the sensor works as expected. ;)
-
@user2684 said in SensorMotion to send both tripped and not tripped:
Would you mind commenting out setMode(RISING) in the constructor of SensorMotion in your NodeManager.cpp?
I've checked it and if commenting the line, the sensor works as expected. ;)
@Sergio-Rius do you mean that with RISING does not work at all or would be better to have CHANGE instead? I'm ok in changing the default behavior if this is what users like the most
-
@Sergio-Rius do you mean that with RISING does not work at all or would be better to have CHANGE instead? I'm ok in changing the default behavior if this is what users like the most
@user2684 In my code, I'm using CHANGE. Leaving the library as is, CHANGE doesn't function properly. For better answering your question I would have to understand what does
setMode(RISING);at line 1200 of NodeManager.cpp.
My understand is that if you offer changing the behaviour, user changes should not been overidden. so I guessed that line was a default setting. But seems that doesn't respect user values.I would experiment with the other possible Mode values leaving that line commented.
-
@Sergio-Rius do you mean that with RISING does not work at all or would be better to have CHANGE instead? I'm ok in changing the default behavior if this is what users like the most
@user2684 said in SensorMotion to send both tripped and not tripped:
changing the default behavior if this is what users like the most
Depending on how is it programmed and it's application. Can I ask for everything?
Most cases I prefer versatility. Nowadays you can get instructions for doing almost anything on raising online communities, but Very often they also offer corseted (popular, stereotypical) solutions.Let me find an example: It makes sense to control rising status on a movement sensor because most of people would like to sense movement on a small room. But it makes more sense for some others to monitor absence of movement. For power saving, for example. You could have a discrete power system for all IoT, a solar supply and wanted to disable not using components.
A simple security system would also fail with the controller I'm using, because it stays "in alarm" until the movement has gone (receives low).Again, most solutions I find on inet are ok for a small sized flat, but gives trouble on a medium sized house.
In my house, for example, until repeaters where implemented, mysensors was nothing but a playtoy for me. But I guess having a large sized, stone house (24cm stone thickness and heating floorings really kill radio signals), with displaced floorplans (problematic wire routings) placed just at the frontier with another country (that doesn't seem to care for radio regulations and interference) is not very common. -
@user2684 In my code, I'm using CHANGE. Leaving the library as is, CHANGE doesn't function properly. For better answering your question I would have to understand what does
setMode(RISING);at line 1200 of NodeManager.cpp.
My understand is that if you offer changing the behaviour, user changes should not been overidden. so I guessed that line was a default setting. But seems that doesn't respect user values.I would experiment with the other possible Mode values leaving that line commented.
@Sergio-Rius let me give some more context. What is provided to setMode() is eventually used when invoking MySensors' sleep() function and instruct the board when to wake up. If RISING is set, the board will wake up (and report "1" to the controller) only when the sensor triggers, if using CHANGE it will wake up and report "1" when the sensor triggers and will wake up again and report "0" when the signal goes down again. I'm personally using RISING because in my controller if goes to 1 and then to 0, I lose the motion but I understand it is dependent on the controller.
When I need to understand is:- is the CHANGE vs RISING behavior the expected one? In my test it is, in yours we have that mode = 3 instead of 1 which we cannot easily explain
- if the behavior is the expected one (so the implementation is correct), what is best for the majority of the controllers, reporting upon a CHANGE or upon RISING.
The first one will tell me if the implementation is correct, the second what is the most suitable default behavior. For me of course either way is fine.
Many thanks!
-
@Sergio-Rius let me give some more context. What is provided to setMode() is eventually used when invoking MySensors' sleep() function and instruct the board when to wake up. If RISING is set, the board will wake up (and report "1" to the controller) only when the sensor triggers, if using CHANGE it will wake up and report "1" when the sensor triggers and will wake up again and report "0" when the signal goes down again. I'm personally using RISING because in my controller if goes to 1 and then to 0, I lose the motion but I understand it is dependent on the controller.
When I need to understand is:- is the CHANGE vs RISING behavior the expected one? In my test it is, in yours we have that mode = 3 instead of 1 which we cannot easily explain
- if the behavior is the expected one (so the implementation is correct), what is best for the majority of the controllers, reporting upon a CHANGE or upon RISING.
The first one will tell me if the implementation is correct, the second what is the most suitable default behavior. For me of course either way is fine.
Many thanks!
@user2684 I can't tell you what is the desirable default behaviour. The only thing we can expect, is that if we change the mode, it correctly overrides the default.
Just a question, then... your controller how it knows when to "turn the security icon from red to green"? Is it a timer?
But then, if the PIR is set to repeating signal, this couldn't be a problem? -
@user2684 I can't tell you what is the desirable default behaviour. The only thing we can expect, is that if we change the mode, it correctly overrides the default.
Just a question, then... your controller how it knows when to "turn the security icon from red to green"? Is it a timer?
But then, if the PIR is set to repeating signal, this couldn't be a problem?@Sergio-Rius that's the point, I'm still trying to understand if changing the mode, the default is overridden which it is the case in my test, looks like not in yours :-/ Regarding my controller, it checks every minute if the value is set to 1 and then triggers the configured action and resets the value to 0. If triggering multiple times it is not an issue, I will get just one alert per minute but I can understand mine is a very peculiar requirement, this is why I'd rather change the default behavior to CHANGE.
-
@Sergio-Rius that's the point, I'm still trying to understand if changing the mode, the default is overridden which it is the case in my test, looks like not in yours :-/ Regarding my controller, it checks every minute if the value is set to 1 and then triggers the configured action and resets the value to 0. If triggering multiple times it is not an issue, I will get just one alert per minute but I can understand mine is a very peculiar requirement, this is why I'd rather change the default behavior to CHANGE.
@user2684 If you are stil looking for comments on whether the expected behavior is CHANGE or RISING, its CHANGE for my purposes. My motion sensor is set to reset after 5 minutes or so without motion, and I want that reported as well as the initial motion. So I needed to change the mode.
-
@user2684 If you are stil looking for comments on whether the expected behavior is CHANGE or RISING, its CHANGE for my purposes. My motion sensor is set to reset after 5 minutes or so without motion, and I want that reported as well as the initial motion. So I needed to change the mode.
@jaylove thanks, CHANGE has been made the default option indeed in v1.6-dev. Btw in case you can give it a try, it would be great (https://github.com/mysensors/NodeManager/tree/development) Thanks!