Patched webCoRE for Hubitat (2018/09/09)

It looks like Hue color bulbs aren’t being recognized correctly in WebCoRE. Any Idea what capabilities need to be set to?

Is there anyway for me to find out what each device has available so I can help you guys update this code?

What issue are you seeing with them? I don’t have any hue bulbs but added a virtual one and was able to see the commands related to it when selecting it in a piston.

You know. Let me double check this. It may be an issue with the group not the bulb. I was only seeing preset color of black and random.

I do see the lack of colors for the bulb. Hubitat doesn’t have a color util api like smart things. I’ll look at adding something in for that. Not sure on this but you should be able to set a color with a hex value as others did with the tiles issue above as a work around.

Has anyone else ran into problems where their pistons won’t open for editing? This has happened to me before and the only way I’ve been able to resolve it is to restore from a backup

Unfortunately I’ve found that Hubitat’s cloud url has a size limit on responses which after seems to throw a 502 error on their end. Using a small test app I’ve found this to be around 118Kb. With full logging enabled some of my larger pistons hit this limit when webcore needs to load the full instance data (devices and capabilities) along with the piston. Sometimes I can get around this by loading a smaller piston first so that the large instance data gets loaded along with it and then the other larger pistons will start to load.

Because of this limitation, I added two settings that let you run connect to a webcore instance on your local network. The first one you put the huburl and the second a url pointing to a local instance of webcore running on your network. I’m using a raspberry pi to host an apache web server pointing to the dashboard directory in the github repo. Below is my apache config to run the server on port 8082 where /var/www/webcore/ is a symlink to dashboard directory.

It’s a bit of work but it’s nice to have everything running on my local network.

webcore -> /home/pi/webCoRE/dashboard/

   <VirtualHost *:8082>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/webcore/

        <Directory "/var/www/webcore">
                AllowOverride All
        </Directory>

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
4 Likes

Hi @jp0550.
I really like the sound of webCoRE running on a RPi.
I am not a coder but can follow instructions fairly well.
Can I be really cheeky and ask you to put together a guide on how to do this.
I know it’s a bit of an ask but if you could it would be extremely useful for people like me. I’m sure there are others out there who would also appreciate this.
I fully understand if its too much of an ask.

2 Likes

Sure, follow this guide until you get to the php portion and then stop.

Make sure you have git installed.

sudo apt-get install git

Then open a bash window and run these commands

cd ~/
git clone https://github.com/jp0550/webCoRE
cd webCoRE
git checkout hubitat-patches
cd dashboard
sudo ln -s `pwd` /var/www/webcore

Now edit the following file to the following
/etc/apache2/sites-available/000-default.conf

   <VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/webcore/

        <Directory "/var/www/webcore">
                AllowOverride All
        </Directory>

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

Run the following commands

sudo a2enmod rewrite
sudo service apache2 restart

Use the url for your raspberry pi and it should now show you webcore

http://your-pi-ip

Go to the webcore settings on your hubitat and enable Custom urls.

In the first box put the http address of your hubitat

http://hubitat-ip

In the second box put the http address of your pi

http://pi-ip-address

Hit done and you should be see your local instance of webcore come up when you hit Dashboard on the settings page in hubitat.

I wrote most of this from memory so let me know if you get stuck on something.

6 Likes

Thanks for this @jp0550 . Hit a snag unfortunately.
When I input the above command I get permission denied.

pi@raspberrypi:~/webCoRE/dashboard $ /etc/apache2/sites-available/000-default.conf
bash: /etc/apache2/sites-available/000-default.conf: Permission denied

EDIT:
OK. Did the following.
cd /etc/apache2/sites-available/
Can now see 000-default.conf
I assume I now vi this and change to how you have said above.
EDIT2: Can vi the file but do not have permission to change it. It is owned by root. Do I ‘chown’ it to pi?

You can run

sudo vi /etc/apache2/sites-available/000-default.conf

OK. Managed to amend the file.
When I type in the ip address of my RPi after restarting the apache2 service I get the following.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.10 (Raspbian) Server at 192.168.0.21 Port 80

EDIT: I get this message when I restart the service.
Warning: Unit file of apache2.service changed on disk, ‘systemctl daemon-reload’ recommended.

The directory should read /var/www/webcore for both the document root and the directory tag. That directory is a symlink (file pointer) to the directory you checked out with git made with the command you ran earlier

sudo ln -s `pwd` /var/www/webcore

After editing the file you need to run the restart command again.

Your web directory should look similar to this

cd /var/www
ls -l

pi@pi3:/var/www $ ls -l
lrwxrwxrwx 1 www-data www-data   27 Mar 17 12:52 webcore -> /home/pi/webCoRE/dashboard/

Yeah. Realised my mistake.
Will start again.

I'm also having server 500 errors. I will say that I'm not on a pi, but running ubuntu. The apache and php were not pi specific. I received no errors at all doing the install, and this is my screen capture, and it looks the same.

