Skip to content
Merged
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
87 changes: 49 additions & 38 deletions data/config/mosquitto/public/default-dynamic-security.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,43 @@
}
],
"clients": []
}, {
"groupname": "user",
"textname": "Basisgruppe für normale Benutzer",
"textdescription": "Diese Gruppe stellt grundlegende Rechte bereit, welche für alle Benutzer als Ausgangsbasis sinnvoll sind.",
"roles": [{
"rolename": "basic-display-data"
}, {
"rolename": "basic-system-data"
}, {
"rolename": "basic-theme-data"
}, {
"rolename": "basic-user-data"
}],
"clients": []
}, {
"groupname": "display",
"textname": "Basisgruppe für alle integrierten Displays",
"textdescription": "Diese Gruppe stellt grundlegende Rechte bereit, welche für alle Displays als Ausgangsbasis sinnvoll sind.",
"roles": [{
"rolename": "basic-display-data"
}, {
"rolename": "basic-system-data"
}, {
"rolename": "basic-user-data"
}],
"clients": []
},
{
"groupname": "user",
"textname": "Basisgruppe für normale Benutzer",
"textdescription": "Diese Gruppe stellt grundlegende Rechte bereit, welche für alle Benutzer als Ausgangsbasis sinnvoll sind.",
"roles": [
{
"rolename": "basic-display-data"
},
{
"rolename": "basic-system-data"
},
{
"rolename": "basic-theme-data"
},
{
"rolename": "basic-user-data"
}
],
"clients": []
},
{
"groupname": "display",
"textname": "Basisgruppe für alle integrierten Displays",
"textdescription": "Diese Gruppe stellt grundlegende Rechte bereit, welche für alle Displays als Ausgangsbasis sinnvoll sind.",
"roles": [
{
"rolename": "basic-display-data"
},
{
"rolename": "basic-system-data"
},
{
"rolename": "basic-user-data"
}
],
"clients": []
}
],
"anonymousGroup": "anonymous",
Expand Down Expand Up @@ -1558,19 +1569,19 @@
},
{
"acltype": "publishClientSend",
"topic": "openWB/set/counter/config/home_consumption_source_id",
"topic": "openWB/set/counter/config/consider_less_charging",
"priority": 0,
"allow": true
},
{
"acltype": "publishClientSend",
"topic": "openWB/set/counter/config/consider_less_charging",
"topic": "openWB/set/counter/get/hierarchy",
"priority": 0,
"allow": true
},
{
"acltype": "publishClientSend",
"topic": "openWB/set/counter/get/hierarchy",
"topic": "openWB/set/counter/+/config/max_power_errorcase",
"priority": 0,
"allow": true
},
Expand All @@ -1582,13 +1593,13 @@
},
{
"acltype": "publishClientSend",
"topic": "openWB/set/counter/+/config/max_power_errorcase",
"topic": "openWB/set/counter/+/config/max_currents",
"priority": 0,
"allow": true
},
{
"acltype": "publishClientSend",
"topic": "openWB/set/counter/+/config/max_currents",
"topic": "openWB/set/counter/+/config/is_home_consumption_counter",
"priority": 0,
"allow": true
},
Expand Down Expand Up @@ -1616,12 +1627,6 @@
"priority": 0,
"allow": true
},
{
"acltype": "publishClientReceive",
"topic": "openWB/counter/config/home_consumption_source_id",
"priority": 0,
"allow": true
},
{
"acltype": "publishClientReceive",
"topic": "openWB/counter/config/consider_less_charging",
Expand Down Expand Up @@ -1658,6 +1663,12 @@
"priority": 0,
"allow": true
},
{
"acltype": "publishClientReceive",
"topic": "openWB/counter/+/config/is_home_consumption_counter",
"priority": 0,
"allow": true
},
{
"acltype": "publishClientReceive",
"topic": "openWB/counter/+/config/max_total_power",
Expand Down Expand Up @@ -2967,4 +2978,4 @@
]
}
]
}
}
8 changes: 5 additions & 3 deletions packages/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from control.bat import Set as BatSet
from control.chargepoint.chargepoint import Chargepoint, ChargepointData
from control.chargepoint.chargepoint_data import Config, Get, Set
from control.counter import Counter, CounterData
from control.counter import Counter, CounterData, CounterMode
from control.counter import Config as CounterConfig
from control.counter import Get as CounterGet
from control.counter import Set as CounterSet
Expand Down Expand Up @@ -189,11 +189,13 @@ def data_() -> None:
fault_state=0), config=Mock(spec=PvConfig, max_ac_out=10000)))})
data.data.counter_data.update({
"counter0": Mock(spec=Counter, data=Mock(spec=CounterData, get=Mock(
spec=CounterGet, currents=[40]*3, power=6200, daily_imported=45000, daily_exported=3000, fault_state=0))),
spec=CounterGet, currents=[40]*3, power=6200, daily_imported=45000, daily_exported=3000, fault_state=0),
config=Mock(spec=CounterConfig, is_home_consumption_counter=CounterMode.HOME_CONSUMPTION.value))),
"counter6": Mock(spec=Counter, data=Mock(spec=CounterData, get=Mock(
spec=CounterGet, currents=[25, 10, 25], power=13800, daily_imported=20000, daily_exported=0,
imported=14000, exported=18000, fault_state=0),
config=Mock(spec=CounterConfig, max_currents=[32]*3),
config=Mock(spec=CounterConfig, max_currents=[32]*3,
is_home_consumption_counter=CounterMode.NOT_HOME_CONSUMPTION.value),
set=Mock(spec=CounterSet, raw_currents_left=[31]*3)))})


Expand Down
16 changes: 13 additions & 3 deletions packages/control/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def get_counter_default_config():
return {"max_power_errorcase": 7000,
"max_currents": [35]*3,
"max_total_power": 24000,
"is_home_consumption_counter": CounterMode.AUTO_HOME_CONSUMPTION.value,
}


Expand All @@ -38,12 +39,21 @@ class ControlRangeState(Enum):
ABOVE = 1


class CounterMode(Enum):
NOT_HOME_CONSUMPTION = "no_home_consumption"
HOME_CONSUMPTION = "home_consumption"
AUTO_HOME_CONSUMPTION = "auto_home_consumption"


@dataclass
class Config:
max_power_errorcase: float = field(default=7000, metadata={"topic": "get/max_power_errorcase"})
max_power_errorcase: float = field(default=7000, metadata={"topic": "config/max_power_errorcase"})
max_currents: List[float] = field(default_factory=currents_list_factory, metadata={
"topic": "get/max_currents"})
max_total_power: float = field(default=0, metadata={"topic": "get/max_total_power"})
"topic": "config/max_currents"})
max_total_power: float = field(default=0, metadata={"topic": "config/max_total_power"})

is_home_consumption_counter: str = field(default=CounterMode.AUTO_HOME_CONSUMPTION.value, metadata={
"topic": "config/is_home_consumption_counter"})


def config_factory() -> Config:
Expand Down
Loading