DanielGallo / GivEnergy-Smart-Home-Display

A web-based smart home display for showing live GivEnergy inverter data
1 stars 2 forks source link

No Data on Web when running GivTCP with Gateway and AIO Inverter #7

Open adermon opened 1 month ago

adermon commented 1 month ago

Hi, Ihave GivTCP V3.0.3 running in a docker container with a Gateway and AIO Inverter. I get no data values on the GUI. The web dashboard is is throwing an exception when getting the Grid_to_Battery sensor value because it doesnt exist in the Gateway data. Im new to GivTcp config and want the Gateway in the configuration but the dashboard assumes that all discovered devices are inverters and will have the same data structure.

image

cdrajb commented 1 month ago

Similar but not the same, I also have all zero readings. I have an AC3, docker container running 3.0.3, and I get: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'invertor') at Helpers.getPropertyValueFromMapping (helpers.js:12:22) at App.onResponse (app.js:154:32) at app.js:139:16

AberDino commented 3 weeks ago

I'm on GivTCP 3.0.4, and my dashboard has no / zero values as well. With the Chrome web browser in debug mode, I get the following error: VM30:7 Uncaught (in promise) SyntaxError: Expected ',' or ']' after array element in JSON at position 68 (line 7 column 3) Promise.then App @ app.js:63 (anonymous) @ app.js:647

Interestingly, as you can see in the attached screenshot, data is flowing through (e.g. solarRate), so perhaps once the JSON error is resolved, the dashboard would show values. Screenshot 2024-10-28 102742

adermon commented 3 weeks ago

@AberDino Givtcp writes the dashboard app.json at startup after it has determined the number/config of inverters. The posted json is invalid so maybe there is a bug in 3.0.4. My issue is on givtcp 3.0.3, this has valid app.json but the dashboard doesn't handle GW and AIO correctly. I think my issue would be resolved if I configured givtcp for only the AIO, but I use the GW sensors in HA.

AberDino commented 3 weeks ago

Hi @adermon, thanks for the feedback. I'll have a look at the app.json file GivTCP generates, and see if I can temporarily override it to see if the dashboard loads. FYI, I was previously on GivTCP v2 with only the AIO configured and the web dashboard worked fine. Like you, I now also have the GW and AIO configured (I let the v3 auto-configuration process do that), so it will be interesting to see what the dashboard looks like if/when I can (temporarily) resolve that JSON error.

AberDino commented 3 weeks ago

@adermon, I 'fixed' the app.json file by adding a comma, and I now have the same error as you: helpers.js:12 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Grid_to_Battery') at Helpers.getPropertyValueFromMapping (helpers.js:12:22) at app.js:179:42 at Array.forEach (<anonymous>) at app.js:178:35 at Array.forEach (<anonymous>) at App.onResponse (app.js:162:17) at app.js:139:16

DanielGallo commented 3 weeks ago

Based on the error you're getting, it looks like the underlying data format may have changed slightly in GivTCP 3.x. I'll take a look soon.

DanielGallo commented 2 weeks ago

I've proposed a fix for the app.json syntax issue in GivTCP v3: https://github.com/britkat1980/giv_tcp/pull/299.

@AberDino @adermon - I don't have a Gateway, so I'm unable to test the web dashboard with one unfortunately. If you can share a full JSON response from GivTCP so I can see the data structure (i.e. call the appropriate givtcp_hostname:6345/runAll endpoint for the Gateway data), I can attempt to add support to the web dashboard.

AberDino commented 2 weeks ago

Hi DanielGallo, full JSON output from my gateway attached: gateway.json, and for completeness also my AIO JSON output: aio.json. I have one AIO at the moment, but might at a second one at some point.

Thanks for looking into this. I have an older tablet, and I'm thinking I could use it to display the GivEnergy Dashboard in the kitchen for example, to try and raise awareness among family members.

DanielGallo commented 1 day ago

@AberDino @adermon - Hi! I've updated my web dashboard to add basic support for Gateways. I'd appreciate if you could help test this before I push it to the GivTCP project, please.

If you download the source code from https://github.com/DanielGallo/GivEnergy-Smart-Home-Display/tree/master to your local computer, update the app.json file to match the one issued by your GivTCP instance, then run this as a website locally on your computer.

One way of running this as a website locally is by installing Node.js, then from a command prompt / terminal window, install serve by running this command: npm install --global serve. Restart the command prompt / terminal window and cd to the web dashboard folder, and run serve. This should run the web dashboard as a website on port 3000 of your local computer.

In your desktop web browser, navigate to http://localhost:3000/?Hostname=10.0.0.210, making sure to replace 10.0.0.210 with the IP address where your GivTCP is running. This separate instance of the web dashboard will attempt to read the live data from GivTCP.

You should see a "Gateway" summary panel, with "Mode" and "State" values - it should show "On grid" and "Static" as the respective values. I'm not sure whether this information is useful, or whether these values change when you are isolated from the grid? Are there any other values from the Gateway JSON file that you feel would be useful to show in this summary panel?

Regarding the AIO - there are no individual State of Charge percentage values for the battery cells from GivTCP, so I've configured the web dashboard to hide the individual battery percentage/capacity icons if it's an AIO.

Please let me know how you get on.

adermon commented 22 hours ago

@DanielGallo @AberDino Hi i tried that and got a bit further, the dashboard is displaying some items. Below is the web display and the exception from the console. I appear to have a different error now when hitting the rest api endpoint for the Gateway, not sure when this started. I get a response of { "result": "No register data cache exists, try again later" } the AIO end point is fine

WebDashboard error Webdasboard console error

DanielGallo commented 21 hours ago

@adermon Thanks. The "no register data cache exists" is an error from the GivTCP side. Have you updated GivTCP over the past few weeks?

Regarding the AIO - perhaps the data format has changed again. I tested the web dashboard on a version of the JSON provided by @AberDino and it worked fine. Please could you let me know when you last updated GivTCP, and can you provide the JSON files for the gateway (if possible) and AIO? You could try restarting GivTCP to see if that helps resolve the gateway "no register data cache" error.

AberDino commented 20 hours ago

Hi @DanielGallo and @adermon, I just got round to trying this, and I'm very pleased to report it is working for me (I'm on GivTCP 3.0.4). @DanielGallo, thank you for the detailed instructions, that was really helpful for me as non-programmer, and of course also for taking the time to update the code!

Here's a screenshot of my dashboard: image

In terms of the gateway, the "Mode" is definitely useful as it would let the end user know when there is a power cut, at which point keeping an eye on the state of charge is of course more important. I don't know what 'State' represents. I guess you could potentially remove it for now until somebody can explain what it is and whether it would be useful to display.

AberDino commented 20 hours ago

@DanielGallo, slightly off-topic, but just now (with solar power used to power the house and charge the battery), the house / load power value is slightly higher and the battery charge power is slightly lower than what I see in Home Assistant. I suspect that might be because the AIO inverter losses (AC to DC and DC to AC) are not included, i.e. are you using reported battery charge / discharge power, rather than inverter power? I see that the AIO reports "AC charge power" (which matches the inverse of "Inverter Power" when the battery is charging), but unfortunately "AC discharge power" does not seem to exist (but that effectively is "Inverter Power" when it has a positive value). I use "Inverter Power" for my "Power Flow Card Plus" in Home Assistant.

DanielGallo commented 7 hours ago

@AberDino I'm glad to hear it worked! Okay, I've removed the "State" field for now. I've also renamed "Mode" to "Status", as that feels like a more meaningful label. I've committed those changes. I'm holding off from submitting them to the GivTCP project though until I've fixed a few more issues with 3-phase Hybrid inverters, and ruled out any more bugs with data from AIO units.

Out of interest, does the value "On grid" change to something else if you isolate yourself from the grid (e.g. by turning off the isolator switch in the electrical cabinet)?

Regarding power calculations - in my very first version of the web dashboard, each of the "kW" values in the circles were exactly as reported by GivTCP, including the house/load, however these values never correctly totalled in the dashboard, most likely due to the DC conversion loss. A while ago I changed the logic so I show the actual reported PV, Battery, and Grid "kW" values from GivTCP, and I ignore the house/load value from GivTCP and calculate this in the dashboard based on all of the other values. This ensures they always total up correctly, which is more aesthetically pleasing! It's also more complicated in a multi-inverter environment, because other inverters on the same phase can see other inverters as "load" (as they aren't aware of each other), so this was another reason for ignoring the "load" values provided by GivTCP.

This is how I calculate load power, which has worked reliably in my various tests:

let totalSourcePower = inverterData.PV_Power + inverterData.Discharge_Power + inverterData.Import_Power;
let loadPower = totalSourcePower - inverterData.Charge_Power - inverterData.Export_Power;

If you're seeing a big deviation in values being shown in the web dashboard, feel free to share some updated JSON samples when you have power going to/from various sources (e.g. PV to house and to battery), and I can take a look.