New PHP Web Interface

  • 363 Views
  • Last Post 11 March 2016
Axial-User posted this 10 October 2014

I am working on an inControl web interface written in PHP with jquery. It is dynamic HTML using ajax, and is intended to eventually be a functional clone of the inControl widows interface.

There is a screenshot here, with the a thermostat device selected: http://snag.gy/8I4of.jpg

The source is on GitHub : https://github.com/ahagadorn/incontrol-web

Take a look at the README.md, all you have to do is get the zip file, unzip it on your web server and change the config.php. No other software besides PHP is required, and it does not use a database.

Please give it a try and let me know here if you find any bugs. I will be working on many enhancements, this is just the beginning of what I plan to do with it. I have found it to be very stable and useful to me anyway, hopefully others will find it useful too.

Order By: Standard | Newest | Votes
monkey-magic posted this 12 October 2014

I'll give it a go if it can turn on individual devices.

Just have to get a VM setup.

josh

Axial-User posted this 12 October 2014

It generally works just like the standard interface, except instead of having power buttons for on/off you click on the device icon.

Let me know here if you have any issues.

Axial-User posted this 12 October 2014

I just committed an update that groups devices by room, if you already got it, just grab functions.php and styles.css. I have not updated the screenshot yet.

ftsikogi posted this 17 October 2014

  1. I have installed the WinLAMP mini installation
    http://winlamp.sourceforge.net/?module=download
    2. I have decompressed the source code
    3. And configured the config file.

    The result is that the page loads with no errors and with tab name showing "incontrol", but the rest of the page is empty.

    Any ideas?

    I am using the 3.114 version of Incontrol

Axial-User posted this 17 October 2014

Most likely it is a PHP problem. Check your web server error log, and there is also a log for the app called api_error.log.

monkey-magic posted this 17 October 2014

Seems to work pretty well so far. Only issue I've hit is that for lights it can turn off the light but doesn't seem to turn them on.

When the toggle is pressed inControl changes to powered but after a few seconds it switches back to off.

Are you thinking of adding scenes in at some stage in the future?

@ftsikogi
for the IP address of inControl, are you using local host or IP address? there is no http:// in it, just 192.168.xx.xx
Picked that up looking at the logs.

Josh

Axial-User posted this 18 October 2014

When you switch something, it should show the status from InControl within 5 seconds. It may depend on how short your InControl polling interval is set for. Mine is set for 5 seconds.

I already have scenes working in the next version, I just haven't uploaded it to GitHub yet. It also shows rooms now.

monkey-magic posted this 18 October 2014

Incontrol does show the status change but the lights don't go on. After a few seconds it updated back to off (since they didn't turn on) and the the welfare updates as well if that makes sense.
Josh

Axial-User posted this 18 October 2014

That is really strange, it works perfectly for me, I have been using it regularly. Just to clarify, are you saying that InControl shows the change temporarily, but the light doesn't come on and then the status changes back to off? Are you using a Z-Stick? Lights work correctly from InControl?

monkey-magic posted this 18 October 2014

Correct.

Web Off - InControl Off - Light Off

Web On - InControl On - Light Off
Couple of seconds
Web Off - Incontrol Off - Light still Off.

Josh

Ryan-Scott posted this 18 October 2014

Correct.

Web Off - InControl Off - Light Off

Web On - InControl On - Light Off
Couple of seconds
Web Off - Incontrol Off - Light still Off.

Josh


So it seems like the web is telling InControl to to turn the light on, but the z-wave signal isn't making it out to the light?

@ahagadorn: how are you sending a power on/off command to InControl?

@Josh: Does the light turn on/off OK if you use the native GUI? If you audit that light, do you get any logs in your logfile.txt suggesting it attempted to turn on/off?

Axial-User posted this 18 October 2014

You are running it on Linux, right? It sounds like an older version of functions.php.

I just uploaded the lates version with scene support to GitHub. You can grab the whole thing using the "Download ZIP" button on the lower right. You can just unzip it in your web directory, the only file you need to retain is your config.php, and that is now config.php.sample in the distribution with instructions on renaming it in the README.md for new installations. Let me know if that fixes it, I am still a little new at GitHub.

And thanks for trying it, I need to get your issue fixed.

Andy

Axial-User posted this 18 October 2014

Ryan,

This is snipped right out of the code - it works perfectly every time for me. powered is true for any on level, false for off.

[code]setDeviceState?nodeId=".$id."&powered=" . $powered . "&level=".$level."&password=".$pass;[/code]

Josh, you are not by chance double-clicking the icon, are you? Dumb question I know, but it will cause what you describe. Single click is what it expects. <- this="" turns="" out="" to="" be="" false,="" it="" works="" fine="" either="" way,="" single="" click="" or="">

Andy

Axial-User posted this 18 October 2014

Here's a couple screenshots of the latest version

http://snag.gy/plcoc.jpg

http://snag.gy/A3JNP.jpg

Axial-User posted this 18 October 2014

Hey Josh - what browser are you using?

monkey-magic posted this 19 October 2014

Hey thanks for doing this, I like the individual activation of devices. It was the main drawback of the other one that was there for a bit.

Light turns on and off okay with InControl's GUI.

Turns off okay with the webpage but not on.
InControl GUI shows that it registers the command from the webpage as the Power Icon lights up but after a second or two it turns off again and the webpages updates back to off.
Running Chrome but have also tried on IE.
have restarted both VMs, the Windows running InControl and Ubuntu 14.04.1 Server running LAMP stack.
Not double clicking.

The log file does sometimes show, but not always:
: Properties requested for device xxxxxxx (Which is the correct light)
: Found device: yes

Hope that helps but I'm not sure what is happening.

Josh

ftsikogi posted this 19 October 2014

Most likely it is a PHP problem. Check your web server error log, and there is also a log for the app called apierror.log.


I tried to reinstall PHP and apache but with the same results.
The only error I can find from the PHP log is the following:
PHP Notice: Undefined index: visible in C:\xampp\htdocs\functions.php on line 53

api
error.log is empty.

Any ideas?

Thanks

Axial-User posted this 19 October 2014

Most likely it is a PHP problem. Check your web server error log, and there is also a log for the app called apierror.log.

I tried to reinstall PHP and apache but with the same results.
The only error I can find from the PHP log is the following:
PHP Notice: Undefined index: visible in C:\xampp\htdocs\functions.php on line 53

api
error.log is empty.

Any ideas?

Thanks



Is it completely blank, or do you see two grey boxes? PHP Notice can be ignored, if you get PHP Error, that's a problem. Ar there any errors in the Apache error_log?

Axial-User posted this 19 October 2014

Josh,

What kind of device is it? Do you have more than one device and they all act the same way? Do you have a thermostat, and have you tried that?

I am running on Debian, which is the same as Ubuntu. I'm sure we will figure it out, but right now I am stumped. You don't get a question mark for an icon, do you?

One thing to try is if it is defined as a StandardSwitch in IC, change it to DimmerSwitch, or vice-versa. See if that makes it work.

Andy

ftsikogi posted this 19 October 2014

Most likely it is a PHP problem. Check your web server error log, and there is also a log for the app called apierror.log.

I tried to reinstall PHP and apache but with the same results.
The only error I can find from the PHP log is the following:
PHP Notice: Undefined index: visible in C:\xampp\htdocs\functions.php on line 53

api
error.log is empty.

Any ideas?

Thanks



Is it completely blank, or do you see two grey boxes? PHP Notice can be ignored, if you get PHP Error, that's a problem. Ar there any errors in the Apache errorlog?


There are no errors in the Apache error
_log. I can see the two grey boxes.

Axial-User posted this 19 October 2014

There are no errors in the Apache error__log. I can see the two grey boxes.


OK, that's good, it means there is a Javascript problem. Make sure Javascript is enabled in your browser, and if it is, check the Javascript Console in your browser for errors.

Andy

ftsikogi posted this 19 October 2014

There are no errors in the Apache error__log. I can see the two grey boxes.

OK, that's good, it means there is a Javascript problem. Make sure Javascript is enabled in your browser, and if it is, check the Javascript Console in your browser for errors.

Andy


I just installed your latest build from github. Now i am able to see 2 links (devices,scenes) and the 2 grey boxes. When i click on devices i get nothing. When i click on scenes i get the list of my scenes with the activate button but with no photos or icons. The layout of the page is not like the one you have on the screenshot.

By clicking on devices i get the following error:

line 61 syntax error

Thanks

Axial-User posted this 19 October 2014

I just installed your latest build from github. Now i am able to see 2 links (devices,scenes) and the 2 grey boxes. When i click on devices i get nothing. When i click on scenes i get the list of my scenes with the activate button but with no photos or icons. The layout of the page is not like the one you have on the screenshot.

By clicking on devices i get the following error:

line 61 syntax error

Thanks


That still indicates a Javascript problem. Go to http:///index.php?action=get_devices and let me know what you get. You are running on Windows, right?

Thanks,
Andy

ftsikogi posted this 19 October 2014

I just installed your latest build from github. Now i am able to see 2 links (devices,scenes) and the 2 grey boxes. When i click on devices i get nothing. When i click on scenes i get the list of my scenes with the activate button but with no photos or icons. The layout of the page is not like the one you have on the screenshot.

By clicking on devices i get the following error:

line 61 syntax error

Thanks


That still indicates a Javascript problem. Go to http:///index.php?action=get_devices and let me know what you get. You are running on Windows, right?

Thanks,
Andy


This is what i get:

Notice: Undefined index: curDev in C:\xampp\htdocs\functions.php on line 43

Notice: Undefined index: visible in C:\xampp\htdocs\functions.php on line 69

Yes i am running on Windows

Axial-User posted this 19 October 2014

I just installed your latest build from github. Now i am able to see 2 links (devices,scenes) and the 2 grey boxes. When i click on devices i get nothing. When i click on scenes i get the list of my scenes with the activate button but with no photos or icons. The layout of the page is not like the one you have on the screenshot.

By clicking on devices i get the following error:

line 61 syntax error

Thanks


That still indicates a Javascript problem. Go to http:///index.php?action=getdevices and let me know what you get. You are running on Windows, right?

Thanks,
Andy

This is what i get:

Notice: Undefined index: curDev in C:\xampp\htdocs\functions.php on line 43

Notice: Undefined index: visible in C:\xampp\htdocs\functions.php on line 69

Yes i am running on Windows


Did you try the get
devices (not just action=devices, action=get_devices) URL I mentioned above?

ftsikogi posted this 19 October 2014

I just installed your latest build from github. Now i am able to see 2 links (devices,scenes) and the 2 grey boxes. When i click on devices i get nothing. When i click on scenes i get the list of my scenes with the activate button but with no photos or icons. The layout of the page is not like the one you have on the screenshot.

By clicking on devices i get the following error:

line 61 syntax error

Thanks


That still indicates a Javascript problem. Go to http:///index.php?action=getdevices and let me know what you get. You are running on Windows, right?

Thanks,
Andy

This is what i get:

Notice: Undefined index: curDev in C:\xampp\htdocs\functions.php on line 43

Notice: Undefined index: visible in C:\xampp\htdocs\functions.php on line 69

Yes i am running on Windows

Did you try the get
devices (not just action=devices, action=get_devices) URL I mentioned above?


Yes i did.

Axial-User posted this 19 October 2014

Please grab the latest version from GitHub. Let me know if that fixes it, or at least gives you different errors. Thanks for helping out, I don't have a Windows box set up to test.

Andy

ftsikogi posted this 19 October 2014

Please grab the latest version from GitHub. Let me know if that fixes it, or at least gives you different errors. Thanks for helping out, I don't have a Windows box set up to test.

Andy


When i select devices i still get nothing
When i click on scenes i get the following error:
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\functions.php on line 383

"http://192.168.1.4/index.php?action=getdevices" gives the following error:

