Skip to content

Commit

Permalink
Merge pull request #1688 from openWB/revert-1621-remove_obsolet
Browse files Browse the repository at this point in the history
Revert "remove obsolet topic"
  • Loading branch information
LKuemmel authored Jun 24, 2024
2 parents 2839e8f + 8ffae04 commit 823829f
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion data/config/mosquitto/openwb_local.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# openwb-version:14
# openwb-version:13
listener 1886 localhost
allow_anonymous true

Expand All @@ -25,6 +25,7 @@ topic openWB/chargepoint/+/set/phases_to_use out 2
topic openWB/chargepoint/+/set/manual_lock out 2
topic openWB/chargepoint/+/set/autolock_state out 2
topic openWB/chargepoint/+/set/rfid out 2
topic openWB/chargepoint/+/set/change_ev_permitted out 2
topic openWB/chargepoint/+/get/# out 2
topic openWB/chargepoint/+/config/# out 2
topic openWB/chargepoint/template/# out 2
Expand Down
1 change: 1 addition & 0 deletions packages/control/chargepoint/chargepoint_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def log_factory() -> Log:

@dataclass
class Set:
change_ev_permitted: bool = False
charging_ev: int = -1
charging_ev_prev: int = -1
current: float = 0
Expand Down
1 change: 1 addition & 0 deletions packages/helpermodules/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def addChargepoint(self, connection_id: str, payload: dict) -> None:
def setup_added_chargepoint():
Pub().pub(f'openWB/chargepoint/{new_id}/config', chargepoint_config)
Pub().pub(f'openWB/chargepoint/{new_id}/set/manual_lock', False)
Pub().pub(f'openWB/chargepoint/{new_id}/set/change_ev_permitted', False)
{Pub().pub(f"openWB/chargepoint/{new_id}/get/"+k, v) for (k, v) in asdict(chargepoint.Get()).items()}
self.max_id_hierarchy = self.max_id_hierarchy + 1
Pub().pub("openWB/set/command/max_id/hierarchy", self.max_id_hierarchy)
Expand Down
2 changes: 2 additions & 0 deletions packages/helpermodules/setdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ def process_chargepoint_topic(self, msg: mqtt.MQTTMessage):
self._validate_value(msg, float)
elif "/set/log" in msg.topic:
self._validate_value(msg, "json")
elif "/set/change_ev_permitted" in msg.topic:
self._validate_value(msg, "json")
elif "/config/ev" in msg.topic:
self._validate_value(
msg, int, [(0, float("inf"))], pub_json=True)
Expand Down
1 change: 1 addition & 0 deletions packages/helpermodules/update_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class UpdateConfig:
"^openWB/chargepoint/[0-9]+/set/plug_state_prev$",
"^openWB/chargepoint/[0-9]+/set/plug_time$",
"^openWB/chargepoint/[0-9]+/set/rfid$",
"^openWB/chargepoint/[0-9]+/set/change_ev_permitted$",
"^openWB/chargepoint/[0-9]+/set/log$",
"^openWB/chargepoint/[0-9]+/set/phases_to_use$",
"^openWB/chargepoint/[0-9]+/set/charging_ev_prev$",
Expand Down
1 change: 1 addition & 0 deletions packages/modules/display_themes/cards/source/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default {
"openWB/chargepoint/+/get/plug_state",
"openWB/chargepoint/+/get/power",
"openWB/chargepoint/+/get/rfid",
"openWB/chargepoint/+/set/change_ev_permitted",
"openWB/chargepoint/+/set/current",
"openWB/chargepoint/+/set/manual_lock",
"openWB/chargepoint/+/set/log",
Expand Down
17 changes: 17 additions & 0 deletions packages/modules/display_themes/cards/source/src/stores/mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,23 @@ export const useMqttStore = defineStore("mqtt", {
return 0;
};
},
getChargePointVehicleChangePermitted(state) {
return (chargePointId) => {
if (
Array.isArray(
state.topics[
`openWB/chargepoint/${chargePointId}/set/change_ev_permitted`
],
)
) {
// topic payload is an array [bool, String]!
return state.topics[
`openWB/chargepoint/${chargePointId}/set/change_ev_permitted`
][0];
}
return true;
};
},
getChargePointConnectedVehicleConfig(state) {
return (chargePointId) => {
return state.topics[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export default {
},
handleVehicleClick(chargePointId) {
if (
!this.changesLocked
!this.changesLocked &&
this.mqttStore.getChargePointVehicleChangePermitted(chargePointId)
) {
this.modalChargePointId = chargePointId;
this.modalVehicleSelectVisible = true;
Expand Down Expand Up @@ -395,6 +396,11 @@ export default {
size="lg"
class="full-width"
:class="!changesLocked ? 'clickable' : ''"
:disabled="
!mqttStore.getChargePointVehicleChangePermitted(
modalChargePointId,
)
"
@click="handleVehicleClick(id)"
>
<font-awesome-icon fixed-width :icon="['fas', 'fa-car']" />
Expand Down

0 comments on commit 823829f

Please sign in to comment.