forked from snaptec/openWB
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit e683c1d Author: okaegi <72255431+okaegi@users.noreply.github.com> Date: Mon Jun 12 16:19:44 2023 +0200 Smarthome... (snaptec#2739) * Smarthome... Neu wird das MQTT topic mess_only gepflegt. Wenn "kein Gerät" (also nur rein Leisungsmessung definiert ist der wert 1 sonst 0. Hier kann in Zukunft das GUI abfragen ob überhaupt automatisch / manual Modus angezeigt wird (oder nicht einfach nur "nur Messung") Lambda driver wurde an python logging angepasst * flake8 * Smarthome... topic wurde von mess_only auf meas_only umbenannt, * Revert "Smarthome..." This reverts commit 712f618. * Revert "flake8" This reverts commit f1925e8. * revert change * sleep Sleep aus Smartcommon in smarthomemq verlagert (braucht es nur für 1.9) commit 274690b Author: LKuemmel <76958050+LKuemmel@users.noreply.github.com> Date: Tue Jun 6 09:12:36 2023 +0200 youless (snaptec#2715) * youless * typecast commit 3bbfc70 Author: LKuemmel <76958050+LKuemmel@users.noreply.github.com> Date: Tue Jun 6 09:00:04 2023 +0200 Solarlog (snaptec#2733) * add solarlog * n * fixes * SolarLog * restructure legacy code * flake8 commit e4f753f Author: Maxify23 <95931708+Maxify23@users.noreply.github.com> Date: Mon Jun 5 09:09:58 2023 +0200 Sungrow Bash fixes (nightly) + style improvment (snaptec#2738) * Try to fix Sungrow Modul. -IP Address not importet -sungrow bash commands wrong * Modbus ID Reintegration * Update modulconfigpv.php * solve E128 continuation line under-indented for visual indent * solve E128 continuation line under-indented for visual indent * solve E128 continuation line under-indented for visual indent * remove unnecessary code * instert Modbus ID notification * remove optional
- Loading branch information
Showing
28 changed files
with
393 additions
and
256 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
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
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
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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
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,48 @@ | ||
from typing import Optional | ||
|
||
from modules.common.component_setup import ComponentSetup | ||
|
||
|
||
class SolarLogConfiguration: | ||
def __init__(self, ip_address: Optional[str] = None): | ||
self.ip_address = ip_address | ||
|
||
|
||
class SolarLog: | ||
def __init__(self, | ||
name: str = "Solar-Log", | ||
type: str = "solar_log", | ||
id: int = 0, | ||
configuration: SolarLogConfiguration = None) -> None: | ||
self.name = name | ||
self.type = type | ||
self.id = id | ||
self.configuration = configuration or SolarLogConfiguration() | ||
|
||
|
||
class SolarLogCounterConfiguration: | ||
def __init__(self): | ||
pass | ||
|
||
|
||
class SolarLogCounterSetup(ComponentSetup[SolarLogCounterConfiguration]): | ||
def __init__(self, | ||
name: str = "Solar-Log Zähler", | ||
type: str = "counter", | ||
id: int = 0, | ||
configuration: SolarLogCounterConfiguration = None) -> None: | ||
super().__init__(name, type, id, configuration or SolarLogCounterConfiguration()) | ||
|
||
|
||
class SolarLogInverterConfiguration: | ||
def __init__(self): | ||
pass | ||
|
||
|
||
class SolarLogInverterSetup(ComponentSetup[SolarLogInverterConfiguration]): | ||
def __init__(self, | ||
name: str = "Solar-Log Wechselrichter", | ||
type: str = "inverter", | ||
id: int = 0, | ||
configuration: SolarLogInverterConfiguration = None) -> None: | ||
super().__init__(name, type, id, configuration or SolarLogInverterConfiguration()) |
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,42 @@ | ||
#!/usr/bin/env python3 | ||
import logging | ||
from typing import Dict, Union | ||
|
||
|
||
from dataclass_utils import dataclass_from_dict | ||
from modules.common.component_state import CounterState | ||
from modules.common.component_type import ComponentDescriptor | ||
from modules.common.fault_state import ComponentInfo | ||
from modules.common.simcount import SimCounter | ||
from modules.common.store import get_counter_value_store | ||
from modules.devices.solar_log.config import SolarLogCounterSetup | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class SolarLogCounter: | ||
def __init__(self, | ||
device_id: int, | ||
component_config: Union[Dict, SolarLogCounterSetup]) -> None: | ||
self.component_config = dataclass_from_dict(SolarLogCounterSetup, component_config) | ||
self.sim_counter = SimCounter(device_id, self.component_config.id, prefix="bezug") | ||
self.store = get_counter_value_store(self.component_config.id) | ||
self.component_info = ComponentInfo.from_component_config(self.component_config) | ||
|
||
def update(self, response: Dict) -> None: | ||
self.store_values(self.get_power(response)) | ||
|
||
def store_values(self, power) -> None: | ||
imported, exported = self.sim_counter.sim_count(power) | ||
|
||
self.store.set(CounterState( | ||
imported=imported, | ||
exported=exported, | ||
power=power | ||
)) | ||
|
||
def get_power(self, response: Dict) -> CounterState: | ||
return int(float(response["801"]["170"]["110"])) | ||
|
||
|
||
component_descriptor = ComponentDescriptor(configuration_factory=SolarLogCounterSetup) |
Oops, something went wrong.