I believe that button pushes are one of the items not currently working yet.
webCoRE is crazy complex but broken down into it's component parts it's possible to tweak for most mortals (Adrian is not a mortal btw).
A huge chunk of webCoRE runs in JS on the webCoRE servers, intention was to reduce the code base due to size limitations imposed by groovy.... this part of webCoRE is, in the most part, platform antagonistic.
"Non-destructive patches" relates to a proposal I made to @ajayjohnm in regards to making HE patches for WC work without breaking ST integration (i.e. the code detects which platform it is running on and behaves differently depending on what is detected). Such patches could be applied to the main webCoRE repository via pull requests and would be very much welcomed. It would save running two versions of the apps and all the sync issues that goes with it.
Also, us knowing that webCoRE has a life after ST scraps groovy gives us (royal us lol) an incentive to continue development of new features such as find and replace, holiday variables and other new features we have in the pipeline.
I want to check if a button is pushed.
How can i do this in webCoRE? Normaly you can evaluate if the âbuttonâ event is pushed but that option isnt there on hubitat:
This may be only for Minimotes (because that's the only button device I have), but this works for me:
A sample of the log produced:
The action selection looks like:
I have found the way to do it!
Only thing is, you have to add the "button has changed", otherwise it wont subscribe to the buttons events!
@jp0550 Barring a few areas, I tested your latest commit and everything works like a charm! Thanks for all your hard work!
I like the option you have added to support local hosting of the webCoRE UI
I couldn't test routines though, as I do not have a version of Other Hub that support routine sync.
As for the button implementation, I did have trouble getting the held event to be recognized. However, it may be worth noting that I used a Xiaomi button (which uses a custom handler by @veeceeoh). I didn't dig much into investigating what was happening but I guess the issue may probably lie with way my button reports its events.
Regarding the non-destructive patches, I am currently working on making all your patches as well as the ones contributed by others, work in a manner that the same code could run on ST and HE.
For any future patches, kindly use the snippet mentioned in the below linked thread, to ensure that the patch only runs when on the HE platform.
I was trying to have my code detect whether it is being run on a SmartThings or Hubitat Setup. By default, Hubitat doesnât seem to have any API call which provides something similar. But the below function seems to work well for me. Hope this helps someone else who may be looking for a similar requirement. def getEcosystem() { String hubdomain = location.getHubs().find{ it.getType().toString() == 'PHYSICAL' } if (hubdomain.matches("com.hubitat(.*)")) { return "HE" } elâŚ
@mjw-tan @ptdalen The latest commits by @jp0550 may help resolve your issues with having buttons working.
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>
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.
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
Go to the webcore settings on your hubitat and enable Custom urls.
In the first box put the http address of your hubitat
In the second box put the http address of your pi
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.
Now edit the following file to the following
/etc/apache2/sites-available/000-default.conf
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.