Over the last 2 weeks I have been working on interacting with the LightwaveRF hardware and creating a middle layer for our system.
Initially I used what I could gather from the internet for the API since it is not open. This allowed me to interact with the hardware well enough but I came across the problem of not being able to get the state of the hardware which is a problem when a user changes the state manually (e.g. turning a light off at the wall). Because of this I applied for API access but unfortunately when the official documentation came through it turned out there was nothing new and there is no way to get the state like this.
My next thought was to “force” the state to be correct by sending a command for that state each time the state should be checked. For example, if the system thinks a light should be turned off then it continuously send the command to turn the light off. This seemed like a good idea at the time but for now I have disabled it since it seems a bit intrusive and forces the user to use our system which is not good.
Lastly, I also encountered a problem with reading the energy usage. For some reason, the system was correctly reading the energy usage but it was being immediately changed and incorrectly read afterwards. It turned out that this was something to do with the debug mode in Flask and I think it is a concurrency issue. Disabling debug mode means that the software works as intended.
For now, all our sensor readings are binary which is a bit of a problem for sensors such as the energy monitor and light sensor. This means that the energy usage is just being displayed as “High” or “Low” in the UI but we will be taking care of continuous data in the coming weeks.