kellerza / pysma

Async library for SMA Solar's WebConnect interface
MIT License
59 stars 51 forks source link

Incoming W per Phase from grid #59

Closed clasheleander closed 3 years ago

clasheleander commented 3 years ago

My custom sensors regarding this in homeassistant no longer work since update as I suspect it is not supported to run this custom sensors anymore? Can these sensors be added? Or is there any possibility to still run custom sensors? Iam using below sensors to monitor current incoming W on each Phase from grid. Sensors are from SUNNY TRIPOWER 10.0 (STP10.0-3AV-40 010) with SMA energy meter installed in the house.

  incoming_l1:
      key: '6100_0046EB00'
      unit: W
   incoming_l2:
      key: '6100_0046EC00'
      unit: W
   incoming_l3:
      key: '6100_0046ED00'
      unit: W

Thanks.

kellerza commented 3 years ago

Custom sensors should still work, see the homeassistant docs

Ideally you should add these to pysma here maybe as power_l1/power_l2/power_l3?

clasheleander commented 3 years ago

Thanks for your reply! Sorry if I ask but am new to this. I have put a pull request on changes, is this the right way? Can I test this in any way? as mentioned earlier, these no longer work as custom sensors, this broke during the last update. no custom sensors are loaded for the SMA integration from configuration.yaml Warning in logfile, "Loading SMA via platform setup is deprecated. Please remove it from your configuration"

Thanks!

kellerza commented 3 years ago

Thanks, I added those!

Maybe @rklomp can comment on the custom sensors not working for you

rklomp commented 3 years ago

@clasheleander While deprecated, customs sensors using yaml should still work. Could you post your full yaml for SMA so I could test this?

clasheleander commented 3 years ago

sma.txt @rklomp

Thanks!

Stopped to work after update to 2021.5

Here are yaml, (everything was uncomment before update and working) edit: attached .txt seems i cant get it right below...

sensor:
  - platform: sma
    host: 192.168.1.89
    ssl: true
    verify_ssl: false
    password: xxx
    group: installer
    sensors:
#      - pv_power
#      - pv_current
#      - pv_voltage
#      - pv_gen_meter
#      - total_yield
#      - daily_yield
#      - status
#      - current_l1
#      - current_l2
#      - current_l3
#      - grid_power
#      - grid_power_absorbed
#      - grid_power_supplied
    custom:
#       dc_current:
#          key: '6380_40251E00'
#          unit: W
#       dc_currentb:
#          key: '6380_40251E00_1'
#          unit: W
#       pv_currentb:
#          key: '6380_40452100_1'
#          unit: A
#          factor: 1000
#       pv_voltageb:
#          key: '6380_40451F00_1'
#          unit: V
#          factor: 100
#       active_power_l1:
#          key: '6100_40464000'
#          unit: W
#       active_power_l2:
#          key: '6100_40464100'
#          unit: W
#       active_power_l3:
#          key: '6100_40464200'
#          unit: W
       inkommande_l1:
          key: '6100_0046EB00'
          unit: W
       inkommande_l2:
          key: '6100_0046EC00'
          unit: W
       inkommande_l3:
          key: '6100_0046ED00'
          unit: W
rklomp commented 3 years ago

I have tested this in my environment and the custom sensors load just fine: image

rklomp commented 3 years ago

@clasheleander How does the Energy Meter work? Is it a separate device that is queried via the same web interface as the inverter? Do you know it there is a key that could be queried to detect if it is installed?

clasheleander commented 3 years ago

@rklomp SMA integration is installed using the gui. Can this be the cause? After meter are in installed the meter and inverter auto connects and start feeding readings to inverter and can then be seen in the inverter. The energy meter also have its own gui very similar as the inverter

rklomp commented 3 years ago

Ah that would explain. The custom custom sensor parameters are only loaded when initially configured via yaml.

clasheleander commented 3 years ago

image image image

rklomp commented 3 years ago

Thanks. Would you be able to provide an export of requests to getAllOnlValues.json and getAllParamValues.json? That would help locating the correct keys to query to determine if the energy meter is connected.

Login to the webinterface of your device and go to the "Home" page Open developer tools, go to network tab. Click clear in the top left and make sure recording is on.

While keeping the recording running: Go to page "Instantaneous values" (a request to getAllOnlValues.json should appear) Go to page "Device parameters" (a request to getAllParamValues.json should appear)

Save these requests as a HAR file and share that file.

This document might help: https://support.zendesk.com/hc/en-us/articles/204410413-Generating-a-HAR-file-for-troubleshooting

I am trying to create some logic to only load the Energy Meter sensors if the energy meter is actually connected, instead of having those sensors loaded for all users. So if I understand correctly you would also be able to add the energy meter as a separate device to HA? Could you create the same export of getAllOnlValues.json and getAllParamValues.json on the the energy meter GUI?

clasheleander commented 3 years ago

@rklomp

Of cource! Will do this asap. Childrens party here at the moment 😀.

clasheleander commented 3 years ago

What is the correct way to install this manualy? Uninstall from gui, Download to custom_components and start using yaml again with new sensorsnames from pysma file?

Thanks.

clasheleander commented 3 years ago

@rklomp

Childrens party is over. :)

Attached. tripower_10_instantaneous_values.har.txt tripower_10_device_parameters.har.txt sma_energy_meter_instantaneous_values.har.txt sma_energy_meter_device_parameters.har.txt

clasheleander commented 3 years ago

I solved the problem with custom sensors!

Anyway, It would have been good if the sensors were included in the core so you do not have to keep track of new functionality manually. :)

Thanks!

rklomp commented 3 years ago

I solved the problem with custom sensors!

Good to hear! It will only work if initially loaded from yaml. If configured from the GUI initially any new yaml will be ignored.

@rklomp

Childrens party is over. :)

Attached. tripower_10_instantaneous_values.har.txt tripower_10_device_parameters.har.txt sma_energy_meter_instantaneous_values.har.txt sma_energy_meter_device_parameters.har.txt

Thanks. I found the serial number in Energy_Meter_Add: 6800_008AA200 and Energy_Meter: 6800_008AA300. No idea what the difference is between these two.

6800_008AA200: {1: [{low: 0, high: null, val: 1901427721}]}
6800_008AA300: {1: [{low: 0, high: null, val: 1901427721}]}

In my sunnyboy this will return

6800_008AA200: {1: [{low: 0, high: null, val: 0}]}
6800_008AA300: {1: [{low: 0, high: null, val: null}]}

We have two options:

  1. Add both devices to HA and let the Tripower return values specific to solar panels only and Energy Meter only values specific to energy meter
  2. Add only the Tripower to HA en detect if Energy Meter is linked (using either of the two sensors above) and if so load both the solar and the energy meter sensors.

What do you think? Which one would be best? What would you prefer?

rklomp commented 3 years ago

@itinside. You are also using energy meter. Do you have an inverter as well?

clasheleander commented 3 years ago

hmm.. both would work well, see pros and cons with both options. there is not much for readings in energy meter self so this alone does not give me much personally, would be in installations where you only have a energy meter without an inverter. image

inverter uses these metrics for a lot of improved graphs and info. perhaps option 2 is easiest and best? While Option 1 provides readings for installations without inverter. Option 3 is to do both. Not many readings in energy meter to maintain. :)

image image image

clasheleander commented 3 years ago

on a second thought, the readings for Phase currents (Ampere per phase) is not listed the same way in the inverter and meter and could be useful to read in HA. Inverter only shows how much inverter provides in A per phase, not a combo from grid and gen(consumed) as meter. Inverter also only provides reading as long the sun is up :)

image

Sma energy meter: image

Inverter: image

kellerza commented 3 years ago

The energymeter by itself will not work with pysma - it sends multicast packets that an inverter etc uses for display. It does not have a Webconnect interface itself.

Even if you use Webconnect you can get energy meter readings in HomeAssistant using this add-on - https://github.com/kellerza/hassio-sma-em

rklomp commented 3 years ago

Looking at what @itinside and @clasheleander provide it seems it does have a webinterface and if queried directly returns values using device class 65.

clasheleander commented 3 years ago

@kellerza

Nice! Will try this! 👍

clasheleander commented 3 years ago

Looks like the meter have its own webservice. I can access meter the same way i access inverter. From a browser.