BTW, this is great, thanks for the work and your patience.

webcorelocal

Can you post the contents of your /var/log/apache2/error.log?

[Wed Apr 11 17:40:50.868246 2018] [mpm_event:notice] [pid 2178:tid 140434742282112] AH00489: Apache/2.4.18 (Ubuntu) configured – resuming normal operations
[Wed Apr 11 17:40:50.868353 2018] [core:notice] [pid 2178:tid 140434742282112] AH00094: Command line: ‘/usr/sbin/apache2’
[Wed Apr 11 17:43:20.523400 2018] [mpm_event:notice] [pid 2178:tid 140434742282112] AH00491: caught SIGTERM, shutting down
[Wed Apr 11 17:43:21.624310 2018] [mpm_prefork:notice] [pid 8474] AH00163: Apache/2.4.18 (Ubuntu) configured – resuming normal operations
[Wed Apr 11 17:43:21.624439 2018] [core:notice] [pid 8474] AH00094: Command line: ‘/usr/sbin/apache2’
[Wed Apr 11 17:43:21.995074 2018] [mpm_prefork:notice] [pid 8474] AH00169: caught SIGTERM, shutting down
[Wed Apr 11 17:43:23.133900 2018] [mpm_prefork:notice] [pid 8581] AH00163: Apache/2.4.18 (Ubuntu) configured – resuming normal operations
[Wed Apr 11 17:43:23.133957 2018] [core:notice] [pid 8581] AH00094: Command line: ‘/usr/sbin/apache2’
[Wed Apr 11 17:47:40.463130 2018] [mpm_prefork:notice] [pid 8581] AH00169: caught SIGTERM, shutting down
[Wed Apr 11 17:47:41.589652 2018] [mpm_prefork:notice] [pid 8685] AH00163: Apache/2.4.18 (Ubuntu) configured – resuming normal operations
[Wed Apr 11 17:47:41.589709 2018] [core:notice] [pid 8685] AH00094: Command line: ‘/usr/sbin/apache2’
[Wed Apr 11 17:47:52.883751 2018] [core:alert] [pid 8688] [client 192.168.1.10:58808] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:47:56.483842 2018] [core:alert] [pid 8689] [client 192.168.1.10:58809] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:48:14.718147 2018] [core:alert] [pid 8691] [client 192.168.1.10:58828] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:48:17.672047 2018] [core:alert] [pid 8692] [client 192.168.1.10:58829] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:48:26.130888 2018] [core:alert] [pid 8688] [client 192.168.1.10:58833] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:49:30.959614 2018] [core:alert] [pid 8689] [client 192.168.1.10:58933] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:50:12.959327 2018] [core:alert] [pid 8690] [client 192.168.1.10:58942] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:50:44.281302 2018] [core:alert] [pid 8691] [client 192.168.1.10:59009] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:52:05.028865 2018] [core:alert] [pid 8692] [client 192.168.1.10:59090] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:52:34.201011 2018] [core:alert] [pid 8688] [client 192.168.1.10:59141] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:52:43.855961 2018] [mpm_prefork:notice] [pid 8685] AH00169: caught SIGTERM, shutting down
[Wed Apr 11 17:52:44.983285 2018] [mpm_prefork:notice] [pid 8760] AH00163: Apache/2.4.18 (Ubuntu) configured – resuming normal operations
[Wed Apr 11 17:52:44.983343 2018] [core:notice] [pid 8760] AH00094: Command line: ‘/usr/sbin/apache2’
[Wed Apr 11 17:52:49.423408 2018] [core:alert] [pid 8763] [client 192.168.1.10:59150] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
[Wed Apr 11 17:54:58.086854 2018] [mpm_prefork:notice] [pid 8760] AH00169: caught SIGTERM, shutting down
[Wed Apr 11 17:54:59.224280 2018] [mpm_prefork:notice] [pid 8823] AH00163: Apache/2.4.18 (Ubuntu) configured – resuming normal operations
[Wed Apr 11 17:54:59.224332 2018] [core:notice] [pid 8823] AH00094: Command line: ‘/usr/sbin/apache2’
[Wed Apr 11 17:55:03.962800 2018] [core:alert] [pid 8826] [client 192.168.1.10:59262] /var/www/webcore/.htaccess: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration

Can you run this

sudo a2enmod rewrite
sudo service apache2 restart

Incredible! Thanks, came right up! For my knowledge, what was “a2enmod” If its too much to say, just let me know, I’m happy to google as well. :slight_smile:

It’s for the URL RewriteModule.
Webcore only has one real page, but you’ll see paths like ip/piston/pistonid or ip/settings in webcore.

The rewrite module will redirect all the paths back to the main page

Came up, saw my pistons, but when I click to edit, it’s just spinning. Getting close though

Download the Hubitat app