tijsverkoyen / HomeAssistant-FusionSolar

Integrate FusionSolar into your Home Assistant.
MIT License
133 stars 25 forks source link

Support Bridge type #112

Closed angel9484 closed 9 months ago

angel9484 commented 9 months ago

You actually support two modes that you explain crearly their pros and cons: api and kiosk there is a third way connecting directly to the Huawei inverter using a modbus tcp with ip as bridge (port 6607): https://pypi.org/project/huawei-solar/ I think this third way avoids the rate limits and also returns always fresh data every time you fetch it

I am currently working to support it (i just started) in your project. Im creating the issue to let you know and to try to know from your side if any of my assumptions are not valid (fresh data / rate limit).

I tried in the past this lib sucessfully, you have to edit some settings in the control panel of the huawei inverter, but after enabling this the code is quite simple to fetch the raw data:

import huawei_solar
from huawei_solar import Result

async def get_info():
    # https://pypi.org/project/huawei-solar/
    bridge = await huawei_solar.HuaweiSolarBridge.create(host="xx.xx.xx.xx", port=6607)
    return await bridge.update()

async def export_all_inverter_data():
    inverter_information = await get_info()
    for solar_metric_key, solar_metric_value in inverter_information.items():
            await print(extract_input_power(solar_metric_value))

# This line inside a loop that runs every X unit-periods
asyncio.run(inverter_exporter.export_all_inverter_data())
tijsverkoyen commented 9 months ago

I think you should use https://github.com/wlcrs/huawei_solar

I don’t think I will be interesting in supporting modbus also. As it is not something I use myself.

angel9484 commented 9 months ago

You're right. Closing issue Thanks and apologies!