kellerza commented 3 years ago

I can also access mine through the web interface, but it is only for setup and no way to get any readings (firmware 1.02.04.R)

If I try to access any of the known URLs (without a SID) I get a 404 and redirected to the setup

kellerza commented 3 years ago

image

clasheleander commented 3 years ago

This is me logged in to meter ip from browser: image

Firmware 2.0.18.R

kellerza commented 3 years ago

Maybe I should try an update!

clasheleander commented 3 years ago

I think there are 2 versions of meter? Mine is called "emeter-20" Installed a year ago. Do you have an older one maybe?

clasheleander commented 3 years ago

image

kellerza commented 3 years ago

Seems I have the emeter-10, but from the website unclear if this is just new firmware or some new hardware https://www.sma.de/en/products/monitoring-control/sma-energy-meter.html#tab-content-243745-2 I've mailed their support & asked

rklomp commented 3 years ago

In my dev branch I have started working on a mapping between different device classes and applicable sensors https://github.com/rklomp/pysma/blob/dev/pysma/const.py#L269

@clasheleander, Looking at your har files it looks like the keys from the Energy Meter are different from the Keys of the same data received via the Inverter.

Could you have a look and compose a list of sensors you would like to get from either the inverter or the energy meter directly. I think the SENSOR_GRID_ACTIVE_POWER_CONSUMED_L1, _L2 and _L3 added by you are only applicable to installations that have a Energy Meter?

My idea is that if you connect to an Energy Meter directly you will get all sensors listed under DEVCLASS_ENERGY_METER. If you connect to an inverter without Energy Meter attached you will get DEVCLASS_INVERTER and if the energy meter is attached you will get DEVCLASS_INVERTER + ENERGY_METER_VIA_INVERTER.

Maybe some other sensors from the DEVCLASS_INVERTER list could be moved to ENERGY_METER_VIA_INVERTER as well, as I get a few that always return value None. For example: SENSOR_GRID_POWER_SUPPLIED, SENSOR_GRID_POWER_ABSORBED , SENSOR_GRID_TOTAL_YIELD and SENSOR_GRID_TOTAL_ABSORBED

rklomp commented 3 years ago

I have also updated the example script to easily test this. It should now retrieve the sensor list from DEVICE_MAP based on the device class. Sensors from ENERGY_METER_VIA_INVERTER will be added only if a serial number is found under SENSOR_ENERGY_METER.

https://github.com/rklomp/pysma/blob/dev/example.py

clasheleander commented 3 years ago

@rklomp Nice work! :) I have tried example.py, works perfecly! Below i have also added a few more sensors (all from sma energy meter that inverter lists)

Also, while we talking sensors, These two "old" sensors dont give me any readings: No values for sensors: current_consumption [6100_00543100],total_consumption [6400_00543A00] i have disable them in current version in HA (i cant find them in your dev const.py, have you removed them already?)

new sensors to be added in const.py:

SENSOR_GRID_PHASE_CURRENTS_L1 = { SKEY: "6100_40466500", SNAME: "grid_phase_currents_l1", SUNIT: "A", SFACTOR: 1000, } SENSOR_GRID_PHASE_CURRENTS_L2 = { SKEY: "6100_40466600", SNAME: "grid_phase_currents_l2", SUNIT: "A", SFACTOR: 1000, } SENSOR_GRID_PHASE_CURRENTS_L3 = { SKEY: "6100_40466B00", SNAME: "grid_phase_currents_l3", SUNIT: "A", SFACTOR: 1000, } SENSOR_GRID_SUPPLIED_POWER = { SKEY: "6100_40463600", SNAME: "grid_supplied_power", SUNIT: "W", }


ENERGY_METER_VIA_INVERTER: [
    SENSOR_GRID_ACTIVE_POWER_CONSUMED_L1,
    SENSOR_GRID_ACTIVE_POWER_CONSUMED_L2,
    SENSOR_GRID_ACTIVE_POWER_CONSUMED_L3,
SENSOR_GRID_PHASE_CURRENTS_L1,
SENSOR_GRID_PHASE_CURRENTS_L2,
SENSOR_GRID_PHASE_CURRENTS_L3,
SENSOR_GRID_SUPPLIED_POWER,
],

