kellerza / pysma

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

Sensors for Home Assistant #13

Closed kaluxx closed 5 years ago

kaluxx commented 6 years ago

I have HA running with connection tomy sma sunny boy 3.6 -40.

Nevertheless I do only get the first 4 Sensors from the list integrated:

SENSORS = [
    Sensor('current_consumption', '6100_00543100', 'W'),
    Sensor('current_power', '6100_40263F00', 'W'),
    Sensor('total_consumption', '6400_00543A00', 'kWh', 1000),
    Sensor('total_yield', '6400_00260100', 'kWh', 1000),
    Sensor('grid_voltage', '6100_00464800', 'V'),
    Sensor('pv_power', '6100_0046C200', 'W'),
    Sensor('daily_yield', '6400_00262200', 'Wh'),
    Sensor('power_supplied', '6100_00464800', 'W'),
    Sensor('power_absorbed', '6100_00464800', 'W'),
    Sensor('status', '6180_08214800', '', None, '."1"[].val[0].tag'),
]

adding the other sensors results in a faulty configuration.yaml. What helps is to integrate custom sensors . These sensor defintions work for me:

 sensors:
      current_consumption:
      current_power:
      total_consumption:
      total_yield:
      sma_grid_voltage:
      sma_daily_yield:
    custom:
        sma_grid_voltage:
            key: "6100_00464800"
            unit: V
        sma_daily_yield:
            key: "6400_00262200"
            unit: Wh
kellerza commented 6 years ago

grid_voltage and daily_yield should be available on 0.82 onward (https://github.com/home-assistant/home-assistant/pull/18335) - introduced in #17988

power_supplied and power_absorbed does look the same .. 😕

If you find any new keys, feel free to PR here, or post it in an issue...

kellerza commented 5 years ago

Added daily yield and fixed the duplicates - here unfortunately don't have daily consumption yet

kaluxx commented 5 years ago

I believe daily consumption is nor available by sma as a separate counter. On their web sites they use the total consumption to calculate the value.

riki-dexter commented 5 years ago

Hi @kaluxx, Can you tell me how to calculate daily consumption? Thank you

kaluxx commented 5 years ago

Hi riki,

with Home Assistant they have a component 'utility meter' Using this you can derive what you like from the total values. This is th related configuration: utility_meter: daily_consumption: source: sensor.total_consumption cycle: daily

See also the complete topic: https://community.home-assistant.io/t/how-to-calculate-daily-power-consumption-from-dsmr-sensors/37696