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

Speed up discovery by leveraging asyncio even more #115

Conversation

Darsstar
Copy link
Contributor

@Darsstar Darsstar commented Jun 2, 2023

I came across this comment while trying to look for issues/PRs that might be related to me not being able to add my X1-1.1-S-D(L) to Home Assistant. I have a Solax X1 Mini with a wifi pock 3.0 dongle.

Those changes and the following PyCharm scratch file work:

import solax
import asyncio

async def work():
    r = await solax.real_time_api('192.168.1.174', pwd="XXREDACTEDXX")
    return await r.get_data()

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

It gives the following output after about 6 seconds, instead of hanging lang enough that I kill the process:

InverterResponse(data={'Network Voltage': 242.4, 'Output Current': 0.3, 'AC Power': 36.0, 'PV1 Voltage': 122.0, 'PV2 Voltage': 0.0, 'PV1 Current': 0.3, 'PV2 Current': 0.0, 'PV1 Power': 46.0, 'PV2 Power': 0.0, 'Grid Frequency': 49.97, 'Total Energy': 462.9, "Today's Energy": 5.0, 'Total Feed-in Energy': 112.9, 'Total Consumption': 0.0, 'Power Now': 0.0, 'Inverter Temperature': 34.0}, serial_number='XXREDACTEDXX', version='3.006.04', type=4, inverter_type=4)

@Darsstar Darsstar force-pushed the describe-inverters-with-json branch 5 times, most recently from cc0aa34 to 2ce492b Compare June 3, 2023 16:39
@Darsstar Darsstar force-pushed the describe-inverters-with-json branch from 12176db to 40adf45 Compare June 6, 2023 12:57
@Darsstar Darsstar force-pushed the describe-inverters-with-json branch from 40adf45 to 69faf66 Compare June 6, 2023 12:59
@Darsstar Darsstar mentioned this pull request Jul 31, 2023
@Darsstar Darsstar deleted the branch squishykid:describe-inverters-with-json April 2, 2024 06:49
@Darsstar Darsstar closed this Apr 2, 2024
@Darsstar Darsstar deleted the describe-inverters-with-json branch April 2, 2024 06:49
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

Successfully merging this pull request may close these issues.

1 participant