bytedeez Posted July 25, 2015 Share Posted July 25, 2015 I recently purchased a Pi and through together a small home automation system using 433mhz wireless light sockets and using some code I found herehttps://github.com/xillwillx/433Mhz which uses modified code from the ninja blocks project. The issue I am having is the WebUI doesn't save the state of the lights across all devices. Meaning of I turn a light on using my phone and then open the webUI from tablet, it will show that the light is off, even though the light us actually on. Does anyone know how to correct this issue or better code to fit my needs? Quote Link to comment Share on other sites More sharing options...
cooper Posted July 26, 2015 Share Posted July 26, 2015 What you're saying is actually that the WebUI *does* save the state for all devices, which is why it isn't aware that you changed the state of a device in a different manner. So the question now becomes: Can the Ninja Blocks project's code query the state of a device such that it's able to (with a slight delay) discover that the state of a device was changed by something else and adjust accordingly? Quote Link to comment Share on other sites More sharing options...
bytedeez Posted July 28, 2015 Author Share Posted July 28, 2015 (edited) Yes, in less technical words. but also I want to know if anyone has better code they use. The community's input is desires. Edited July 28, 2015 by bytedeez Quote Link to comment Share on other sites More sharing options...
cooper Posted July 28, 2015 Share Posted July 28, 2015 I clicked on from the project page to that of Ninja Blocks and on their page they end with an "Issues" chapter that reads: Due to limitiations in the implementation of interrupt-driven routines in the underlying RCSwitch library, it is currently not possible to use both the send and receive functionality within the one program. That's the reason you can't query the state of a device and, thus, discover if a device is on or not. So whatever you find, that library needs to be either fixed or replaced to get where you want to be. Quote Link to comment Share on other sites More sharing options...
bytedeez Posted July 30, 2015 Author Share Posted July 30, 2015 I get what your saying. but here's my question would really need to query the state of the device because I am really a amateur when it comes to this and code in general but I don't believe query the state of the device is possible without modifying the cheap 433mhz socket. Wouldn't it make more sense to modify the code to remember the last action made on the WebUI? Quote Link to comment Share on other sites More sharing options...
digip Posted July 30, 2015 Share Posted July 30, 2015 don't leave it to the module to be queried, you could write a small satabase to check the value, or less, just a text file to keep a value in and read on page load, so regardless of what device, as they refresh the page, it gets the state. Use sockets or ajax, and it can update in real time, so if on one device you change the state, the other, will see it update. Little php, ajax and json fu, and you should be able to accomplish it to make it update in real time. Quote Link to comment Share on other sites More sharing options...
cooper Posted July 30, 2015 Share Posted July 30, 2015 Wouldn't it make more sense to modify the code to remember the last action made on the WebUI? It wouldn't because: 1) Given your description of the behaviour it already does remember the previous state (either that or it defaults to everything off) 2) It's not the only means by which you can change the state of the device, meaning that whatever state you retain can never be trusted to be correct. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.