Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wattpilot integration fails to reload in case of portable version of Wattpilot #35

Open
csabaha opened this issue Dec 26, 2023 · 5 comments

Comments

@csabaha
Copy link

csabaha commented Dec 26, 2023

Describe the issue you are experiencing
I have the portable version of Wattpilot (Wattpilot 22 Go), so it is not always connected to the home wifi an home electricity network. If I reconned the Wattpilot Go the the home networok the integration fails to set up. Up until a few months ago, a simple reload of the integration solved the issue. But nowdays I had to hard reboot home assistant to recognise Wattpilot.
I already reinstalled the integration a few times, but it did not solved the issue.

Describe the expected behavior
Ideally home assistant recognise the Wattpilot whenever it is connected to the home electicity and wifi. Alternatively the integration reload would work again.

What version of Home Assistant Core is installed
2023.12.3

What version of Wattpilot integration is installed
Release v0.1.9

What version of Wattpilot are you using
Wattpilot Go 22KW-V2, firmeware 40.7

Error message shown within Home Assistant log
My appologies, but I do not know how to find the error message or proper log. This is what I found:

_This error originated from a custom integration.

Logger: custom_components.wattpilot
Source: custom_components/wattpilot/init.py:63
Integration: Fronius Wattpilot (documentation)
First occurred: 24 December 2023 at 10:36:53 (281 occurrences)
Last logged: 08:44:59_

57260ff476bf08f815c5340340988de8 - async_setup_entry: Timeout - charger not connected: False (15 sec)

Diagnostics information of Wattpilot integration
Probably my lack of knowledge,but I couléd not find how to download the Wattpilot specific diagnostic.

Screenshots
image

Many thanks

@mk-maddin
Copy link
Owner

Well this is a special case you are explaining and a lot of other (none HA related) factors influence the successful connection of the integration.

Have you tried to manually disable the integration in Home Assistant PREVIOUSLY to removing the wattpilot charger from your network/electricity?
Then wait 2-3 minutes AFTER you re-connected wattpilot to your electricity (maybe make sure you can connect to the wattpilot already via Wattpilot HA app - so your wattpilot really is fully reachable at your network) and then re-enable your integration?

The main thing is that the integration keeps a (single) websocket open all the time.
Only this way it is possible to receive push updates on the currenty charging voltage/kw etc. in real time.

If you simply disconnect/unplug your wattpilot from network, the integration still tries to communicate with wattpilot via the old open websocket since it is never closed correctly.

@csabaha
Copy link
Author

csabaha commented Dec 30, 2023

Many thanks for your kind and detialed reply. I will test it and reply back. Until that Happy New Year!

@csabaha
Copy link
Author

csabaha commented Jan 2, 2024

One more many thanks for your suggested workaround. I did some testing and so far it works. It is a bit less user friendly as simple unplug / plug Watpilot, but managable.

@mk-maddin
Copy link
Owner

Good to hear :)

But I think there is more that we might be able to do here - we are in home assistant so let's use its possibilities and test if we can handle this better.

Please do the following:

  1. Get your Wattpilot IP address.
    You can do this e.g. within the Wattpilot App by:
    Select "Internet" -> "WLAN" -> <your WiFiName
    In the lower area there should be "IP Address" visible - usually this is looking like 192.168.X.X
  2. Create a ping sensor for your wattpilot to see if it is on the network via Home Assistant:
    In HA Select "Settings" -> "Devices & services" -> "+ Add Integration" -> search for "Ping" -> "Ping (ICMP)"
    Enter the previously found ip address as "Host" -> "Submit" -> you should see a Success! message -> "Finish"
    You can now find a new entity "binary_sensor.192_168_X_X"
    This entity should show "disconnected"/"off" when your wattpilot is not plugged-in/offline and "connected"/"on" when it is plugged-in/online.
  3. Create a new automation which reloads your wattpilot configuration on the wattpilot connect/disconnect:
automation:

  - id: wattpilot_go_reload
    alias: wattpilot_go_reload
    description: 'Reload wattpilot device integration on disconnect/reconnect'
    mode: queued
    max_exceeded: silent
    trigger:
      - id: 'offline' 
        platform: state
		entity_id: binary_sensor.192_168_X_X #PLEASE CHANGE: entity_id of your PING entity
		from: 'on'
		to: 'off'
      - id: 'online' 
        platform: state
		entity_id: binary_sensor.192_168_X_X #PLEASE CHANGE: entity_id of your PING entity
		from: 'off'
		to: 'on'		
    action:
	  #feel free to remove/comment out the system_log.write call if not needed
      - service: system_log.write
        data_template:
          message: "Reload wattpilot device after going {{trigger.id}}"
          logger: homeassistant.components.automation.wattpilot_go_reload
          level: warning
      - service: homeassistant.reload_config_entry
        target:
          device_id: 46685168f8c86080645840dd194e2f06 #PLEASE CHANGE: device_id of your charger - see https://community.home-assistant.io/t/fronius-wattpilot/403118/9?u=mk-maddin

The idea behind is that if your wattpilot connects / disconnects the integration is reloaded.
This (obviously) causes the integration to fail with timeout on a disconnect, BUT it does no longer try to endless connect on old session. As soon as your wattpilot is online again (and reachable in network) the integration is reloaded again and tries to create a new session which then succeeds.

Hope this works as I expect since I did not test ;)

@csabaha
Copy link
Author

csabaha commented Jan 3, 2024

Appreciate your support and complete code:)
I implemented it, but unfortunately it does not work. Reload of the integration does not work. Even if I disable the integration after unpluging the wattpilot means that it will not recognise again once I plug in the wattpilot and re-enable the integration.

It seem like, that recognition could havce been automated if there would be an integration enable service, which I could not find.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants