File tree Expand file tree Collapse file tree
packages/modules/devices/generic/json Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,9 +83,15 @@ def __init__(self,
8383
8484
8585class JsonInverterConfiguration :
86- def __init__ (self , jq_power : str = "" , jq_exported : Optional [str ] = None ):
86+ def __init__ (self ,
87+ jq_power : str = "" ,
88+ jq_exported : Optional [str ] = None ,
89+ jq_current_l1 : Optional [str ] = None ,
90+ jq_current_l2 : Optional [str ] = None ,
91+ jq_current_l3 : Optional [str ] = None ):
8792 self .jq_power = jq_power
8893 self .jq_exported = jq_exported
94+ self .jq_currents = (jq_current_l1 , jq_current_l2 , jq_current_l3 )
8995
9096
9197class JsonInverterSetup (ComponentSetup [JsonInverterConfiguration ]):
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ def _compile_jq_filters(self) -> None:
2424 config = self .component_config .configuration
2525 self .jq_power = jq .compile (config .jq_power )
2626 self .jq_exported = jq .compile (config .jq_exported ) if config .jq_exported else None
27+ self .jq_currents = [jq .compile (c ) for c in config .jq_currents ] if all (config .jq_currents ) else None
2728
2829 def initialize (self ) -> None :
2930 self .__device_id : int = self .kwargs ['device_id' ]
@@ -37,14 +38,20 @@ def update(self, response) -> None:
3738 if power >= 0 :
3839 power = power * - 1
3940
41+ currents = (
42+ [float (j .input (response ).first ()) for j in self .jq_currents ]
43+ if self .jq_currents is not None else None
44+ )
45+
4046 if self .jq_exported is None :
4147 _ , exported = self .sim_counter .sim_count (power )
4248 else :
4349 exported = float (self .jq_exported .input (response ).first ())
4450
4551 inverter_state = InverterState (
4652 power = power ,
47- exported = exported
53+ exported = exported ,
54+ currents = currents
4855 )
4956 self .store .set (inverter_state )
5057
You can’t perform that action at this time.
0 commit comments