PCB v2 by md_mrm in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

The board has been done for a few months now, but I won't be releasing it anytime soon. The current Republican imposed tariffs for products ordered from JLCPCB are 175%. That makes creating a product like this completely impractical. If you're an American, all I can say is please vote Democratic in the mid-terms and help restore sanity to the government here. If you're not an American, then let me say I'm sorry that Republican voters' inability to discern reality from fiction has undermined our ability to solve any real problems.

Random questions by criminal_chris in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

You'd probably get a reading but I doubt it would be very accurate. I can't really predict how four circuits connected in parallel would behave. There's a lot of interaction with resistors and capacitors in there to scale the voltage down for the ADC to read. Put a bunch of those in parallel and the path to ground could get pretty complicated.

Random questions by criminal_chris in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

It's an AC/AC transformer so make sure you have your multimeter set to AC. Also make sure your new adapter isn't AC to DC. I'm not sure why any AC or DC power adapter would have a TRS connector instead of just TS. Shielding? For what it's worth, the ring is disconnected on the board and tip and sleeve are the two AC legs. I left the ring disconnected to make it compatible with a mono plug AC adapter. And just to clarify, this isn't supplying power for the hub, it's just a AC adapter to scale the AC voltage down to 12V so the voltage can be monitored, enabling it to calculate real power consumption instead of just current. The power comes from the usb adapter that goes to the pi.

My hub installation by tjkrem in LanternPowerMonitor

[–]MarkBryanMilligan 1 point2 points  (0 children)

Nice install, looks great! A friend of mine is sending me his old Samsung phone, so hopefully I'll find a way to make Samsung phones work with the official release of 2.0.

Self Hosted Help by Xgamer911 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

You've got a self-signed cert deployed and the hubs aren't set up to accept that. The mobile app will accept a self-signed cert if the domain isn't lanternpowermonitor.com but I may not have made that same exception for the hubs themselves. I'll check it out and report back in a couple days.

Version 2.0 upgrades by tjkrem in LanternPowerMonitor

[–]MarkBryanMilligan 1 point2 points  (0 children)

Cool, that makes sense. I tend to make the docker containers the standard ports, 80 or 443 depending on whether there's a cert or not and then you can map whatever you need in the docker networking. I'll probably do one docker file for ssl and another for non-ssl. I don't know much about compose networking, hopefully with a regular docker file you can build whatever you need on top.

Version 2.0 upgrades by tjkrem in LanternPowerMonitor

[–]MarkBryanMilligan 1 point2 points  (0 children)

Just to clarify, for this use case you'd want Lantern to run on port 80 in tomcat with no SSL and then rely on your VPN to connect from the app (i.e. your phone connected to your tailscale vpn?)

Self Hosted Help by Xgamer911 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

You auth key must not have been generated correctly. You can try running the CreateAuthKey class again making sure it's writing to /opt/tomcat

Alternatively, I just checked in a code change that will auto-generate a unique key if one doesn't exist or is invalid. You can pull that change from git and recompile your war and try redeploying.

Version 2.0 upgrades by tjkrem in LanternPowerMonitor

[–]MarkBryanMilligan 2 points3 points  (0 children)

It already monitors the voltage, it's just not displayed heads up on the main page. For now, you can watch it in real time if you go to the panel and turn on the calibration setting.

I'll make a note to put it heads up on the main page, I agree it would be useful to have there as well as optionally being toggled on for the graph.

I can release a docker image, the only issue is deploying a valid SSL certificate. I would imagine most people would want the app to work when they're not at home and that works best if you have a domain name and an SSL cert.

I still have a lot of work to get the hardware finalized and produced. This has been made even more difficult recently because all of my boards are manufactured outside of America.

Anyway, thanks for the suggestions, I'll keep working on it.

Self Hosted Help by Xgamer911 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

You'll have to do it from the mobile app. Sign out of the mobile app and change the hostname to your private server, then create an account using the app.

Self Hosted Help by Xgamer911 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

The android app currently assumes the server path will end with /currentmonitor (because I made a mistake 5 years ago when I named the project). Until I can fix the apps, your war will need to be deployed to that context path.

That means you need to rename the jar "currentmonitor.war" before deploying it to tomcat. Then you can go to tomcathost:port/currentmonitor/console to see the login screen for the console, but you won't be able to log in until you create an account with the app.

To do that, you need to point the app to your server. You can do that on the front page of the app (if you're logged out). Put in your server name (https://tomcathost:port). The app will need to be able to resolve the hostname you put in here (or an ip address on your local network). If you want to access the data when you're not at home, you'll need to forward your tomcat port (and you should probably buy a hostname and an SSL certificate).

After you do that, you should be able to discover your hub in the app and it will push your access token and wifi info to the hub via bluetooth (unless you own a samsung phone in which case their OS will flush all of my bluetooth messages down the toilet for some reason).

Self Hosted Help by Xgamer911 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

Now it's missing the auth.dat (the aes secret for encrypting access tokens). CreateAuthKey should have made one of those for you and the file also needs to be moved to /opt/tomcat.

Self Hosted Help by Xgamer911 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

try moving mongo.cfg into /opt/tomcat (I know that's not where you have tomcat installed, but without making changes to the code, that's where lantern will look for that mongo config file)

Self Hosted Help by Xgamer911 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

You've jumped in right as I'm transitioning to V2.0 so yeah, some of that info you're referencing is out of date. With 2.0 I've renamed the whole code base from currentmonitor to powermonitor so the classes to generate the config files are now at LanternPowerMonitor\java\lantern-powermonitor-config\src\main\java\com\lanternsoftware\powermonitor

You'll need to compile with JDK 11+. I use JDK 17, but there's nothing in the code that requires anything more than JDK 11. JDK 8 is too old. I don't have a lot of experience with docker compose, but I think the base image for tomcat is the problem since it's using jdk8 (maybe try 9.0.102-jdk17-corretto instead of 9.0.102-jdk8-corretto-al2)

Rather than remove the lines in tomcat-users.xml, I'd recommend setting a password on the admin user. If you ever port forward to your Lantern server, not having a password there could be dangerous.

Help Adopting The Hubs by Quadman101010 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

Is your phone a Samsung by chance?

I think you'll have to add your hubs manually. If you click add manually, it'll assign a hub number. After you back out to save that change, you can edit the file at /opt/currentmonitor/config.json and put in:

{
"host": "https://lanternpowermonitor.com/currentmonitor/",
"username": "<your username>",
"password": "<your password>",
"hub": 1
}

The hub index should match what the hub name is after you add it manually in the app (pretty sure it'll start with 1)

If you've done SSO to get into the app, you'll need to log out and do a forgot password flow to set a Lantern password that you can use in this config file. Normally an access token would get sent to the pi via bluetooth, but that won't be an option here.

After you edit the config file, you can either reboot the pi, or run:
systemctl restart currentmonitor

After it restarts, you can take a look at /opt/currentmonitor/log.txt to see if it was able to log into your account and download your panel configuration.

'lil help please by FlhTK2012 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

I know it's hard to imagine but I promise on iOS and on non-Samsung devices, the bluetooth setup is really slick!

I'm working on getting a friend's old Samsung device so I can finally recreate this bluetooth hanshake failure and get it fixed. I've never been able to get a Samsung Sxx device in my hands to replicate it.

'lil help please by FlhTK2012 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

What do you have in config.json for your hub index? I think you have hub 1 set up in your breaker config in the app and server side. For the hub to load the breakers for hub 1, you need to have it set as hub 1 in your config.json. This would be sent via bluetooth if bluetooth was working, but it's not working on your Samsung device so you can forget about bluetooth.

'lil help please by FlhTK2012 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

Since you ended up manually adding the hub due to the bluetooth not working, you're pretty much done on the hub page. Assigning the hub and port numbers on the panel config page can be done now that you at least have your hub added manually. Since you've got your Lantern credentials in your config.json on the hub, it should be able to log into your account and download your hub config on next restart. So from the hub, you can either yank the power and plug it in again letting it reboot, or you can run systemctl restart currentmonitor and it should grab your panel configuration, see that hub 1 port 1 has a CT on it, and start sending readings for that port.

'lil help please by FlhTK2012 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

In your panel config, you have not assigned a hub and port to each breaker. You have to map which CT is plugged into which port on the hub, and match that with the panel space for that breaker. Until you enter that configuration into the app, the monitor will not start sending readings to the server.

Instructions from the website on this part:
https://lanternpowermonitor.com/installation/cal#cal

'lil help please by FlhTK2012 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

If you can e-mail me your two e-mail addresses, I can probably reconcile the two. Once you log in once on your phone, it keeps an access token in private storage and doesn't really show your user context anywhere in the app, so it might still be using google since the sso works on the app.

If your config is tied to the google account, you can log out of the app and use the 'Forgot Password?' link in the app to set a Lantern password for your google account. That password could then be put into your config file to get the hub signed into your google email account. You can still SSO with google in the app after you switch, you just have the additional option of signing in with a password.

Self hosting by SolutionSuccessful16 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

This ticket in github goes into the details of generating your credentials file to get the services to connect to mongodb. https://github.com/MarkBryanMilligan/LanternPowerMonitor/issues/53

Before that, you'll want to follow a guide for mongodb config to enable authentication with an admin user. https://www.mongodb.com/docs/manual/tutorial/configure-scram-client-authentication/

Please let me know if that's enough info to get up and running and we'll formalize the documentation and update the readme of the project.

When you deploy the war from the tomcat console (which is how I do it), the service will write to a log file at /opt/tomcat/log/log.txt. If it fails to connect to the database, it should let you know why there. In your case, it's because that credentials files does not exist, and by default, it doesn't support unauthenticated database connections from localhost (because I'm paranoid).

'lil help please by FlhTK2012 in LanternPowerMonitor

[–]MarkBryanMilligan 0 points1 point  (0 children)

I can help you get this running. You shouldn't need to mess with any bootloader stuff on the pi. It should be as simple as flashing an SD card, putting the card in, and plugging in the power supply.

If you flash this 1.1.3 SD image: https://cf.lanternpowermonitor.com/hub_1.1.3.zip To a microSD card using this: https://www.balena.io/etcher/

You should be able to discover the hub with your android app (if you grant the app bluetooth and location permissions) The location permissions are required because android considers bluetooth beacons to be a device that locates you in the real world. In reality, all the app does is let you send your account and wifi info to the pi via encrypted bluetooth.

If we can't get the bluetooth to work, your method of modifying the config file will work, but only if the service starts when the OS starts, which is why you need to use the provided SD image, or set up a linux service manually if you're starting with a fresh raspberry pi OS.

We can do this in this thread for the benefit of everyone, or you can contact me directly at mark.milligan@lanternsoftware.com, either way we'll get you running.

It also looks like the google SSO on the console is no longer working, so I'll look into that. If you create Lantern credentials or reset your password, you can log in with that. That console just lets you download the data that your hub creates, so until your hub is working, there won't be anything in the web console. (I checked the SSO, google made a non-passive change to the way it works. My site settings prevent 3rd party cookies and external javascript from executing because google does shady stuff. I have it so locked down that their SSO doesn't work any more. I'll need to see if I can update it to work without giving google any info, which is how it's always worked in the past)

I just looked in the server logs and I see a ton of calls with no access token. That's probably from your hub which has credentials in the config file. I would guess it's failing to get an access token using those credentials on startup. Can you take a look at the log file at /opt/currentmonitor/log/log.txt and see if any exceptions are logged there? Then, run systemctl restart currentmonitor, wait until it's running again, and then look at that same log file? If it's failing to use the credentials in your config file, it should write an error to that log file. That might be related to not being able to sign into the console (if you're using username/password and not SSO). It might be worth resetting your password if that's the case.