Patched webCoRE for Hubitat (2018/09/09)

I use it all the time. Just select "Action" -> physical device -> "your pushover device" and select the "notification" command. Works a treat.

Just want to add that I was getting mixed up on the Z-Wave ID vs the system ID of the device. I thought that the comments around the "Home" device were referencing the Z-Wave ID and not that Hubitat uses a 1 for the ID of the first device added.

If you see something like this, then know that you are running into that device issue and the current workaround is to completely remove the device from Hubitat then add it back so it gets a new ID. You can check this by clicking on the device and looking for "/device/edit/1" in the URL.

image

Does Fuel Streams work with HE?

I just tested it and the command “writeToFuelStream” executes (as seen in the HE Log) but I see nothing in the Fuel Streams page.

Is there something I need to do before I can use Fuel Stream?

No luck. Spent 6 hours on it today, can’t figure it out and giving up. Maybe someone will post here on what to do. Looks like it’s all related to Rewrite in Apache but not strong enough in Apache/web design to figure it out. Looks like it takes about 5 minutes to setup on the RasPi, no idea when it’s so complicated to get running on Ubuntu; permissions are 777 across the board

Ok so I found the code that needs to be updated to make Fuel Stream work with HE:

line 3346:


    if (asynchttp_v1) asynchttp_v1.put(null, requestParams)

line 3366:


if (asynchttp_v1) asynchttp_v1.put(asyncHttpRequestHandler, requestParams, [command: 'storeMedia'])

I know these “asynchttp_v1” and “asynchttp_v1.put” needs to be replaced. “asynchttp_v1.put” would be replaced by “httpPut” but what about “asynchttp_v1”?

Also, how do I format the arguments for “httpPut”?

I tried the following codes but didn’t work.


httpPut(null, requestParams)

httpPut(asyncHttpRequestHandler, requestParams, [command: 'storeMedia'])

Try adding this after the async code (or you can remove it if you’d like)

httpPut(requestParams){ resp ->
     log.debug "Sent data to fuel stream"
}

Thanks. Just tried this and I’m getting an error in the HE Log now:


2018-04-18 14:08:38.713:error║║ Error executing virtual command [Master Closet Motion Sensor].writeToFuelStream: (391ms)

[2018-04-18 14:08:38.709:debug Sent data to fuel stream

Still not getting any data written into Fuel Streams.

I’ll take a look tonight to see I can find the issue

1 Like

Anyone using WebCore presense sensor? Anyone tried using this

{previousValue([$currentEventDevice:previousPlace])}
Here's a screen shot of my piston. Its a simple commute tracker, and also logs my commutes to a google doc using IFTTT. What's pretty cool, is everything works, other than capturing the previous value.

This works with smartthings, but returns invalid device in hubitat. Maybe previous values are not kept? Also does not seem to be grabbing current event time (line 28).

So something really really odd happened to my Piston. The Piston is supposed to count down when motion is inactive and some other stuff happens. When the lights didn't turn off I logged into webCoRE and saw the timer next to the piston was counting up not down.

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.