Log from example.py

DEBUG:asyncio:Using proactor: IocpProactor INFO:main:NEW SID: xtpqgFBQukfQAFB- DEBUG:pysma:Found device class 1 DEBUG:pysma:Sensor status: Will be decoded with "1"[0].val[0].tag from {'1': [{'val': [{'tag': 307}]}]} DEBUG:pysma:Loading sensors for device class 1 DEBUG:pysma:Sensor energy_meter: Will be decoded with "1"[0].val from {'1': [{'low': 0, 'high': None, 'val': 1901427721}]} DEBUG:pysma:Energy Meter with serial 1901427721 detected. Adding extra sensors. WARNING:pysma:Duplicate SMA sensor key 6100_40463600 (idx: 0) DEBUG:pysma:Sensor serial_number: Will be decoded with "1"[0].val from {'1': [{'low': 0, 'high': None, 'val': 3006927010}]} DEBUG:pysma:Sensor device_name: Will be decoded with "1"[0].val from {'1': [{'val': 'STP10.0-3AV-40 010'}]} DEBUG:pysma:Sensor device_type: Will be decoded with "1"[0].val[0].tag from {'1': [{'validVals': [9347, 9348], 'val': [{'tag': 9348}]}]} DEBUG:pysma:Sensor device_manufacturer: Will be decoded with "1"[0].val[0].tag from {'1': [{'validVals': [461], 'val': [{'tag': 461}]}]} serial 3006927010 name STP10.0-3AV-40 010 type SUNNY TRIPOWER 10.0 manufacturer SMA DEBUG:pysma:Sensor grid_power: Will be decoded with "1"[0].val from {'1': [{'val': 8137}]} DEBUG:pysma:Sensor power_l1: Will be decoded with "1"[0].val from {'1': [{'val': 2712}]} DEBUG:pysma:Sensor power_l2: Will be decoded with "1"[0].val from {'1': [{'val': 2702}]} DEBUG:pysma:Sensor power_l3: Will be decoded with "1"[0].val from {'1': [{'val': 2723}]} DEBUG:pysma:Sensor frequency: Will be decoded with "1"[0].val from {'1': [{'val': 5003}]} DEBUG:pysma:Sensor voltage_l1: Will be decoded with "1"[0].val from {'1': [{'val': 24111}]} DEBUG:pysma:Sensor voltage_l2: Will be decoded with "1"[0].val from {'1': [{'val': 24095}]} DEBUG:pysma:Sensor voltage_l3: Will be decoded with "1"[0].val from {'1': [{'val': 24228}]} DEBUG:pysma:Sensor current_l1: Will be decoded with "1"[0].val from {'1': [{'val': 11263}]} DEBUG:pysma:Sensor current_l2: Will be decoded with "1"[0].val from {'1': [{'val': 11242}]} DEBUG:pysma:Sensor current_l3: Will be decoded with "1"[0].val from {'1': [{'val': 11269}]} DEBUG:pysma:Sensor pv_power_a: Will be decoded with "1"[0].val from {'1': [{'val': 6197}, {'val': 2249}]} DEBUG:pysma:Sensor pv_power_b: Will be decoded with "1"[1].val from {'1': [{'val': 6197}, {'val': 2249}]} DEBUG:pysma:Sensor pv_voltage_a: Will be decoded with "1"[0].val from {'1': [{'val': 40922}, {'val': 38355}]} DEBUG:pysma:Sensor pv_voltage_b: Will be decoded with "1"[1].val from {'1': [{'val': 40922}, {'val': 38355}]} DEBUG:pysma:Sensor pv_current_a: Will be decoded with "1"[0].val from {'1': [{'val': 15145}, {'val': 5864}]} DEBUG:pysma:Sensor pv_current_b: Will be decoded with "1"[1].val from {'1': [{'val': 15145}, {'val': 5864}]} DEBUG:pysma:Sensor pv_gen_meter: Will be decoded with "1"[0].val from {'1': [{'val': 8640494}]} DEBUG:pysma:Sensor total_yield: Will be decoded with "1"[0].val from {'1': [{'val': 8624741}]} DEBUG:pysma:Sensor daily_yield: Will be decoded with "1"[0].val from {'1': [{'val': 15215}]} DEBUG:pysma:Sensor grid_power_supplied: Will be decoded with "1"[0].val from {'1': [{'val': 7544}]} DEBUG:pysma:Sensor grid_power_absorbed: Will be decoded with "1"[0].val from {'1': [{'val': 0}]} DEBUG:pysma:Sensor grid_total_yield: Will be decoded with "1"[0].val from {'1': [{'val': 4493548}]} DEBUG:pysma:Sensor grid_total_absorbed: Will be decoded with "1"[0].val from {'1': [{'val': 6360166}]} DEBUG:pysma:Sensor status: Will be decoded with "1"[0].val[0].tag from {'1': [{'val': [{'tag': 307}]}]} DEBUG:pysma:Sensor grid_active_power_consumed_l1: Will be decoded with "1"[0].val from {'1': [{'val': 0}]} DEBUG:pysma:Sensor grid_active_power_consumed_l2: Will be decoded with "1"[0].val from {'1': [{'val': 0}]} DEBUG:pysma:Sensor grid_active_power_consumed_l3: Will be decoded with "1"[0].val from {'1': [{'val': 0}]} DEBUG:pysma:Sensor grid_phase_currents_l1: Will be decoded with "1"[0].val from {'1': [{'val': 9776}]} DEBUG:pysma:Sensor grid_phase_currents_l2: Will be decoded with "1"[0].val from {'1': [{'val': 10687}]} DEBUG:pysma:Sensor grid_phase_currents_l3: Will be decoded with "1"[0].val from {'1': [{'val': 10928}]} DEBUG:pysma:Sensor grid_supplied_power: Will be decoded with "1"[0].val from {'1': [{'val': 7544}]} grid_power 8137 W power_l1 2712 W power_l2 2702 W power_l3 2723 W frequency 50.03 Hz voltage_l1 241.11 V voltage_l2 240.95 V voltage_l3 242.28 V current_l1 11.263 A current_l2 11.242 A current_l3 11.269 A pv_power_a 6197 W pv_power_b 2249 W pv_voltage_a 409.22 V pv_voltage_b 383.55 V pv_current_a 15.145 A pv_current_b 5.864 A pv_gen_meter 8640.494 kWh total_yield 8624.741 kWh daily_yield 15215 Wh grid_power_supplied 7544 W grid_power_absorbed 0 W grid_total_yield 4493.548 kWh grid_total_absorbed 6360.166 kWh status Ok grid_active_power_consumed_l1 0 W grid_active_power_consumed_l2 0 W grid_active_power_consumed_l3 0 W grid_phase_currents_l1 9.776 A grid_phase_currents_l2 10.687 A grid_phase_currents_l3 10.928 A grid_supplied_power 7544 W