Warning: filegetcontents(http://:/zwave/devices?password=): failed to open stream: operation failed in C:\xampp\htdocs\functions.php on line 47

Thanks

Axial-User posted this 19 October 2014

Please grab the latest version from GitHub. Let me know if that fixes it, or at least gives you different errors. Thanks for helping out, I don't have a Windows box set up to test.

Andy

When i select devices i still get nothing
When i click on scenes i get the following error:
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\functions.php on line 383

"http://192.168.1.4/index.php?action=getdevices" gives the following error:

Warning: filegetcontents(http://:/zwave/devices?password=): failed to open stream: operation failed in C:\xampp\htdocs\functions.php on line 47

Thanks


OK, good! Make sure you have the correct data in config.php. If you only have config.php.sample, rename it to config.php and change it to show your InControl server IP, port, and password. These can be found in the InControl GUI under Tools -> Options on the Server tab, you want the Web API port.

Andy

ftsikogi posted this 19 October 2014

Everything is working now! Thank you!
Only "issue" is that on IE when you select scenes page layout is not the correct one. On chrome is OK
On chrome running on android is fine too.
Thanks

Axial-User posted this 19 October 2014

Everything is working now! Thank you!
Only "issue" is that on IE when you select scenes page layout is not the correct one. On chrome is OK
On chrome running on android is fine too.
Thanks


Excellent! I will fix the IE issue, please don't hesitate to let me know about anything that isn't right.

Andy

Axial-User posted this 19 October 2014

Grab styles.css from GitHub and see if that helps. I hate IE.

monkey-magic posted this 19 October 2014

I have aeon multi switches.
I didn't try changing them to dimmers but I do have a dimmer module and that worked fine turning on and off. It appears to be just the switches.

Also with my scenes page it is empty.

/index.php?action=scenes
Chrome shows blank
IE shows error.

Josh

ftsikogi posted this 19 October 2014

Grab styles.css from GitHub and see if that helps. I hate IE.


I hate it also. While playing around i now have a more clear "picture".

Page layout and functionality is fine on IE, on chrome running on android devices and on stock android browser.
Functionality is also fine on Chrome, but page layout is not what it should be although you can use it with no issues.

Screenshots

http://snag.gy/HNRu5.jpg

http://snag.gy/FPvvo.jpg

Axial-User posted this 19 October 2014

I have aeon multi switches.
I didn't try changing them to dimmers but I do have a dimmer module and that worked fine turning on and off. It appears to be just the switches.


Line 217 in functions.php looks like this:

[code]... $dev['level'] . ',255,255) ...[/code]

Try changing the FIRST 255 to 99 and let me know if that fixes it.

Also with my scenes page it is empty.

/index.php?action=scenes
Chrome shows blank
IE shows error.

Josh


What is the error that IE shows?

Axial-User posted this 19 October 2014

Grab styles.css from GitHub and see if that helps. I hate IE.

I hate it also. While playing around i now have a more clear "picture".

Page layout and functionality is fine on IE, on chrome running on android devices and on stock android browser.
Functionality is also fine on Chrome, but page layout is not what it should be although you can use it with no issues.

Screenshots

http://snag.gy/HNRu5.jpg

http://snag.gy/FPvvo.jpg


Wow, that's ugly. I suspect you need to clear your cache.

monkey-magic posted this 20 October 2014

I have aeon multi switches.
I didn't try changing them to dimmers but I do have a dimmer module and that worked fine turning on and off. It appears to be just the switches.

Line 217 in functions.php looks like this:

[code]... $dev['level'] . ',255,255) ...[/code]

Try changing the FIRST 255 to 99 and let me know if that fixes it.


Changing to 99 didn't work. It sets the device to 99 on the webpage but doesn't change the InControl GUI. 255 does change the IC GUI.

The only thing I've just noticed is on the RHS for all of the swithces it shows the Node Id as 0.
All the power points and dimmers have Node numbers.

Maybe that is the issue?


What is the error that IE shows?


IE shows HTTP 500 Internals Server Error, website cannot display the page.

Thanks Josh

ftsikogi posted this 20 October 2014

Grab styles.css from GitHub and see if that helps. I hate IE.

I hate it also. While playing around i now have a more clear "picture".

Page layout and functionality is fine on IE, on chrome running on android devices and on stock android browser.
Functionality is also fine on Chrome, but page layout is not what it should be although you can use it with no issues.

Screenshots

http://snag.gy/HNRu5.jpg

http://snag.gy/FPvvo.jpg

Wow, that's ugly. I suspect you need to clear your cache.


You were right I forgot to clear history. It works perfectly now. Thank you again for your time.

Axial-User posted this 20 October 2014

What is the error that IE shows?

IE shows HTTP 500 Internals Server Error, website cannot display the page.

Thanks Josh



Josh,

Most likely, the log file api_error.log is not writable by the web server user which should be either apache or www-data. If you want to pull down the latest version, it should tell you that instead of throwing the error.

If you could please go to http://:/zwave/devices?password= and email me the output I should be able to fix the problem with the aeon devices. My email is ahagadornvistatechnologygroup.com.

Andy

monkey-magic posted this 21 October 2014

What is the error that IE shows?

IE shows HTTP 500 Internals Server Error, website cannot display the page.

Thanks Josh



Josh,

Most likely, the log file api_error.log is not writable by the web server user which should be either apache or www-data. If you want to pull down the latest version, it should tell you that instead of throwing the error.

If you could please go to http://:/zwave/devices?password= and email me the output I should be able to fix the problem with the aeon devices. My email is ahagadornvistatechnologygroup.com.

Andy


I've emailed two devices to you so hopefully that helps.

Also api.error.log, I've updated from github and still empty scenes. I've also chown and chmod to rwx for all and nobody:nogroup and still the same. Is that what you were after?

thanks Josh

Axial-User posted this 22 October 2014

There is a new version available at GitHub that has some enhancements and bug fixes.

I have been working with Josh to get his Multi-Switches working, and he has been a tremendous help in general. I will let everyone know when we have it worked out. As far as I know, all other device types work fine, including thermostats.

Andy

ftsikogi posted this 23 October 2014

There is a new version available at GitHub that has some enhancements and bug fixes.

I have been working with Josh to get his Multi-Switches working, and he has been a tremendous help in general. I will let everyone know when we have it worked out. As far as I know, all other device types work fine, including thermostats.

Andy


Tried the new version but it throws the following error:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\functions.php on line 559

I switched back to your previous version and everything got back to normal.

Andy,

Are you interested in adding Foscam or any other IP cameras to your interface? It would be nice if we could see live feed from our cameras by selecting the device. Currently the device is shown but with no video.
Thank you again for your time
Filippos

Axial-User posted this 23 October 2014

Tried the new version but it throws the following error:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\functions.php on line 559

I switched back to your previous version and everything got back to normal.

Andy,

Are you interested in adding Foscam or any other IP cameras to your interface? It would be nice if we could see live feed from our cameras by selecting the device. Currently the device is shown but with no video.
Thank you again for your time
Filippos


That error should be fixed.

Yes, I have a bunch of IP cameras myself, I will add that and more once I get the basic stuff stable.

Axial-User posted this 24 October 2014

The issue with the Aeon multiSwitch has been resolved (Thanks Josh!)

I have switched from using a PHP configuration file to a INI style to make it easier to change options. In the latest version it will tell you how to convert if you are doing an upgrade.

Please give the latest version a try. I am working on more enhancements, including camera support.

Andy

ftsikogi posted this 24 October 2014

The issue with the Aeon multiSwitch has been resolved (Thanks Josh!)

I have switched from using a PHP configuration file to a INI style to make it easier to change options. In the latest version it will tell you how to convert if you are doing an upgrade.

Please give the latest version a try. I am working on more enhancements, including camera support.

Andy


Andy,

It is working just fine

Thank you

Axial-User posted this 24 October 2014

The issue with the Aeon multiSwitch has been resolved (Thanks Josh!)

I have switched from using a PHP configuration file to a INI style to make it easier to change options. In the latest version it will tell you how to convert if you are doing an upgrade.

Please give the latest version a try. I am working on more enhancements, including camera support.

Andy

Andy,

It is working just fine

Thank you


Thank you for your help Filippos. Do you have any issues with setting dim level?

ftsikogi posted this 24 October 2014

The issue with the Aeon multiSwitch has been resolved (Thanks Josh!)

I have switched from using a PHP configuration file to a INI style to make it easier to change options. In the latest version it will tell you how to convert if you are doing an upgrade.

Please give the latest version a try. I am working on more enhancements, including camera support.

Andy

Andy,

It is working just fine

Thank you

Thank you for your help Filippos. Do you have any issues with setting dim level?


No issues. From a PC browser it works flawlessly. From a touch device (tablet,smartphone) it is more difficult to achieve the desired dim level but it is manageable though.

monkey-magic posted this 24 October 2014

Thanks for everything.

All working well now. The multi switches and the dimmers all work as they should.

Thanks Josh

Axial-User posted this 24 October 2014

Josh and Filippos, thank you for your help and patience. I think the basics are working fine now, so I can concentrate on enhancements.

I will be adding a security login screen soon, along with cameras. I already added a room filter, but have not uploaded the changes yet. The room filter is great if you have a lot of devices like I do.

Andy

ftsikogi posted this 25 October 2014

Andy,

I did notice that when you select a device, the last changed timestamp shows a default value (01/01/1970).

Thank you very much.

Axial-User posted this 25 October 2014

Andy,

I did notice that when you select a device, the last changed timestamp shows a default value (01/01/1970).

Thank you very much.


That's interesting, it works fine for me - it could be an issue on Windows. When I get time, I will try it on windows.

sundansx posted this 11 March 2016

ahagadorn,
Are you still working on this web interface? have you abandoned it for Ryan's webserver? I am trying to add a schlage deadbolt to it and I am not sure what parameter I would use to figure out if the lock is closed or open. Any experience or ideas? thanks

Close