Support MeterDiv involvement in Watt calculation.

This commit is contained in:
Victor Chang
2024-06-13 23:55:03 -07:00
parent 5ac97c9e90
commit b47be0769f
2 changed files with 22 additions and 10 deletions

View File

@@ -102,7 +102,7 @@ Blank cells have never been seen to be anything other than zero. Some cells have
<tr> <th>12</th> <td colspan=1></td><td colspan=1 align="center">0x01</td><td colspan=2></td></tr>
<tr> <th>16</th> <td colspan=1 align="center">0x25</td><td colspan=3 align="center">ExportWh~</td></tr>
<tr> <th>20</th> <td colspan=1 align="center">~ExportWh</td><td colspan=2></td><td colspan=1 align="center">0x01</td></tr>
<tr> <th>24</th> <td colspan=1 align="center">0x03</td><td colspan=1></td><td colspan=1 align="center">0x22</td><td colspan=1 align="center">0x01</td></tr>
<tr> <th>24</th> <td colspan=1 align="center">0x03</td><td colspan=1></td><td colspan=1 align="center">0x22</td><td colspan=1 align="center">MeterDiv</td></tr>
<tr> <th>28</th> <td colspan=2></td><td colspan=1 align="center">0x02</td><td colspan=1 align="center">0x03</td></tr>
<tr> <th>32</th> <td colspan=1></td><td colspan=1 align="center">0x22</td><td colspan=2 align="center">EnergyCostUnit</td></tr>
<tr> <th>36</th> <td colspan=1></td><td colspan=1></td><td colspan=1 align="center">0x04</td><td colspan=1></td></tr>
@@ -123,20 +123,26 @@ Bytes 17 to 20, (32 bit int, probably unsigned, LSB)
Cumulative watt-hours sent to the grid. Unknown when the value resets, but probably never resets since ESP32 never sends a clock sync to the MGM111 so it likely just rolls over.
#### PowerVal
#### MeterDiv
Bytes 41 and 43 (24 bit signed int, LSB)
Byte 27
The power being sent or consumed at this moment. This is in watts for me but I know in the V2 payload that there is a `MeterDiv`, which means `PowerVal` might be a multiplication of the real wattage. If V7 also has this behavior then `MeterDiv` must have a value of 1 in my readings. So, `MeterDiv` might be byte 2, 13, 23, or 27.
Used in conjunction with `EnergyCostUnit` and `PowerVal` to calculate the actual wattage.
#### EnergyCostUnit(?)
#### EnergyCostUnit
Bytes 34 and 35 LSB
Usually `0xE803`, which is `0x03E8` = `1000`. Continuing the V2 theorization that this is the number of watt-hour units per "cost unit".
Since people are typically charged per kWh, this value is typically 1000.
This value is not currently used in the code.
#### PowerVal
Bytes 41 and 43 (24 bit signed int, LSB)
The power being sent or consumed at this moment. The actual wattage is calculated with the formula:
`Watts = PowerVal * MeterDiv / (EnergyCostUnit / 1000)`
#### Incrementor