clasheleander commented 3 years ago

The new sensors added from inventer:

image

rklomp commented 3 years ago

current_consumption and total_consumption have been removed as it looks like they dont work for anyone.

SENSOR_GRID_SUPPLIED_POWER already exists as SENSOR_GRID_POWER_SUPPLIED

I think SENSOR_GRID_POWER_ABSORBED , SENSOR_GRID_TOTAL_YIELD and SENSOR_GRID_TOTAL_ABSORBED could be moved to ENERGY_METER_VIA_INVERTER as well?

These are not showing any values at my setup image

clasheleander commented 3 years ago

You are right, SENSOR_GRID_SUPPLIED_POWER are same as SENSOR_GRID_POWER_SUPPLIED. Would the be happy if you only add these to meter section then:

SENSOR_GRID_PHASE_CURRENTS_L1 = { SKEY: "6100_40466500", SNAME: "grid_phase_currents_l1", SUNIT: "A", SFACTOR: 1000, } SENSOR_GRID_PHASE_CURRENTS_L2 = { SKEY: "6100_40466600", SNAME: "grid_phase_currents_l2", SUNIT: "A", SFACTOR: 1000, } SENSOR_GRID_PHASE_CURRENTS_L3 = { SKEY: "6100_40466B00", SNAME: "grid_phase_currents_l3", SUNIT: "A", SFACTOR: 1000, }

