home-assistant-ecosystem / python-mystrom

Asynchronous Python API client for interacting with myStrom devices (plug, bulb, and button).
MIT License
15 stars 13 forks source link

myStrom Wifi Switch photovoltaic #41

Open Pythonaire opened 1 year ago

Pythonaire commented 1 year ago

the switch has the ability be used for photovoltaic unit. In this case, i want to read the earned Watt. I just find power consumption. How can i read the power delivery value?

fabaff commented 1 year ago

I don't know as the documentation doesn't mention this. It's probably only available in the myStrom App.

Pythonaire commented 1 year ago

by using wireshark i see, the "homekit certification label" is just a simple Outlet switch and temperature sensor. To see energy, the separate app is needed. Feeling duped by the marketing. :-(

dbrgn commented 1 week ago

If you call the /report endpoint, you get the following output:

{
    "Ws": 26.43,
    "boot_id": "85A81EF3",
    "energy_since_boot": 278809314.67,
    "power": 27.29,
    "relay": true,
    "temperature": 20.58,
    "time_since_boot": 2612678
}

-> energy_since_boot should be what you need (#48). The endpoint needs to be called periodically to get the statistics you want.

If you use HomeAssistant, you can also use an integration instead to calculate energy production (or consumption).

sensor:  - platform: integration
    source: sensor.mystrom_solar_leistung
    unique_id: balkonsolar_production
    name: "myStrom Solar Production"
    unit_prefix: k
    round: 3

(Source sensor must be adjusted of course.)