Patched webCoRE for Hubitat (2018/09/09)

out of curiosity, is your hub on version 1.1.0.120?

Also for some reason, directly clicking the external links also don't seem to work anymore. When i click it, i get a message saying Ok with the timestamp, but nothing happens to the piston.

Any ideas what could be wrong?

I had to reset my hub yesterday, when updating to the new version and restored a back up copy of my database....and all this started. Not sure was it because of the back up or was it because of the new version.

I hate quoting myself, but the above is helpful for context. I have had hit-or-miss success in keeping access to the Hubitat WebCoRE dashboard. Until a couple of days ago, it worked great for a several days - that seems to be the pattern: good for a week or two, then it disappears and strangely re-appears without reason. By "worked great", I mean I can have a browser window that has the choice in the top left that looks like this (but with a choice of both ST and Hubitat versions - what I show is the working ST-only):

image

The above is what I have now, ST only. Now, when I try to register an instance of the Hubitat dashboard, after entering the one-time code, I get a variety of errors. Usually this:

followed by:

image

At any time, I can go to ST and register a new browser and it works. So, I don't have any way of controlling my HE pistons. Is there a step I'm missing? Am I the only one?

I noticed that it depends on how many devices I expose to WebCore. Remove some devices that you don't need to see if that will help.

I was using 1.1.0.120 and the local hub link.

@CAL.hub Are you running a local version of the webcore site? If not, I've found hubitat's cloud inconsistent with responses with webcore. You can try looking in the network tab in chrome to see if you are getting 502 errors like users were above your post.

A local version of webcore on your lan will always be consistent until their cloud links can handle larger responses without erroring out.

