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

Add power boost sensors #50

Merged
merged 2 commits into from
Mar 17, 2024
Merged

Conversation

martonbtoth
Copy link
Contributor

This commit adds support for the Wallbox Power Boost feature. This is basically a separate device (seems like its a rebranded Inepro PRO380?), which is connected to the charger over modbus. The stock firmware conveniently puts a bunch of statistics about the device in Redis, which this PR exposes as sensors for Home Assistant. It basically makes it possible to monitor the energy usage of a whole household through this feature.

I hope you like it, I threw this together in less than an hour and I actually cannot test it without a power boost device.

@jan--f
Copy link

jan--f commented Mar 15, 2024

Nice! I proposed exactly that in #48. You beat me to it by a weekend :)
Going by the discussion it might be worth it to put this behind a config field or cli flag for users that don't want or need this device.

return fmt.Sprint(w.Data.RedisM2W.PowerBoostLine1Power)
},
Config: map[string]string{
"name": "Power Boost L1",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: I'd rename Power Boost to something more generic like External Energy Meter or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the name is not ideal, but it seems like Wallbox also supports MID type energy meters, so I think anything else would be more confusing if somebody adds support for those. I don't like calling it power boost either, so I'm open to ideas though. :)

@martonbtoth
Copy link
Contributor Author

martonbtoth commented Mar 15, 2024

Nice! I proposed exactly that in #48. You beat me to it by a weekend :) Going by the discussion it might be worth it to put this behind a config field or cli flag for users that don't want or need this device.

@jan--f I think it should be possible to read this config from the device directly, the power_management_config table contains a power_boost_enable column, which is currently 1 for me. Could somebody please check without power boost enabled? I'm a bit afraid to disable it.

@jagheterfredrik
Copy link
Owner

MariaDB [wallbox]> select power_boost_enable from power_management_config;
+--------------------+
| power_boost_enable |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

@tronikos
Copy link
Collaborator

Please allow this to be disabled even if power_boost_enable is 1. See the previously linked discussion for why.

@martonbtoth
Copy link
Contributor Author

@tronikos Based on the linked discussion I understand that you are concerned about the resource utilization this feature would add.

I think the additional CPU cycles required is so negligible that you won't see a difference with the feature enabled vs disabled: it does not do additional round trips to Redis and is already heavily rate limited. CPU usage is so low in fact, that even top consumes more.

Based on that I would advise putting every new feature behind a config entry, as it is going to just add code complexity and increases friction for the users.

That being said, I'm happy to add code to handle the config entry and also check if Power Boost is enabled on the charger, if that's what it takes to merge this feature. What do you guys think?

@jagheterfredrik
Copy link
Owner

I think "Power Boost" naming makes sense as that's what Wallbox uses. I think I agree that it'd be nice to add this as a config (config.go, tui.go), default to false (to preserve functionality for existing users).

app/sensors.go Outdated Show resolved Hide resolved
app/sensors.go Outdated Show resolved Hide resolved
@martonbtoth
Copy link
Contributor Author

Added the extra configuration field, I hope you guys like it! I also think it would be beneficial to start documenting the config file, but thats for another PR! :)

@yavinmaster
Copy link

I have the CT clamp version of Power Boost. Are the same parameters read for this version as well as the full power meter version or do we need two versions of the config?

@martonbtoth
Copy link
Contributor Author

@yavinmaster Since @jan--f and I have different power boost devices and they both have the generic PBO keys in redis, I think it should work with your hardware too. Would you be able to check if you have those keys set on your wallbox's redis?

@jagheterfredrik
Copy link
Owner

Preliminary looks good, will have a proper look tonight

@jagheterfredrik
Copy link
Owner

jagheterfredrik commented Mar 17, 2024

I'd definitely prefer if the entities followed the pattern used by debugEntites. I.e. check the config in the bridge and then call e.g. func getPowerBoostEntities(w *wallbox.Wallbox) map[string]Entity. Perhaps guard the rateLimiters in the same fashion.

@martonbtoth
Copy link
Contributor Author

Sure, no problem! I'll try to get it done this evening! 👍

@jagheterfredrik jagheterfredrik merged commit 207724a into jagheterfredrik:main Mar 17, 2024
1 check passed
@jagheterfredrik
Copy link
Owner

Thanks @martonbtoth 👍

@yavinmaster
Copy link

@yavinmaster Since @jan--f and I have different power boost devices and they both have the generic PBO keys in redis, I think it should work with your hardware too. Would you be able to check if you have those keys set on your wallbox's redis?

Yes - they appear to be there. Obviously having only a CT, I only have a current value.

@CaptInsano
Copy link

Thanks so much for adding this feature.

I just got a chance to install this onto my wallbox pulsar plus with power boost today.

I am unsure of the hardware used in my install for monitoring my house energy usage but is it normal for my sensors to be as follows?:

WhatsApp Image 2024-04-10 at 17 22 58

I understand that L2 and L3 entities are blank as I am a single phase install but should "Power Boost L1" be giving a value in watts or should it be empty?

I am trying to add it to my HomeAssistant instance to enable whole house energy monitoring but I am unsure if I need a wattage input?

Thanks again for all the work on this project by all.

@jan--f
Copy link

jan--f commented Apr 25, 2024

That depends on the external power meter. There are models that only supply current values but no power.

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

Successfully merging this pull request may close these issues.

6 participants