a529987659852 / openwbmqtt

Custom component for home assistant supporting openWB wallbox
36 stars 16 forks source link

Feature request: Support for openWB 2.0 #54

Closed jmerifjKriwe closed 9 months ago

jmerifjKriwe commented 1 year ago

As it seems that the current beta of openWB 2.0 is no becoming usable on the wallbox itself (https://openwb.de/forum/viewtopic.php?t=6939) it would be great to have an option to switch vom openWB-MQTT v1.9 to openWB-MQTT v2 as they changed a lot topics.

riesi77 commented 1 year ago

As I just switched my wallbox today to openWB 2.0, I would also love to see the new topics supported!

ChristophCaina commented 1 year ago

Hi @riesi77, can you maybe provide some information about the new topics and the data? Maybe you can provide some information by using mqtt explorer ... that would help to adapt those - because without having an OpenWB 2.0 it will be difficult to test this :)

riesi77 commented 1 year ago

Sure, but I would prefer to send it in a direct message and not post it here in public. Can you send me a quick e-mail to @ gmail.com?

Bascht74 commented 1 year ago

Any progress? Could I help with that. I have openWB 2.0 running (and it is great!)

ChristophCaina commented 1 year ago

Hi, unfortunately, I don't have the time to work on that project at the moment myself. I don't know if there are any plans from the developer of this integration... but right now, I don't see any chance on how I could rework the code in a reasonable time frame....

a529987659852 commented 1 year ago

Hi all, sorry to disappoint you. But since I don't own an openWB 2.0, I'll not develop support for this device. Andreas

jmerifjKriwe commented 1 year ago

openWB 2.0 is not a new device (like openWB Pro). It's the newest version of the software which is currently available as release candidate 2

Bascht74 commented 1 year ago

Yes. The MQTT topics have probably changed.

EckeFL commented 1 year ago

openWB 2.1 is now available as a release version. This means that more and more users will update to openWB2. More information about the new version can be found at here.

Please re-open the feature request

requiemmg commented 1 year ago

+1 to this option. Just tested the new software. MQTT data is being published and Received by Home Assistant, but as the others said, topics have changed.

jk-andersen commented 1 year ago

+1 to this option as it is a new Software version, not hardware!

a529987659852 commented 1 year ago

Hi all, in the meantime, I understood that 2.0 is a new version. I have not upgraded yet, and no plans to do this in the near future (maybe in winter). If you provide MQTT the new MQTT topics, we can see what we can do here.

Andreas

requiemmg commented 1 year ago

Great to hear. Is there a tool to export all the topics? Didnt find one yet.

jk-andersen commented 1 year ago

I will be traveling til sunday- then I can send you the new structure. If anyone can do it before (e.g. with mqtt-Explorer) that is fine too :)

EckeFL commented 1 year ago

Here are the topics of openWB 2.1 openWB/LegacySmartHome/Status/uberschuss openWB/LegacySmartHome/Status/uberschussoffset openWB/bat/2/get/exported openWB/bat/2/get/fault_state openWB/bat/2/get/fault_str openWB/bat/2/get/imported openWB/bat/2/get/power openWB/bat/2/get/soc openWB/bat/config/configured openWB/bat/get/daily_exported openWB/bat/get/daily_imported openWB/bat/get/exported openWB/bat/get/imported openWB/bat/get/power openWB/bat/get/soc openWB/chargepoint/3/get/charge_state openWB/chargepoint/3/get/connected_vehicle/config openWB/chargepoint/3/get/connected_vehicle/info openWB/chargepoint/3/get/connected_vehicle/soc openWB/chargepoint/3/get/currents openWB/chargepoint/3/get/exported openWB/chargepoint/3/get/fault_state openWB/chargepoint/3/get/fault_str openWB/chargepoint/3/get/imported openWB/chargepoint/3/get/phases_in_use openWB/chargepoint/3/get/plug_state openWB/chargepoint/3/get/power openWB/chargepoint/3/get/power_factors openWB/chargepoint/3/get/rfid openWB/chargepoint/3/get/state_str openWB/chargepoint/3/get/voltages openWB/chargepoint/3/set/change_ev_permitted openWB/chargepoint/3/set/current openWB/chargepoint/3/set/log openWB/chargepoint/get/exported openWB/chargepoint/get/imported openWB/chargepoint/get/power openWB/counter/4/get/currents openWB/counter/4/get/exported openWB/counter/4/get/fault_state openWB/counter/4/get/fault_str openWB/counter/4/get/frequency openWB/counter/4/get/imported openWB/counter/4/get/power openWB/counter/4/get/power_factors openWB/counter/4/get/powers openWB/counter/4/get/voltages openWB/counter/set/home_consumption openWB/counter/set/invalid_home_consumption openWB/general/ripple_control_receiver/configured openWB/graph/alllivevaluesJson openWB/graph/alllivevaluesJson1 openWB/graph/alllivevaluesJson10 openWB/graph/alllivevaluesJson11 openWB/graph/alllivevaluesJson12 openWB/graph/alllivevaluesJson13 openWB/graph/alllivevaluesJson14 openWB/graph/alllivevaluesJson15 openWB/graph/alllivevaluesJson16 openWB/graph/alllivevaluesJson2 openWB/graph/alllivevaluesJson3 openWB/graph/alllivevaluesJson4 openWB/graph/alllivevaluesJson5 openWB/graph/alllivevaluesJson6 openWB/graph/alllivevaluesJson7 openWB/graph/alllivevaluesJson8 openWB/graph/alllivevaluesJson9 openWB/graph/lastlivevaluesJson openWB/pv/1/get/currents openWB/pv/1/get/exported openWB/pv/1/get/fault_state openWB/pv/1/get/fault_str openWB/pv/1/get/power openWB/pv/config/configured openWB/pv/get/daily_exported openWB/pv/get/exported openWB/pv/get/monthly_exported openWB/pv/get/power openWB/pv/get/yearly_exported openWB/set/bat/2/get/exported openWB/set/bat/2/get/fault_state openWB/set/bat/2/get/fault_str openWB/set/bat/2/get/imported openWB/set/bat/2/get/power openWB/set/bat/2/get/soc openWB/set/bat/config/configured openWB/set/bat/get/daily_exported openWB/set/bat/get/daily_imported openWB/set/bat/get/exported openWB/set/bat/get/imported openWB/set/bat/get/power openWB/set/bat/get/soc openWB/set/bat/set/charging_power_left openWB/set/bat/set/switch_on_soc_reached openWB/set/chargepoint/3/get/charge_state openWB/set/chargepoint/3/get/currents openWB/set/chargepoint/3/get/exported openWB/set/chargepoint/3/get/fault_state openWB/set/chargepoint/3/get/fault_str openWB/set/chargepoint/3/get/imported openWB/set/chargepoint/3/get/phases_in_use openWB/set/chargepoint/3/get/plug_state openWB/set/chargepoint/3/get/power openWB/set/chargepoint/3/get/power_factors openWB/set/chargepoint/3/get/rfid openWB/set/chargepoint/3/get/state_str openWB/set/chargepoint/3/get/voltages openWB/set/chargepoint/3/set/change_ev_permitted openWB/set/chargepoint/3/set/charging_ev openWB/set/chargepoint/3/set/charging_ev_prev openWB/set/chargepoint/3/set/current openWB/set/chargepoint/3/set/log openWB/set/chargepoint/3/set/plug_state_prev openWB/set/chargepoint/get/exported openWB/set/chargepoint/get/imported openWB/set/chargepoint/get/power openWB/set/counter/4/get/currents openWB/set/counter/4/get/exported openWB/set/counter/4/get/fault_state openWB/set/counter/4/get/fault_str openWB/set/counter/4/get/frequency openWB/set/counter/4/get/imported openWB/set/counter/4/get/power openWB/set/counter/4/get/power_factors openWB/set/counter/4/get/powers openWB/set/counter/4/get/voltages openWB/set/counter/4/set/error_counter openWB/set/counter/4/set/released_surplus openWB/set/counter/4/set/reserved_surplus openWB/set/counter/set/home_consumption openWB/set/counter/set/invalid_home_consumption openWB/set/general/ripple_control_receiver/configured openWB/set/graph/lastlivevaluesJson openWB/set/pv/1/get/currents openWB/set/pv/1/get/exported openWB/set/pv/1/get/fault_state openWB/set/pv/1/get/fault_str openWB/set/pv/1/get/power openWB/set/pv/config/configured openWB/set/pv/get/daily_exported openWB/set/pv/get/exported openWB/set/pv/get/monthly_exported openWB/set/pv/get/power openWB/set/pv/get/yearly_exported openWB/set/system/device/0/component/1/simulation openWB/set/system/device/0/component/2/simulation openWB/set/system/device/0/component/4/simulation openWB/set/system/device/module_update_completed openWB/set/system/lastlivevaluesJson openWB/set/system/time openWB/set/vehicle/0/control_parameter/state openWB/set/vehicle/1/control_parameter/chargemode openWB/set/vehicle/1/control_parameter/prio openWB/set/vehicle/1/control_parameter/required_current openWB/set/vehicle/1/control_parameter/state openWB/set/vehicle/1/control_parameter/submode openWB/set/vehicle/set/vehicle_update_completed openWB/system/device/0/component/1/simulation openWB/system/device/0/component/2/simulation openWB/system/device/0/component/4/simulation openWB/system/device/module_update_completed openWB/system/lastlivevaluesJson openWB/system/time

