Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend class method "async def real_time_api(ip_address, port=80, pwd="")" with inverter #105

Open
emichel11 opened this issue Jan 3, 2023 · 1 comment

Comments

@emichel11
Copy link

The discover process takes some time or - in my case does not work properly
Actually the method
async def real_time_api(ip_address, port=80, pwd=""):
i = await discover(ip_address, port, pwd)
return RealTimeAPI(i)

calls discover and this method scans all available classes in regestry
async def discover(host, port, pwd="") -> Inverter:
failures = []
for inverter in REGISTRY:

It shall be possible to predefine the INVERTER for real_time_api / discover method. This will speedup
the process for known inverters

@MatthiasFraass
Copy link

Agreed.

Meanwhile this is the code for direct use of a known inverter:

import solax
import asyncio

from solax.inverters import QVOLTHYBG33P
from solax import RealTimeAPI

async def work():
    i = QVOLTHYBG33P._build('IP_OF_WIFI_DONGLE', 80, 'SERIAL_NUMER_OF_WIFI_DONGLE')
    r = RealTimeAPI(i)
    return await r.get_data()

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
data = loop.run_until_complete(work())
print(data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants