Skip to content

Commit

Permalink
adding get_models() back in, since we will need it in home assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
brew-your-own committed Mar 21, 2024
1 parent 52b2a91 commit aea09c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions solax/discovery.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import logging
import typing
from typing import List

from solax.inverter import Inverter, InverterError
from solax.inverters import (
Expand Down Expand Up @@ -102,3 +103,9 @@ async def discover(host, port, pwd="", model=None) -> Inverter:
discover_state = DiscoveryState()
await discover_state.discover(host, port, pwd, model)
return discover_state.get_discovered_inverter()


def get_models() -> List[str]:
models = list(map(lambda inverter: inverter.__name__, REGISTRY))
models.sort()
return models
1 change: 1 addition & 0 deletions tests/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async def test_discovery_with_model(inverters_fixture):
conn, inverter_class, _ = inverters_fixture
rt_api = await solax.real_time_api(*conn, "", inverter_class.__name__)
assert rt_api.inverter.__class__ == inverter_class
assert inverter_class.__name__ in solax.discovery.get_models()


@pytest.mark.asyncio
Expand Down

0 comments on commit aea09c3

Please sign in to comment.