jmerifjKriwe commented 1 year ago

For implentation it's important to understand that with openWB 2.0 the counters.for vehicle, Chargepoint, ... are not fixed. They increase everytime a new device of this type is added. And they never decrease.

elschnert commented 1 year ago

For implentation it's important to understand that with openWB 2.0 the counters.for vehicle, Chargepoint, ... are not fixed. They increase everytime a new device of this type is added. And they never decrease.

From what I see, it doesn't depend on the type of the device. It looks like everything gets an id just in order of creation.

requiemmg commented 1 year ago

No means to hurry someone, but can you say when support for 2.x might be available? Thanks!

requiemmg commented 10 months ago

Hi all, in the meantime, I understood that 2.0 is a new version. I have not upgraded yet, and no plans to do this in the near future (maybe in winter). If you provide MQTT the new MQTT topics, we can see what we can do here.

Andreas

Hey, @a529987659852, any updates to this? Would really like to see support for 2,x but ofc I understand that this is a bunch of work for the developer...

requiemmg commented 9 months ago

Anyone? 🙏

boredomwontgetus commented 9 months ago

I am also on version 2.x and would love to see an integration for HA. Is there anything i/we can help with to push this topic forward @a529987659852?

requiemmg commented 9 months ago

I have seen that @beme99 made a fork which is obviously for 2.x, but there are no announcements about it nor did I check the functionality.

ChristophCaina commented 9 months ago

I think, a code rework for 2.x is in work but might take some time... :)

a529987659852 commented 9 months ago

Dear all,

I just pushed an alpha version for openwb 2 and I'm looking for alpha testers. Please comment here if you would like to partipate and I'll create a preview on github.

Current limitation: There are only binary sensors and sensors. You cannot post any changes to openWB since I haven't figured out yet which topics to populate. If you have some knowledge, please share in this issue.

Thanks Andreas

requiemmg commented 9 months ago

Oh great, ok, I asked for it, so I will try it out!

Renko72 commented 9 months ago

When i am back next week i all so want to try it out

boredomwontgetus commented 9 months ago

I would also try it and report back findings.

It's a shame but as i am pretty new to Homeassistant i have no idea how to tell HACS to let me pick the "openwb2" branch you created :/ Is anyone willing to give me a slight pointer in the right direction? All i can pick from in HACS is the released versions or "main" even with "Show Beta Versions" checked.

EckeFL commented 9 months ago

All i can pick from in HACS is the released versions or "main" even with "Show Beta Versions" checked.

You are right. It is not possible to install it with HACS. You need to copy the "openwbmqtt" folder to your "custom_components" folder which is located in your homeassistant directory.

After a restart you can add an integration for counter, pv, bat and each chargepoint by setting roottopic and id number.

requiemmg commented 9 months ago

@a529987659852 Andreas, it might be helpful to push a dedicated repository which we might use with HACS; this will also enable to be aware of updates faster and prevent issues due to wrong installations/updates. Would that be possible? Thanks!

a529987659852 commented 9 months ago

All i can pick from in HACS is the released versions or "main" even with "Show Beta Versions" checked.

You are right. It is not possible to install it with HACS. You need to copy the "openwbmqtt" folder to your "custom_components" folder which is located in your homeassistant directory.

This is correct. I have not decided, yet, whether I create a new integration or update the old integration to support openwb 1.9 and 2.0. That's why I have not released anything, yet. By the way: Be careful to replace the released integration version with the new one from the openwb2.0 branch since it will currently break the old integration as I've done a rather 'quick and dirty' implementation that will currently only work with 2.0.

Maybe this is an argument for a new integration instead of enhancing the old one.

By the way: If you have a home assistant development container, you can easily test the integration without tampering with your working instance of home assistant. At least that's how I do it.

