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

benning #1371

Merged
merged 2 commits into from
Mar 26, 2024
Merged

benning #1371

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
37 changes: 37 additions & 0 deletions packages/modules/devices/benning/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
from typing import Optional
from helpermodules.auto_str import auto_str
from modules.devices.json.config import Json, JsonConfiguration, JsonInverterConfiguration, JsonInverterSetup


@auto_str
class BenningConfiguration(JsonConfiguration):
def __init__(self, url: Optional[str] = None):
self.url = "http://" + url + "/getentries.cgi?oids=11369,19000"


@auto_str
class Benning(Json):
def __init__(self,
name: str = "Benning",
type: str = "benning",
id: int = 0,
configuration: BenningConfiguration = None) -> None:
super().__init__(name, type, id, configuration)


@auto_str
class BenningInverterConfiguration:
def __init__(self):
pass
Comment on lines +23 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@auto_str
class BenningInverterConfiguration:
def __init__(self):
pass

Auf diese Klasse wird nicht zugegriffen.



@auto_str
class BenningInverterSetup(JsonInverterSetup):
def __init__(self,
name: str = "Benning Wechselrichter",
type: str = "inverter",
id: int = 0,
configuration: JsonInverterConfiguration = None) -> None:
super().__init__(name, type, id, JsonInverterConfiguration(
jq_power=".[]|select(.oid==11365)|.val|tonumber", jq_exported=".[]|select(.oid==19000)|.val|tonumber"))
13 changes: 13 additions & 0 deletions packages/modules/devices/benning/device.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
import logging
from modules.common.abstract_device import DeviceDescriptor
from modules.devices.benning.config import Benning
from modules.devices.json.device import create_device as create_device_json
log = logging.getLogger(__name__)


def create_device(device_config: Benning):
return create_device_json(device_config)


device_descriptor = DeviceDescriptor(configuration_factory=Benning)
6 changes: 6 additions & 0 deletions packages/modules/devices/benning/inverter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3
from modules.common.component_type import ComponentDescriptor
from modules.devices.benning.config import BenningInverterSetup


component_descriptor = ComponentDescriptor(configuration_factory=BenningInverterSetup)
Empty file.
37 changes: 37 additions & 0 deletions packages/modules/devices/opendtu/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
from typing import Optional
from helpermodules.auto_str import auto_str
from modules.devices.json.config import Json, JsonConfiguration, JsonInverterConfiguration, JsonInverterSetup


@auto_str
class OpenDTUConfiguration(JsonConfiguration):
def __init__(self, url: Optional[str] = None):
self.url = "http://" + url + "/api/livedata/status"


@auto_str
class OpenDTU(Json):
def __init__(self,
name: str = "OpenDTU",
type: str = "opendtu",
id: int = 0,
configuration: OpenDTUConfiguration = None) -> None:
super().__init__(name, type, id, configuration)


@auto_str
class OpenDTUInverterConfiguration:
def __init__(self):
pass
Comment on lines +23 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@auto_str
class OpenDTUInverterConfiguration:
def __init__(self):
pass

Auf diese Klasse wird nicht zugegriffen.



@auto_str
class OpenDTUInverterSetup(JsonInverterSetup):
def __init__(self,
name: str = "Hoymiles Wechselrichter",
type: str = "inverter",
id: int = 0,
configuration: JsonInverterConfiguration = None) -> None:
super().__init__(name, type, id, JsonInverterConfiguration(
jq_power=".total.Power.v", jq_exported=".total.YieldTotal.v*1000"))
13 changes: 13 additions & 0 deletions packages/modules/devices/opendtu/device.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
import logging
from modules.common.abstract_device import DeviceDescriptor
from modules.devices.opendtu.config import OpenDTU
from modules.devices.json.device import create_device as create_device_json
log = logging.getLogger(__name__)


def create_device(device_config: OpenDTU):
return create_device_json(device_config)


device_descriptor = DeviceDescriptor(configuration_factory=OpenDTU)
6 changes: 6 additions & 0 deletions packages/modules/devices/opendtu/inverter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3
from modules.common.component_type import ComponentDescriptor
from modules.devices.opendtu.config import OpenDTUInverterSetup


component_descriptor = ComponentDescriptor(configuration_factory=OpenDTUInverterSetup)