Jump to content

Home automation- light state across all devices.


bytedeez
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...