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 total PV power sensor #129

Closed
canton7 opened this issue Apr 6, 2023 Discussed in #128 · 7 comments · Fixed by #248
Closed

Add total PV power sensor #129

canton7 opened this issue Apr 6, 2023 Discussed in #128 · 7 comments · Fixed by #248
Assignees

Comments

@canton7
Copy link
Collaborator

canton7 commented Apr 6, 2023

Discussed in #128

Originally posted by andrewmooreio April 6, 2023
Hi. I've just switched from the StealthChestnut integration and have noticed there is no total power sensor for PV output. e.g. current total solar generation PV1 + PV2 in W.

I've created a template sensor for now {{ (states('sensor.pv1_power') | float(default=0) + states('sensor.pv2_power') | float(default=0) ) * 1 }}, just wondering if it's possible to hard code it into the integration, as it's a really useful metric that I'm sure a lot of users would appreciate.

There may be other sensors that are provided by templates here, but the total PV power is a particularly useful one.

Cheers.


We probably need a new sensor type which adds two registers together?

@nathanmarlor
Copy link
Owner

Possibly extend the functionality you just added to combine multiple registers? I'm thinking something along the lines of a flag SUM, EXTEND?

@canton7
Copy link
Collaborator Author

canton7 commented Apr 6, 2023

Well it starts getting tricky -- what if we want to sum two 32-bit registers? They're separate concepts.

Another way would be to just create a template sensor ourselves and let HA handle things, but that feels needlessly wasteful...

@canton7
Copy link
Collaborator Author

canton7 commented Apr 6, 2023

I think a perfect solution might be a new sensor type which takes the two sensors to sum as inputs, rather than working directly on the registers? That way we don't have to worry about things like the two source sensors having different scales or post-processing steps, etc. They can just do their thing, and the summation sensor (which can even take an array of input sensors and apply a lambda to them) takes the results and combines them.

@canton7
Copy link
Collaborator Author

canton7 commented Apr 6, 2023

Looks like it shouldn't be too hard? async_track_state_change_event lets you subscribe to changes from multiple other entities. The integration sensor does a bunch of stuff we should be able to just copy

@canton7 canton7 self-assigned this May 13, 2023
canton7 added a commit to canton7/foxess_modbus that referenced this issue May 17, 2023
@ProtoxiDe22
Copy link

Does it make sense to also have a PV power total that sums the PV1 Power Total and PV2 power total values in KWh? i'm thinking having a single sensor in the energy dashboard would make sense especially if you want to do stuff with the forecast.solar estimates, working with a single value seems easier

@canton7
Copy link
Collaborator Author

canton7 commented Jun 27, 2023

The inverter provides that already, we call it "Solar Generation Total"

@ProtoxiDe22
Copy link

Damn i missed that, thank you.

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 a pull request may close this issue.

3 participants