Patched webCoRE for Hubitat (2018/09/09)

Does sending sms work? I tried it but i’m not receiving anything.

I have the latest patched version of WebCore running on Hubitat. All works well except “waits”. Most of the time when I try to use a wait, especially a short wait - like 10s or less the Piston gets hung up on the wait and counts down then resets and counts down over and over again. Anyone have an idea of what is going on?

Post your piston but I wouldn’t mind betting you need to change your WITH TCP to never.

I have identified one other potential bug with the patched version - when subscribing to a Global Variable, there is an error in the log and none of the subscriptions to Global Variables work. Here is the error in the log.

+453ms ║║Subscribing to Ashburn Home 2.:7c76bcf13f4437d56396ddf04776b595:.@DimmingLevel...

Did you figure this out? I'm trying a piston that sends a maker event and I get this error:

Failed to send IFTTT event, because the IFTTT integration is not properly set up. Please visit Settings in your dashboard and configure the IFTTT integration.

In IFTTT, a test DO app that turns a Hubitat light on & off works. Does this look like a Hubitat problem - either mine or the HE/IFTTT integration - or a webCoRE incompatibility?

1 Like

Building on @jp0550's idea, given below are the details to run webCoRE off a Docker container that can be installed on any device that can run Docker (current image supports x86/AMD64 only). The commands are specific to Linux shells but the equivalent commands, run on any platform should achieve similar results.
BTW, I too have written this out of my memory of how I set my server up and would appreciate any feedback that I can get, about what I may have missed or mentioned incorrectly.

  1. Ensure that you have the appropriate version of Docker, Docker-Compose & Git installed and working, for your choice of server (Raspberry Pi, NAS, Laptop etc.). This page could serve as a starting point...
    https://docs.docker.com/install/

  2. Navigate to a directory of your choice, where you would want to setup the Docker containers and the webCoRE UI files (Assuming the home directory for the case of this tutorial)

cd ~/
sudo mkdir -p docker/webcore-local/www
cd docker/webcore-local/www
sudo git clone https://github.com/ajayjohn/webCoRE
cd webCoRE
sudo git checkout hubitat-patches
cd ../../../
  1. Navigate to a directory of your choice, where you would want to setup the Docker container (Assuming the home directory for the case of this tutorial), and create a file called 'docker-compose.yaml' with the following contents...
portainer:
    container_name: portainer
    image: "portainer/portainer"
    restart: always
    volumes:
        - <path to where you are running this script from>/portainer:/data
        - /etc/localtime:/etc/localtime:ro
        - /var/run/docker.sock:/var/run/docker.sock
    ports:
        - 9000:9000
    net: host

webcore-local:
    container_name: webcore-local
    image: "antage/apache2-php5"
    restart: on-failure
    volumes:
        - <path to where you are running this script from>/webcore-local/www:/var/www
        - <path to where you are running this script from>/webcore-local/logs:/var/log/apache2
    ports:
        - 8080:8080
    environment:
        - APACHE_ALLOW_OVERRIDE="All"
        - APACHE_MODS
        - PHP_MODS
        - PHP_SMTP="<any dummy domain string e.g. notareal.domain.com>"
        - PHP_SMTP_FROM="<any dummy email address e.g. notareal@emailaddress.com>"
    net: host
  1. Run the fillowing command to create the necessary containers. This may take a few minutes depending on your internet speed. Do ensure that you atleast have 5-10 gb of space on your disk.
    sudo docker-compose up -d

  2. Once the docker containers are successfully created, access http://:9000 to view the Portainer UI. If you continue with the default values in the wizard, you will land on the Dashboard page where you can see both the Portainer and the webcore-local containers now running. Click on the webcore-local container and then click on Console. On the console page, click on Connect (No values need to be changed). Once you see the command prompt in your browser, enter the following commands...

cd /var/www/webCoRE/dashboard
ln -s `pwd` /var/www/html
a2enmod mime
  1. Now from within the same command prompt in the browser, 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/html/

        <Directory "/var/www/html">
                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>

Return to the Dashboard page on Portainer and restart the webcore-local container
Now, proceed with setting up the local endpoints on your Hubitat webCoRE settings page...
Custom hub url: http://<hubitat-ip>
Custom webcore instance url: http://<webcore-local-server-ip>:8080

You can even run a periodic cron job or a script to execute the following command on your server, to keep your copy of the webcore UI files updated

cd <path to your docker folder from step 2>/webcore-local/www && git pull

3 Likes

A little bit of a noob here, but i can’t seem to get the external URL to work. Where do i put in the access token. I tried the below but did not work:-

https://cloud.hubitat.com/api/dcxxxxxx-yyyy-xxxx-zzzz-53d6edd092d8/apps/21/execute/:3e28ed7feff2e4c3ce2edc9fe72ab4d7:&access_token={access_token}

Can you please help?

Try changing the “&” to a “?”

Thanks. That worked.

However, I get the result is ok and the timestamp, however the respective piston in webcore doesn’t seem to be doing anything. How do i get this to work? or is it even possible at this time?

Is anyone having trouble with global variables. I have created an identical piston that I use with ST that takes a lux value and makes a global boolean variable true or false.
Works with ST but fails with HE.
It just doesn’t run for some reason.

I have an issue with LANnouncer. It may not be the fault of HE/webCoRE, but it doesn’t manifest itself on ST. Simply, LANnouncer balks at a phrase with a space in it, e.g. “test test”. Logs show “illegal character”. It’s easily addressed by putting in a dummy character (I use a comma) but that’s not ideal.

I’m unqualified to speculate, but maybe HE sends a different ascii character for a space than ST does?

P.S. @bobbles I’m using global vars without issue.

Yes, I have also found Hubitat does not like spaces. I have replaced space characters with “%20” (ASCII code for a space) to get things to behave. Not sure if that will work for your situation though.

That works. Thanks.

1 Like

Well i tried this process but now im stuck at step 5. I try to fill in the endpoint url but it cant find it. I just fill in my serverip with port 2375. But it's unable to find it. Any clues?

@mjw-tan I use a non-standard port too.
Can you access the http://<webcore-local-server-ip>:2375 normally via your browser?
I hope you haven’t added a trailing slash after your port either.

Lastly, is your webcore local installation at the root of your web-server or within a sub-directory?
Ideally it shouldn’t matter, but I did find issues with sub-directories and mod-rewrite.

my webcore dashboard now refuses to load. Tried clearing cache but still getting error when loading the dashboard. Anybody knows how to fix it?

Really trying to avoid uninstalling and reinstalling it as i have quite a few pistons in there already.

rebooted the hub and was able to get on to the dashboard. However, can’t open any Pistons :frowning:

Update: created a new piston and now seems to be working again…

Can't acces it and i just did it in the root. It refuses the connection.

Found it, just had to use the local version haha

But getting the next error when trying to start the container.
standard_init_linux.go:190: exec user process caused "exec format error",

@jp0550, made it all the way through your instructions. whew! Now when I go to the browser (both on the rpi or another on the same network and put in my IP address, I get 403 Forbidden. I’ve doubled checked my IP address but not having any luck. Any ideas?

Thanks

Have you checked your permissions recently? I’ve had mine revert back on occasion.