a529987659852 commented 9 months ago

You are right. It is not possible to install it with HACS. You need to copy the "openwbmqtt" folder to your "custom_components" folder which is located in your homeassistant directory.

After a restart you can add an integration for counter, pv, bat and each chargepoint by setting roottopic and id number.

Good to hear that you managed to install it without documentation (which will of course be provided once I've done the implementation).

ChristophCaina commented 9 months ago

Hi Andreas,

At least for testing, a dedicated repository - or at least a changed namespace for the openwb2 integration would make sense. Running both in parallel should work by renaming the "openwbmqtt" folder ...

I would also run some tests with openwb 2.1.x - since I've installed this version now on a proxmox lxc (rather than updating my current wallbox)...

I am not sure, if I really want to create another HA VM right now... ^^ Maybe, I'll do it, but slowly I am also running out of available disk space on my proxmox host ...

EckeFL commented 9 months ago

Good to hear that you managed to install it without documentation (which will of course be provided once I've done the implementation).

Yeah. Hopefully my explanation is enough for the most people.

I use the addon in my live system. I like the option of not having to install all devices. This way I can save a lot of "entity rubbish" from entities that I can get much better the direct way.

Bascht74 commented 9 months ago

Ich habe die neue Integration nach Löschen der alten in HA hinzuzufügen. Beim Einrichten erhalte ich allerdings einen Fehler:

image

Hier meine MQTT-Topics:

image

Kann ich irgendwie herausfinden, was hier schief läuft?

GruĂź und Danke, dass jetzt die Arbeiten fĂĽr ein Update auf die OpenWB Software 2.x starten...

a529987659852 commented 9 months ago

Hi, Du mĂĽsstest im Log irgendeinen Dump sehen. Aus den Screenshots geht nur hervor, dass es irgendwo einen Dump gab. Andreas

Bascht74 commented 9 months ago
2023-12-31 11:32:30.478 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 323, in async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 419, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/openwb2mqtt/config_flow.py", line 33, in async_step_user
title = f"{self.user_input[MQTT_ROOT_TOPIC]}-{user_input[devicetype]}-{user_input[deviceid]}"
^^^^^^^^^^^^^^^
AttributeError: 'openwbmqttConfigFlow' object has no attribute 'user_input'
a529987659852 commented 9 months ago

Should be solved with my newest push - was experimenting with setup flows. Happy testing

boredomwontgetus commented 9 months ago

So, just tested it out. (thx for pointing out how to integrate the openwb2 branch). It looks very good and promising on a first glance. I will keep testing and trying in out in the future and report back any findings, etc etc...

OT: @a529987659852 you don't have a "buy me a beer/coffee"-link or a paypal address for me that i can show some monetary appreciation to? ;)

Bascht74 commented 9 months ago

@a529987659852 The error is now gone. I could add all the IDs.

I am missing one thing: The SOC of the connected car:

image image image
requiemmg commented 9 months ago

Will you publish a repo or will I have to test and update manually?

a529987659852 commented 9 months ago

I'll create a new repo. Please give me until end of this week to clean up code and then move it. Andreas

requiemmg @.***> schrieb am Mi., 3. Jan. 2024, 09:50:

Will you publish a repo or will I have to test and update manually?

— Reply to this email directly, view it on GitHub https://github.com/a529987659852/openwbmqtt/issues/54#issuecomment-1875023769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQTMJRDDRYE7FER5BYSTZZ3YMULXDAVCNFSM6AAAAAAX4IWNJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVGAZDGNZWHE . You are receiving this because you were mentioned.Message ID: @.***>

requiemmg commented 9 months ago

Thanks.

I have a problem and I need help. I took a new SD card and installed the release branch of the openWB image, then updated to the latest release version. Configured everything.

In Home Assistant, I deleted the openWB over MQTT module.

Suddenly, my openWB config was ruined as old devices (from the 1.9 installation) popped up! Using MQTT epxlorer, I saw that MQTT topics were still being pushed to the openWB.

So, I deleted my mosquitto.conf and purged all openWB-MQTT Topics using MQTT Explorer from Home Assistant. That worked. Then, I reconfigured my Wallbox again, that also worked.

In order to install version 2 of your addon, I then reenabled my mosquitto.conf like this:

connection openwb
address 192.168.0.181:1883 # IP der openWB
start_type automatic
topic openWB/# both 2
local_clientid openwb.mosquitto
try_private false
cleansession true

As soon as I restart Mosquitto now, I instantly get back all the old values from the 1.9.3.0 version, messing up my entire config again by adding additional meters, inverters and batteries to my setup as well as old counter values.

How do I get rid of the old (1.9) MQTT topic permanently in HA?

requiemmg commented 9 months ago

Done it. When I deleted the topics from HA, they were already integrated in openWB and pingponged back. Had to switch off openWB, delete everything in HA, start with a fresh install of openWB2...

requiemmg commented 9 months ago

So, nachdem ich den Unsinn mit den MQTT-Verwirrungen lösen konnte war die Alpha einfach zu installieren. Alle Devices wurden auf Anhieb richtig erkannt. Wenn die Box jetzt noch lädt, die Konfiguration ist doch etwas komplexer als unter V1...aber das Addon tut im vorgesehenen Umfang das, was es soll. Berichte mal weiter, wenn ich ein bisschen getestet und geladen habe. Next step: Den SoC via MQTT an die Wallbox geben, da es für den Enyaq leider aktuell kein unterstütztes Modul gibt. Den Wert hab ich in HA, muss nur noch rausfinden wie ich das in die openWB mit dem SoC-MQTT-Modul bekomme.

Gibt es spezifische Dinge, die wir testen sollen?

a529987659852 commented 9 months ago

Cool, dass es bei dir klappt. Was spezielles Testen sollt ihr nicht. Eher ein Smoke-Test, ob euch irgendwas auffällt.

BZGL SOC: Christoph schreibt seinen SoC m.W. in das Topic openWB/set/vehicle/{id}/get/soc. Ein kurzer Test bei mir hat gezeigt, dass das funktionieren sollte.

Mein Plan ist, der Integration noch eine Number-Entity zu spendieren, die den SoC zur openWB2 publiziert. In der alten Version meiner Integration konnte man damit im HA-UI ĂĽber einen Schiebergler seinen SoC einstellen, der dann an die openWB weitergegeben wurde. Genauso soll es in der neuen Integration auch funktionieren. Mache ich im Laufe der Woche.

Dann könntest du im HA eine Automatisierung konfigurieren, die den Enyaq-Zustand bei Änderung an die openWB-Entität weitergibt. Christoph hat auch vorgeschlagen, dass man das direkt in der Integration verbauen könnte - bin aber noch nicht sicher, wie und ob ich das hinbekomme. Falls nicht, bleibt immernoch die Automatisierung

GruĂź Andreas

requiemmg commented 9 months ago

PErfekt, das funktioniert hervorragend.

Falls jemand das hier beim googlen findet: Ihr braucht éine Entität, in der der SoC steht - ich hole das zB über die Skoda-Connect-Integration.

Danach erstellt ihr eine neue Automatisierung und wechselt in den YAML-Modus (oder editiert direkt die automations.yaml).

Code fĂĽr Reichweite und SoC:


alias: SoC an openWB senden
trigger:
  - platform: state
    entity_id: sensor.dein_soc_sensor
action:
  - service: mqtt.publish
    data:
      topic: openWB/set/vehicle/0/get/soc
      payload: "{{ states('sensor.dein_soc_sensor') }}"
mode: single

Gleiche Art fĂĽr die Reichweite, hier ist das Topic openWB/set/vehicle/0/get/range.

Die "0" ist natürlich durch eure Fahrzeug-ID (siehe openWB-Oberfläche) zu ersetzen.

Dann noch das SoC-Modul fĂĽr das Fahrzeug in der openWB auf MQTT konfigurieren, dann werden auch die korrekten Zeitstempel gesetzt.

EckeFL commented 9 months ago

Im openWB Forum gibt's ja auch einen Thread zum geliebten Enyaq. https://openwb.de/forum/viewtopic.php?t=7472

Allerdings scheint irgendwas MQTT mäßiges die Openwb sporadisch zu stören. Das mqtt Modul wird immer mal wieder aus dem Fahrzeug entfernt. Ich hoffe das klärt sich bald, woran das liegt.

Zur SoC Automatisierung: Als Trigger fĂĽr das Senden des SoC nicht nur die Ă„nderung nutzen. Durch ein Zeitintervall ist der SoC auch nach einem Neustart der openWB wieder verfĂĽgbar.

a529987659852 commented 9 months ago

I created a new repo and released a first version of the new integrationb. Therefore, I close this issue and kindly ask you to create issues in the new repo.