Skip to content
Closed
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
4 changes: 1 addition & 3 deletions data/config/mosquitto/openwb_local.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# openwb-version:19
# openwb-version:20
listener 1886 localhost
allow_anonymous true

Expand Down Expand Up @@ -33,8 +33,6 @@ topic openWB/internal_chargepoint/# out 2
topic openWB/io/# out 2
topic openWB/internal_io/# out 2

topic openWB/mqtt/# both 2

topic openWB/pv/config/configured out 2
topic openWB/pv/get/# out 2
topic openWB/pv/+/config/# out 2
Expand Down
2 changes: 2 additions & 0 deletions packages/helpermodules/pub.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def pub_single(topic, payload, hostname="localhost", port=1883, no_json=False, r
no_json: bool
Kompatibilität mit ISSS, die ramdisk verwenden.
"""
if payload == "":
no_json = True
if no_json:
publish.single(topic, payload, hostname=hostname, port=port, retain=retain)
else:
Expand Down
22 changes: 20 additions & 2 deletions packages/helpermodules/update_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from helpermodules.measurement_logging.process_log import get_default_charge_log_columns, get_totals
from helpermodules.measurement_logging.write_log import get_names
from helpermodules.messaging import MessageType, pub_system_message
from helpermodules.pub import Pub
from helpermodules.pub import Pub, pub_single
from helpermodules.utils.json_file_handler import write_and_check
from helpermodules.utils.run_command import run_command
from helpermodules.utils.topic_parser import decode_payload, get_index, get_second_index
Expand Down Expand Up @@ -56,7 +56,7 @@

class UpdateConfig:

DATASTORE_VERSION = 89
DATASTORE_VERSION = 90

valid_topic = [
"^openWB/bat/config/bat_control_permitted$",
Expand Down Expand Up @@ -2348,3 +2348,21 @@ def upgrade_datastore_88(self) -> None:
pub_system_message({}, "Es gibt ein neues Theme: das Koala-Theme! Smarthpone-optimiert und mit "
"Energiefluss-Diagramm & Karten-Ansicht der Ladepunkte", MessageType.INFO)
self.__update_topic("openWB/system/datastore_version", 89)

def upgrade_datastore_89(self) -> None:
def on_connect(client, userdata, flags, rc):
client.subscribe("openWB/mqtt/#")

def on_message(client, userdata, message):
topics_to_delete.append(message.topic)

topics_to_delete = []
BrokerClient("deleteMqttDeviceExternalBroker",
on_connect,
on_message,
host="localhost",
port=1883).start_finite_loop()
for topic in topics_to_delete:
log.debug(f"Lösche MQTT-Device-Topic {topic} auf dem externen Broker")
pub_single(topic, "", port=1884)
self.__update_topic("openWB/system/datastore_version", 90)