HousePanel 2 Node Version

Hi Everybody!

It has been more than two years since I've given any serious attention to HousePanel, so this is a major update. This update replaces the old hmoptions.cfg file with a database. I initially required an install of mysql but then discovered the joys of sqlite, so now this uses sqlite and no complicated installs of a database are required. You do have to have an installation of sqlite working on your server, but this comes with most Linux installations. The db file will be created for you upon first run. This upgraded version moves all settings to a database so it is much faster and much more secure. It also supports multiple logins. I originally wrote this to support a web-hosted version but I abandoned that when I was told by my employer that I couldn't sell it, so I have to keep this as "donationware" which I am happy to do. I've also updated the default skin to look more modern and elegant, shamelessly modeled after the built in dashboard look but with the flexibility of HousePanel. Here's what it looks like now:

With SmartThings groovy going away, I also cleaned up the code a bit to focus only on Hubitat hubs. There is Sonos and ST new hubs support but it is still alpha in form, and the old Ford connect link is still there. Local ISY hubs are also supported. The source can be found at my GitHub repo here:

The master branch now has the latest.

The installation is unchanged. You have to download all the files from GitHub and follow the recipe below. You will also need to install the HousePanel.groovy file into your Hubitat app. Here are some details:

  • copy all files from the GitHub repository, or clone it as usual using "git clone GitHub - kewashi/HousePanel: Node version of HousePanel"
  • in the folder where the main files are, run "npm install" (do not list the name of the app after install as this is a local install)
  • after npm does it's thing, you are ready to launch the server. I suggest using PM2 to install it as a service. Or you can start it manually and pipe output to a file using this command:
node hpserver.js > hpserver.log &

If you are running this on FreeBSD you should use the daemon function to launch.

sudo daemon -r -o /hpserver.log node hpserver.js

Give it about 30 seconds to initialize and then launch a browser and point it to your server where you did the above install. The default port is 8580 but you can specify any port you like in a file called housepanel.cfg. The format of housepanel.cfg is pure json. I'll document that later.

This will show you a login screen where you can create a new account and then log in. Any number of Hubitat hubs can be linked or you can link one and use HubMesh.

All of the original deep customization capabilities of HP is still here are more. Full documentation is available at http://www.housepanel.net . This doc needs serious updating to reflect all of the new capabilities but enough is there to get you going.

Back on the groovy side of things, you can use Hubitat Package Manager to install HousePanel.groovy or you can install it manually using the usual "old school" copy/paste of the groovy code. After you install the app you will need to add an instance of the app to your configuration. Once installed you run it and pick the devices to expose to HousePanel for it to control.

8 Likes

I got it installed and could open the sample in the browser. However, when I try to authorize my Hubitat or SmartThings hub, I get a simple [object Object] Not found on the resulting webpage. Any suggestions on what I did or shouldn't have done? I don't have the previous version running anywhere.

Did you install the HousePanel.groovy app into the Hubitat IDE and into the ST IDE? You need to do that and enable OAUTH for the hub auth to work.

I did but it was something else i did that was stupid stupid!!!

Now, I can get one hub to authorize but not the 2nd. If I authorize Hubitat first as Hub 0, when I go to authorize the SmartThings Hub as Hub 1, it goes to Hubitat to select devices. If I authorize SmartThings Hub as Hub 0 then try to authorize Hubitat Hub, it goes to SmartThings to select devices.

Also, I am selecting devices but none are being authorized with either hub. I will just wait until you have written instructions on how to link hub as you mentioned in your original post. I am sure I am still doing stupid s&%t!

Dude - you are so close. I think you just have to restart the server and everything should work fine. Sometimes adding hubs gets things confused - I am still working out those kinks. Again just kill the server process and relaunch it and then restart your browser. It should then all work.

Also, make sure you have the latest version. One other trick is I always only add one hub at a time with a return to home page in between before adding the second hub.

1 Like

OHHHH the agony!!! Since it wasn't working and I accidentally installed on the wrong Pi, i uninstalled and tried putting it on correct Pi and now I can't get http://myipaddress:3080 to open. I am getting "IP Address refused to connect" That serves me right. :grin: :grin: :grin:

Had I not deleted everything on my first Pi, how would I restart the server?

Just start fresh. Remove existing processes and deleting existing *.cfg files.

I must be jinxed. I originally almost got it installed on my "OLD" Pi-4 but since it didn't work, I removed it and installed on my "NEW" Pi-4 since that's where I intended to install in first place. I tried multiple times and keep getting this screen:

So, I figured, fine I will go back and install on "OLD" machine and SOB I am getting the same thing. I opened the log file on both machines and get this so it seems like the install worked.

I must be making some elementary mistake(s).

Is your IP address really 192.168.68.xx?

That is unusual. It is usually 192.168.1.xx

Mine is .11 but that is weird too.

Your node server is up and running so you just have to point to it with the right address and make sure your PI is on the same subnet as your main machine and tablet.

Yup really is 192.168.68.xx. Everything is connected to same TP-Link Deco M5 Router.

I am afraid that I have hit a brick wall and it is obviously something going on my Raspberry PIs or my network that is causing the problem, not your application since other people are not having the same issue that I am. Thanks for your help but I think I am SOL. Maybe I will give it a couple of weeks and take a fresh look. Unfortunately, I don't know much about the Raspberry PIs; I just follow directions (usually). If something goes wrong, I don't have a process or the knowledge to troubleshoot.

Other than that log file, is there a way to confirm that the server is still running?

Hi Ken (@kewashi)

Can I say fair play to you creating and sharing this. I tried to get it running on a Mac in the past and now with this version via node. Have finally got it to install.

My only issue seems to be anytime I make changes to regions or try add a hub. It falls over with the below error:

internal/modules/cjs/loader.js:979
throw err;
^
Error: Cannot find module '/Users/xxxxx/hpserver.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Also the below error from webpage, once I add hub and start to assign devices to rooms:
TypeError: Cannot read property 'match' of null
at makeThing (/Users/xxxx/hpserver/hpserver.js:1795:19)
at /Users/xxxx/hpserver/hpserver.js:1519:20
at Array.forEach ()
at getNewPage (/Users/xxxx/hpserver/hpserver.js:1493:12)
at mainPage (/Users/xxxxx/hpserver/hpserver.js:4187:25)
at /Users/xxxx/hpserver/hpserver.js:5440:23
at Layer.handle [as handle_request] (/Users/xxxxx/hpserver/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/xxxx/hpserver/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/Users/xxxxx/hpserver/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/xxxxx/hpserver/node_modules/express/lib/router/layer.js:95:5)

Any ideas?
Is a PW mandatory??
I am going to try small things to see if I can isolate issue.

Look forward to trying it Ken! Nice that you’re including ISY too. :+1:t2:

Hi there, I finally got HousePanel 2 to work. I gave up trying to use the old version as I couldn't log in. But now it works and I am pretty happy.

Well it worked, that is to say. Now I am stuck at the same "cannot read property match of null" etc. error. It almost always happens when I either authorize my hub or add a device to the panel.

Hope kewashi can fix this issue. Because I am really looking forward to finally using his great dashboard!

Edit: Installed latest version - still the same issue. As soon as I add devices I get the error.....now I can't access hpserver anymore....(I managed to add a device once....that was a logitech harmony device....but as soon as I started adding my hue light, the error occured...)

Can you grab the latest and try again? And if you still get the error please tell me more about what you are seeing. Is that in the log file? Or is it in your browser? I can’t tell from the info you gave where this is happening. Please copy the full error dump info.

I already have version 2.254. Or did you change anything in the meantime? The error occurs in the browser. I will post the full error when I get home tonight. Thanks for the quick reply!

Ok, so this is the message that I get, when I open http://mylocalip:3080 in my browser:

"TypeError: Cannot read property 'match' of null
at makeThing (/home/pi/hpserver/hpserver.js:2183:19)
at /home/pi/hpserver/hpserver.js:1816:24
at Array.forEach ()
at getNewPage (/home/pi/hpserver/hpserver.js:1784:12)
at mainPage (/home/pi/hpserver/hpserver.js:5321:25)
at /home/pi/hpserver/hpserver.js:6874:23
at Layer.handle [as handle_request] (/home/pi/hpserver/node_modules/express/lib/router/layer.js:95:5)
at next (/home/pi/hpserver/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/pi/hpserver/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/pi/hpserver/node_modules/express/lib/router/layer.js:95:5)"

Hope this helps...

Edit: Btw, when I do "sudo npm install" I get the following error:

"npm WARN npm npm does not support Node.js v10.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
up to date in 6.623s"

Can I ignore this?

Your problem appears to be with your node install. Try this first while logged into you main folder with HP ....

npm install

Don’t do sudo

Then tell me what it says. After that try running HP again. If that doesn’t work tell me node gives when you say:

node version

Thanks

Sorry it took me so long, here we go:

when I type in:

"cd hpserver"

and then

"npm install"

it says:

"npm WARN npm npm does not support Node.js v10.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
up to date in 6.848s"

when I then start hpserver with:

"node hpserver.js >& hpserver.log &
ps
tail hpserver.log"

it gives me:

"12.5.2020 09:21:17 Loading 1 hubs.
12.5.2020 09:21:18 HousePanel Node.js Server is running on port: 3080
12.5.2020 09:21:18 webSocket Server is listening on port: 1380"

After that, when I try to open http://myip:3080 in chrome browser I get

"TypeError: Cannot read property 'match' of null
at makeThing (/home/pi/hpserver/hpserver.js:2183:19)
at /home/pi/hpserver/hpserver.js:1816:24
at Array.forEach ()
at getNewPage (/home/pi/hpserver/hpserver.js:1784:12)
at mainPage (/home/pi/hpserver/hpserver.js:5321:25)
at /home/pi/hpserver/hpserver.js:6874:23
at Layer.handle [as handle_request] (/home/pi/hpserver/node_modules/express/lib/router/layer.js:95:5)
at next (/home/pi/hpserver/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/pi/hpserver/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/pi/hpserver/node_modules/express/lib/router/layer.js:95:5)"

"node version" gives me:

"internal/modules/cjs/loader.js:638
throw err;
^

Error: Cannot find module '/home/pi/hpserver/version'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)"

Sorry that's a lot of info....Hope it helps you to understand whats going on at my side...

Best regards!

Ok, so I did a fresh install of raspbian and housepanel again. I also managed to install node version 9.11.2 and dont get the node error anymore ( newer versions seem to throw the error). Housepanel started all up fine. I authorized my hub and could add the first light. But as soon as I tried to drag a second light on the panel it wouldnt appear as a tile. Reloading the page then throws the above mentioned "TypeError"....so always the first device seems to work fine. A second one then crashes housepanel....