I also agree on SENSOR_GRID_POWER_ABSORBED, SENSOR_GRID_TOTAL_YIELD, SENSOR_GRID_TOTAL_ABSORBED. these should be moved to meter aswell.

rklomp commented 3 years ago

What is the difference between these new sensors and the existing current sensors?

SENSOR_CURRENT_L1 = {
    SKEY: "6100_40465300",
    SNAME: "current_l1",
    SUNIT: "A",
    SFACTOR: 1000,
}
SENSOR_CURRENT_L2 = {
    SKEY: "6100_40465400",
    SNAME: "current_l2",
    SUNIT: "A",
    SFACTOR: 1000,
}
SENSOR_CURRENT_L3 = {
    SKEY: "6100_40465500",
    SNAME: "current_l3",
    SUNIT: "A",
    SFACTOR: 1000,
}
rklomp commented 3 years ago

Would metering_current_l1, metering_current_l2 and metering_current_l3 be a more applicable name for your sensors?

We could name everything under the "Grid measurements" drop down with grid_xxx and everything under "Measured values" drop down with metering_xxx

Are values under "Measured values" all related to the Energy Meter?

clasheleander commented 3 years ago

The difference is that values from"grid_phase_currents_l1", "grid_phase_currents_l2", "grid_phase_currents_l3" shows values at "main-fuses" before grid. current load (in or out) at "main-fuses" on each phase. current_l1, current_l2, current_l3 shows values with provided Ampere from inverter to home before grid on each phase (only generation).

The big difference i personaly like is that you gets readings in both Ampere ("grid_phase_currents_lx) for Ampere passing "main-fuses" when the sun is down or up on each phase and Watt (grid_active_power_consumed_lx) on each phase when the sun is up (if the inverter does not generate enough on a specific phase and need to take energy from grid) and when sun is down i see consumption on each phase. What i dont know yet is what hapends to "grid_phase_currents_lx" readings after the sun is down (just added those as customs). Iam hopfully getting readings on those even if the inverter "sleeps" like i get from grid_active_power_consumed_lx today :)

I started the dryer that runs on phase 2 to visualize this: image

I have no problem with the name, metering_current_l sounds good to me :) I think that Measured values all are related to energy meter, but i am not 100% sure.

clasheleander commented 3 years ago

@rklomp "SENSOR_GRID_POWER_SUPPLIED", how are your readings on this one without energy meter? This is for me power to grid, after home cunsumption. Should this be moved to Meter aswell?

rklomp commented 3 years ago

SENSOR_GRID_POWER_SUPPLIED is showing the power supplied to the grid. The value is always the same as under PV Generation (key 6100_0046C200). Are these two also always the same for you?

image image showing slight difference due to time interval between screenshots...

clasheleander commented 3 years ago