I scrutinized it and removed redundant devices (although I don't think that matters) and brought the total down to 33. Still no joy. Do you think 33 is too many?

No, web at dashboard.webcore.co

I've tried Internet Explorer, Firefox, Chrome and Opera (on an Android tablet); fi that matters.

EDIT: reduced the device list to 16 and it works. I'll try to stay at a minimal list to see if it's longstanding. Interested to know if others are higher and seeing successs.

I have more then 33. Remove them all and start adding one by one. Have dashboard open when you adding devices back. You will see 'That was a problem loading your dashboard" as soon as you add bad device. Uncheck bad device and see if you can add next. Some device types may not play with Webcore well, I guess it has something to do with device capabilities.

Will do.

Do these issues go away with an rPi hosted dashboard? It's new ground for me, but if that's what it takes....

Try holding off that for now if you're uncomfortable. Got something in the works that should help soon.

2 Likes

I've updated my repo with changes to improve the startup performance of pistons, and to help get around the 502 errors if you aren't using a local version of webcore.

Pistons should now start executing ~70% faster (80-120ms vs 300-600ms for runtime loading in my tests) making it much faster for motion and lighting based automations. If you have multiple pistons that subscribe to the same motion sensor or another device that is time sensitive, combine them into a single piston for the best results as apps subscribed to the same event seem to be a little sluggish.

*Note to devs that multiple calls to atomicState are expensive in hubitat. Smartthings did some type of optimization for faster loading that isn't present here so I added caching in webcore when possible to help combat this.

When retrieving pistons, the logs and stats are dropped from the retrieval to help bring the response below 100KB to prevent 502 errors from hubitat's cloud links. These stats are loaded a few seconds anyway after viewing a piston, and this should only affect loading the dashboard for the first time on a new browser.

App Update

4 Likes

See my post above: Patched webCoRE for Hubitat (2018/04/10)

I'm still not able to create a piston using either my Raspberry or the regular dashboard. I deleted WC and created a new instance with your updated code from today and using just the dashboard.webcore.co site to test without changing the custom endpoints and it just spins on the webCoRE logo and never opens the page. I picked creating a blank piston to test with. I have yet to get WC to work on Hubitat although I saw a mention of lowering the devices selected on WC, I haven't tried that yet.

Here's from Network tab in Chrome:
Default levels

Group similar

adsbygoogle.js:1 Refused to load the script 'https://adservice.google.com/adsid/integrator.js?domain=dashboard.webcore.co' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' www.google-analytics.com www.google.com *.api.smartthings.com *.hubitat.com *.googlesyndication.com googleads.g.doubleclick.net csi.gstatic.com maps.google.com maps.googleapis.com".

adsbygoogle.js:1 Refused to load the script 'https://adservice.google.com/adsid/integrator.js?domain=dashboard.webcore.co' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' www.google-analytics.com www.google.com *.api.smartthings.com *.hubitat.com *.googlesyndication.com googleads.g.doubleclick.net csi.gstatic.com maps.google.com maps.googleapis.com".

webCoRE.min.js:110 Refused to load the script 'about:blank/intf/dashboard/load?token=&dashboard=0&dev=0&callback=angular.callbacks._0' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' www.google-analytics.com www.google.com *.api.smartthings.com *.hubitat.com *.googlesyndication.com googleads.g.doubleclick.net csi.gstatic.com maps.google.com maps.googleapis.com".

/js/webCoRE.min.js:127 TypeError: Cannot read property 'id' of null at /js/webCoRE.min.js:8999 at /js/webCoRE.min.js:139 at m.$digest (/js/webCoRE.min.js:150) at m.$apply (/js/webCoRE.min.js:153) at l (/js/webCoRE.min.js:106) at /js/webCoRE.min.js:111 at HTMLScriptElement.m (/js/webCoRE.min.js:110) "Possibly unhandled rejection: {}"

/js/webCoRE.min.js:8999

  1. s

/js/webCoRE.min.js:127

  1. G

"<ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px;padding: 20px;" data-ad-client="ca-pub-4643048739403893" data-ad-slot="8683068091" ng-init="initAds();">"

/js/webCoRE.min.js:8999

  1. s

cloud.hubitat.com/ap…ular.callbacks._4:1 Failed to load resource: the server responded with a status of 500 ()

/js/webCoRE.min.js:8999 Loading piston...

cloud.hubitat.com/ap…ular.callbacks._6:1 Failed to load resource: the server responded with a status of 500 ()

/js/webCoRE.min.js:127 ReferenceError: data is not defined at /js/webCoRE.min.js:8999 at /js/webCoRE.min.js:139 at m.$digest (/js/webCoRE.min.js:150) at m.$apply (/js/webCoRE.min.js:153) at l (/js/webCoRE.min.js:106) at /js/webCoRE.min.js:111 at HTMLScriptElement.m (/js/webCoRE.min.js:110) "Possibly unhandled rejection: {}"

(anonymous) @ /js/webCoRE.min.js:127

Looks like something's wrong with your piston/reference data:

Logs of webCoRE Instance I have installed:
[app:173] (http://10.100.90.36/logs#app173)2018-06-22 21:56:12.802:errorjava.lang.IllegalArgumentException: Maps with null keys can't be converted to JSON (api_intf_dashboard_piston_get)

Can you add the statement below to line 1115 of the latest webcore.groovy from the post above and DM me the results of the logs after loading a piston (it might have sensitive information). We're looking for a "null" value in one of the keys. It will be a very long log line.

log.debug result

Just an update. All positive. I updated to @jp0550's latest and took @murzik's suggestion to remove non-essential devices. At first - maybe four hours - nothing changed. So I went to bed and this morning I'm back into the dashboard. :crossed_fingers: Much appreciate the help.

I updated webcore today. Webcore loads much quicker now! Thanks for your hard work!

Sad to say, I'm back. Similar, if not identical, problems as two days ago. I've been going well until a few moments ago. Suddenly, this:

At that point, I'm dead in the water. Logging out and in again only brings me to a dashboard for my ST instance of webCoRE. Strangely, it starts with the right dashboard. I get this login screen which is correctly pointing to the HE dashboard (1410Hub").
image

It takes the password and then goes straight to the ST dashboard.

Any more hints?

EDIT: With nothing better to do, I updated the hub to .122. Then, my dashboard re-appeared. Any possibity that re-booting would fix it? Normally, I think of re-booting as the answer to every computer problem, but I wouldn't have thought it with webCoRE since my problem (I thought) was with the servers.

EDIT2:

This may be it. I found one community device that: remove=good, include=bad, remove=good. I can't say my testing is definitive, but early results are positive.

So since this got some love... is there a docker solution

Thanks for this I only have one basic piston on hubitat and it would slow down before now it's lightning fast.

Will the latest webcore update be ported over as well?


This is my very simple light switch piston is there any way to do this without webcore on hubitat? I can't seem to find changes state on RM

Just add both states as conditions. So you'd have this:

Conditions: Contact2 open, Contact2 closed, Switch off
Rule: (Contact2 open OR Contact2 closed) AND Switch off

Or, without the parens, you could do:

Rule: Switch off AND Contact2 open OR Contact2 closed

RM does left to right evaluation of the rule. Suppose Contact 2 changes state, the first thing its going to do is look at the switch. If it's on, the rule returns false right then. If it's off, then its going to check the contact sensor, and is going to return true irrespective of its state.

1 Like

For IFTTT, how do I get IFTTT events to work with a local webCoRE dashboard (on raspberry)? I tried having IFTTT maker setup to my Public IP but it's not working. I wasn't even sure what ports to open up on the firewall on my router or if it's even possible to use IFTTT maker channel with local webCoRE web server for dashboard.

While it is possible to open up parts of the hub on your router, it is not recommended. You should just be able to replace your ip link above with the hubitat cloud link:

https://cloud.hubitat.com/api/{hubUID}/apps/187/ifttt/sleep_tracking_stopped?access_token={accessToken}

2 Likes

Thanks Putnamjwp, that works perfectly in that format. The URL format is a lot different than what I had setup on Smartthings and couldn't find anything documented anywhere about setting up web requests with IFTTT.

BTW, when webCoRE wasn't working for me before was caused by one of my devices I had setup. I removed the Smartthings Integration setup from the Available Devices on webCoRE and that was what fixed it for me when I posted initially. I'm not going to add it again to risk breaking webCoRE again.

1 Like