-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* benning * add OpenDTU module
- Loading branch information
Showing
8 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
@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")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
@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")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |