jkeljo / hacs-greeneye-monitor

HACS version of the Home Assistant Core greeneye_monitor component. For beta-testing and faster deployment of changes.
MIT License
6 stars 2 forks source link

DashBox Communication #37

Open traveler2100 opened 11 months ago

traveler2100 commented 11 months ago

I've installed the integration and I am trying to see the forwarded packets from the Dashbox instead of the GEM. I understood from Brultech support that it may be possible with this version. I installed on port 8000 and configured the DB to forward on 8000 but cannot see the packets. Is this possible? THanks

traveler2100 commented 11 months ago

After some restarts, I am seeing the DB and getting data. I only have 6 channels being used and no pulse counters but I am getting values on 30 channels and 4 pulse counters. I only want live watts from the 6 channels but haven't discovered how to configure channels without YAML.

jkeljo commented 11 months ago

I'm away from my computer at the moment so I can't give you the exact path to follow, but in the Home Assistant Settings there's a place where you can view entities and enable/disable them in bulk.

traveler2100 commented 11 months ago

Thanks. The issue is all 30 channels have a value when they are empty on the DB, pulse counters also. I'm not sure what I am getting. I was looking for a place to set the units etc. I think the problem may be on the DB end. I'll work with it some more to see what I am actually sending and receiving. Thanks again.

jkosharek commented 10 months ago

I have the hacs-greeneye-monitor installed and configured for port 8000, on Dashbox I configured Packet Forward to the HASS IP on port 8000. I have restarted HA several times, does the Dashbox need to be restarted?

jkeljo commented 10 months ago

Yes, dashboxes should work with that setup.

I don't have a dashbox, so I don't really know, but presumably it couldn't hurt to reboot. Might be worth asking in the Brultech forums.

If you want, file a new issue here with all of the info that the bug report issue workflow will request (version, debug logs, etc.) and we can at least make sure there's nothing going obviously wrong on the HA side.

jkosharek commented 10 months ago

@jkeljo I posted on the DB forum about the settings needed on the DB side to make this work. I did reboot and it doesn't seem like HA is seeing anything from DB. What is the format HA is looking for?

@traveler2100 what settings do your GEMs have for packet send, and did you put anything in the 'Add Command' section of the 'Packet Forward' on DB settings?

jkeljo commented 10 months ago

Any of the binary formats will do. BIN32-ABS, BIN32-NET, etc.

adamgreenberg07 commented 10 months ago

I've been trying to get the HA plugin to work too. I just got data to flow from the dashbox to HA. Set the destinations server to HA IP, port 8001 (which is also the same port that the GEM is using to send to the dashbox. Not sure if that matters or not), persist is on, nothing in add command. On HA, I've added a hub, set the port to the same 8001. The breakthrough for me was when I changed the data format that the GEM is sending to the dashbox to Bin-32 NET.

The data looks wrong though. Each channel is reading a large negatitve number -152,966.360694444 kWh for example. I think it has something to do with the add command setting on the dashbox, but am not sure. I've asked in the brultech forum, but if anyone here knows or has other ideas as to what might be wrong, would love to hear.

jkeljo commented 10 months ago

Are the power readings off as well? -152,000kWh is a lot, but not out of the realm of possibility if that circuit is your whole house or your solar panels and you've had the GEM installed for 7-10 years.

adamgreenberg07 commented 10 months ago

Ok. I think I've figured more out. This set of readings was not disabled by default. I now see that there are 3 readings for each of the channels (excluding pulse and temp). I've enabled the other two. Amps, Watts, Kwh. It was this third Kwh one that I was seeing when I wrote last night. I now see how to enable the others to get the other readings.

That said, what is the purpose of this Kwh reading? Is it the lifetime amount of power ever recorded by that channel? If so, how are others using it or are others disabling it?

jkosharek commented 10 months ago

Kwh is a total for that CT, useful for a day or month calculation of power consumption. They can be reset on a schedule via a command ^^^SYSRSTA (all counters) or ^^^SYSRSTP (pulse counters), or in the Gem web interface

adamgreenberg07 commented 10 months ago

Can you share a little more instruction on how to issue the ^^^SYSRSTA command for the day or month.

jkosharek commented 10 months ago

I am waiting for a response from brultech/gem support on where exactly that would be run. I will follow up on this case when I have the settings working for Gems and Dashbox to get my setup working (Gem > Network > Dashbox > HA).

jkeljo commented 10 months ago

Home Assistant's energy dashboard can use the kWh sensors to report your energy production (if you have solar) and usage over time. If you want to set that up I would recommend against resetting those values on a schedule because it would likely result in that showing incorrect data.

jkeljo commented 10 months ago

If resetting on a schedule is desired, that is conceivably a feature that could be added to this integration, in which case it would be able to tell Home Assistant when it does a reset so that the values continue to appear correctly in the energy dashboard.

It's not super necessary from Home Assistant perspective because it already knows how to show hourly/daily/monthly/yearly consumption and takes ages for the counters to roll over, but if you need it for something else please file a feature request and I can look at implementing it (or advise someone on doing so).

jkosharek commented 10 months ago

That would be a great function to have control over with scheduling options. Store the value for historical data, hour, day, week, month, year then clear it? Might be a little more difficult to configure the command for Dashbox users as I believe that command gets run on the Gem, but the Dashbox is sending the data.

jkeljo commented 10 months ago

Yeah that is a good point, the dashbox does block API calls.

jkosharek commented 10 months ago

For my setup (GEM1 + GEM2 sending to Dashbox over network) I changed each Gem primary packet send to Bin-32-Net and on the gen network tab I have the IP host set to the dashbox and port 8001 and Gem2 is the same but port 8002. Packet Forward on the Dashbox is setup up to send both gem devices to the HA IP on port 8000.

The 'GreenEye Monitor (GEM) Custom Integration' (https://github.com/jkeljo/hacs-greeneye-monitor) was installed and configured to listen on port 8000 and automatically discovered both Gems.

@jkeljo or @adamgreenberg07 How do I enable all the devices to read watts or show watts by default? The Gem parent node also sends volts, I need that to also show and use it for automations.

adamgreenberg07 commented 10 months ago

@jkosharek I had to go into the entities page (getting there from the integration page and clicking on the entities link created the easy filter to see everything GEM related) and enable/disable the entities that I wanted active/inactive

jkosharek commented 10 months ago

Now I need to figure out how to send the data to Influx, I am a little list there.

jkosharek commented 10 months ago

@adamgreenberg07 You could put something like (replace RQSALL with the reset command for testing) this could go in a script and have crontab execute it at the desired schedule. Code is from https://www.brultech.com/community/viewtopic.php?f=29&t=2351#

{ echo "^^^RQSALL"; sleep 1; } | telnet X.X.X.X 8000

^^^SYSRSTA (all counters) ^^^SYSRSTP (pulse counters)

@jkeljo It would be ideal if we could send these commands in HA on a specific schedule.

jkeljo commented 10 months ago

You're right though that if the GEMs are connected to a dashbox we can't send API calls to them because the dashbox does not forward them.

jkosharek commented 10 months ago

@jkeljo Is this something that could be manually setup in HA to send that command and assigned a schedule? Like my water resets on the 5th and power resets on the 1st?

jkeljo commented 10 months ago

Not when HA is talking to a dashbox, because it won't forward the commands to the GEMs.

But you could write a query for that against HA's history or statistics DBs. Or create an entity that copies the total every 5th of the month, and another entity that computes the difference between the current total and the last saved value. (That could probably be done entirely in home assistant configuration.) Google around a bit for stuff like "home assistant energy billing cycle", I bet you'll find some threads where people are trying something similar.

jkeljo commented 10 months ago

Heh, or ChatGPT. :)

jkosharek commented 10 months ago

@jkeljo one thing I noticed is it appears HA is reading the energy used as negative: image

Can that be corrected?

jkeljo commented 7 months ago

Realized I'd missed that last question, sorry. Negative numbers showing up in the UI are likely due to the GEM itself being configured for NET metering for those channels, with the polarity set such that generated energy is positive and consumed energy is negative. Changing the polarity in the GEM configuration should address it.