Your readings are AC generation i think (Generation to home+grid) and not only generation to grid. please see my screenshot (supplied power are export to grid only.) Hmm, Got two sensors with same value when searching for the value listed "Supplied Power" "6100_40463600":{"1":[{"val":7669} "6100_40468F00":{"1":[{"val":7669}

Will try 6100_40468F00 as custom..

image

rklomp commented 3 years ago

Ah I mentioned the wrong name SENSOR_GRID_POWER is equal to the value shown under PV Generation. SENSOR_GRID_POWER_SUPPLIED is not showing anything. I guess this can be moved to Meter as well

The only values that I have under "Measured Values" are Total yield, Daily yield, Operating time and Feed-in time The rest is showing -------

clasheleander commented 3 years ago

Seems 6100_40463600 and 6100_40468F00 give same readings for me. Is your sensor "grid_power" and "grid_power_supplied" with same value on your installation without energy meter? EDIT: just read your answer above.

image

clasheleander commented 3 years ago

Ok, i have data on almost all under Measured Values, this is what you are "missing" :)

image

clasheleander commented 3 years ago

I actualy think that sensor 6100_40468F00 (grid_supplied_power) shows different readings when comparing inverter gui (Supplied power) and HA. 6100_40463600 (grid_power_supplied) are more close and should still be used. (but moved to meter section, since your not getting any values on this one)

rklomp commented 3 years ago

I have updated the list https://github.com/rklomp/pysma/blob/dev/pysma/const.py Ordered the sensors in the file based on the headers in the GUI. Could you verify all sensors in the ENERGY_METER_VIA_INVERTER list? And test them again using example.py?

Do you require sensors for Apparent Power and Reactive Power?

rklomp commented 3 years ago

I see 6100_40468F00 actually is the Apparent power under Grid measurements.

clasheleander commented 3 years ago

Nice, looking good! thanks!

I personally do not look on values for Apparent and Reactive Power.

DEBUG:asyncio:Using proactor: IocpProactor INFO:main:NEW SID: yNnQMLx3IXl3ZKBV DEBUG:pysma:Found device class 1 DEBUG:pysma:Sensor status: Will be decoded with "1"[0].val[0].tag from {'1': [{'val': [{'tag': 307}]}]} DEBUG:pysma:Loading sensors for device class 1 DEBUG:pysma:Sensor energy_meter: Will be decoded with "1"[0].val from {'1': [{'low': 0, 'high': None, 'val': 1901427721}]} DEBUG:pysma:Energy Meter with serial 1901427721 detected. Adding extra sensors. DEBUG:pysma:Sensor serial_number: Will be decoded with "1"[0].val from {'1': [{'low': 0, 'high': None, 'val': 3006927010}]} DEBUG:pysma:Sensor device_name: Will be decoded with "1"[0].val from {'1': [{'val': 'STP10.0-3AV-40 010'}]} DEBUG:pysma:Sensor device_type: Will be decoded with "1"[0].val[0].tag from {'1': [{'validVals': [9347, 9348], 'val': [{'tag': 9348}]}]} DEBUG:pysma:Sensor device_manufacturer: Will be decoded with "1"[0].val[0].tag from {'1': [{'validVals': [461], 'val': [{'tag': 461}]}]} serial 3006927010 name STP10.0-3AV-40 010 type SUNNY TRIPOWER 10.0 manufacturer SMA DEBUG:pysma:Sensor status: Will be decoded with "1"[0].val[0].tag from {'1': [{'val': [{'tag': 307}]}]} DEBUG:pysma:Sensor pv_power_a: Will be decoded with "1"[0].val from {'1': [{'val': 1315}, {'val': 557}]} DEBUG:pysma:Sensor pv_power_b: Will be decoded with "1"[1].val from {'1': [{'val': 1315}, {'val': 557}]} DEBUG:pysma:Sensor pv_voltage_a: Will be decoded with "1"[0].val from {'1': [{'val': 41757}, {'val': 38629}]} DEBUG:pysma:Sensor pv_voltage_b: Will be decoded with "1"[1].val from {'1': [{'val': 41757}, {'val': 38629}]} DEBUG:pysma:Sensor pv_current_a: Will be decoded with "1"[0].val from {'1': [{'val': 3153}, {'val': 1442}]} DEBUG:pysma:Sensor pv_current_b: Will be decoded with "1"[1].val from {'1': [{'val': 3153}, {'val': 1442}]} DEBUG:pysma:Sensor grid_power: Will be decoded with "1"[0].val from {'1': [{'val': 1816}]} DEBUG:pysma:Sensor frequency: Will be decoded with "1"[0].val from {'1': [{'val': 4998}]} DEBUG:pysma:Sensor current_l1: Will be decoded with "1"[0].val from {'1': [{'val': 2578}]} DEBUG:pysma:Sensor current_l2: Will be decoded with "1"[0].val from {'1': [{'val': 2572}]} DEBUG:pysma:Sensor current_l3: Will be decoded with "1"[0].val from {'1': [{'val': 2571}]} DEBUG:pysma:Sensor voltage_l1: Will be decoded with "1"[0].val from {'1': [{'val': 23806}]} DEBUG:pysma:Sensor voltage_l2: Will be decoded with "1"[0].val from {'1': [{'val': 23571}]} DEBUG:pysma:Sensor voltage_l3: Will be decoded with "1"[0].val from {'1': [{'val': 23737}]} DEBUG:pysma:Sensor power_l1: Will be decoded with "1"[0].val from {'1': [{'val': 609}]} DEBUG:pysma:Sensor power_l2: Will be decoded with "1"[0].val from {'1': [{'val': 601}]} DEBUG:pysma:Sensor power_l3: Will be decoded with "1"[0].val from {'1': [{'val': 606}]} DEBUG:pysma:Sensor total_yield: Will be decoded with "1"[0].val from {'1': [{'val': 8652554}]} DEBUG:pysma:Sensor daily_yield: Will be decoded with "1"[0].val from {'1': [{'val': 43028}]} DEBUG:pysma:Sensor pv_gen_meter: Will be decoded with "1"[0].val from {'1': [{'val': 8668307}]} DEBUG:pysma:Sensor metering_power_supplied: Will be decoded with "1"[0].val from {'1': [{'val': 1303}]} DEBUG:pysma:Sensor metering_power_absorbed: Will be decoded with "1"[0].val from {'1': [{'val': 0}]} DEBUG:pysma:Sensor metering_total_yield: Will be decoded with "1"[0].val from {'1': [{'val': 4518425}]} DEBUG:pysma:Sensor metering_total_absorbed: Will be decoded with "1"[0].val from {'1': [{'val': 6360167}]} DEBUG:pysma:Sensor metering_current_l1: Will be decoded with "1"[0].val from {'1': [{'val': 1441}]} DEBUG:pysma:Sensor metering_current_l2: Will be decoded with "1"[0].val from {'1': [{'val': 2487}]} DEBUG:pysma:Sensor metering_current_l3: Will be decoded with "1"[0].val from {'1': [{'val': 2308}]} DEBUG:pysma:Sensor metering_voltage_l1: Will be decoded with "1"[0].val from {'1': [{'val': 23910}]} DEBUG:pysma:Sensor metering_voltage_l2: Will be decoded with "1"[0].val from {'1': [{'val': 23651}]} DEBUG:pysma:Sensor metering_voltage_l3: Will be decoded with "1"[0].val from {'1': [{'val': 23750}]} DEBUG:pysma:Sensor metering_active_power_l1: Will be decoded with "1"[0].val from {'1': [{'val': 235}]} DEBUG:pysma:Sensor metering_active_power_l2: Will be decoded with "1"[0].val from {'1': [{'val': 568}]} DEBUG:pysma:Sensor metering_active_power_l3: Will be decoded with "1"[0].val from {'1': [{'val': 500}]} DEBUG:pysma:Sensor metering_active_power_consumed_l1: Will be decoded with "1"[0].val from {'1': [{'val': 0}]} DEBUG:pysma:Sensor metering_active_power_consumed_l2: Will be decoded with "1"[0].val from {'1': [{'val': 0}]} DEBUG:pysma:Sensor metering_active_power_consumed_l3: Will be decoded with "1"[0].val from {'1': [{'val': 0}]} status Ok pv_power_a 1315 W pv_power_b 557 W pv_voltage_a 417.57 V pv_voltage_b 386.29 V pv_current_a 3.153 A pv_current_b 1.442 A grid_power 1816 W frequency 49.98 Hz current_l1 2.578 A current_l2 2.572 A current_l3 2.571 A voltage_l1 238.06 V voltage_l2 235.71 V voltage_l3 237.37 V power_l1 609 W power_l2 601 W power_l3 606 W total_yield 8652.554 kWh daily_yield 43028 Wh pv_gen_meter 8668.307 kWh metering_power_supplied 1303 W metering_power_absorbed 0 W metering_total_yield 4518.425 kWh metering_total_absorbed 6360.167 kWh metering_current_l1 1.441 A metering_current_l2 2.487 A metering_current_l3 2.308 A metering_voltage_l1 239.1 V metering_voltage_l2 236.51 V metering_voltage_l3 237.5 V metering_active_power_l1 235 W metering_active_power_l2 568 W metering_active_power_l3 500 W metering_active_power_consumed_l1 0 W metering_active_power_consumed_l2 0 W metering_active_power_consumed_l3 0 W

rklomp commented 3 years ago

Awesome! I think we completely covered the Energy Meter via Inverter case now 😃 I just added the metering_frequency as well. If anyone wants to have Apparent Power and Reactive Power we could easily add that later.

Now about querying the Energy Meter directly. This will load the DEVCLASS_ENERGY_METER sensors. Does that cover everything or are there more sensors that could be added?