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

[Feature Request]: Register: 37758 - batteries_rated_capacity #749

Closed
2 tasks done
heinemannj opened this issue Jun 22, 2024 · 8 comments
Closed
2 tasks done

[Feature Request]: Register: 37758 - batteries_rated_capacity #749

heinemannj opened this issue Jun 22, 2024 · 8 comments

Comments

@heinemannj
Copy link

heinemannj commented Jun 22, 2024

Describe your feature request

Unfortunately I've not found in Huawei Solar Inverter Modbus Interface Definitions ...
but really helpful for energy management optimazations.

Seen in FusionSolar portal:

image

Edit:
Register for 'batteries_rated_capacity': 37758 already available in libray

rn.STORAGE_RATED_CAPACITY: U32Register("Wh", 1, 37758),
STORAGE_RATED_CAPACITY = "storage_rated_capacity"

Proper usage

  • I confirm that this is not a bug report or support request
  • I confirm that this feature request is within the stated scope of the integration
@Roving-Ronin
Copy link
Contributor

Roving-Ronin commented Jun 24, 2024

@heinemannj

This request is the same as I currently have raised in discussion with Thijs. See: #677 (reply in thread)

This link includes what appears to be the registers that support querying this data (37758). Alas my coding skills don't reach into the python world and I can't work out how to add them and submit a pull to the Huawei-Library. Hopefully Thijs would agree to add them with v1.4, even if disabled by default?

BTW what are you trying to do, as there's other efforts going on to provide some of these type of sensors outside of WLCR integration (using data from it). Such as:

image

Note: The Batteries rated capacity is the one above I'm trying to get going. There are registers for each battery module that can be queried, but that would be a nightmare from the Huawei-Library side (meaning 3 register per battery to call, and 2 batteries per inverter ...and potentially 4 per with the new LUNA2000 S1 7/14/21kWh model).

I've tried to tag you previously (hard given Github removed messaging) to ask if you would be interested in collaborating on standardising the derived sensors for Huawei (& iStore, as they are OEM'ed in Australia) + WLCRS. Currently you've got a good range of sensors for various things, https://github.com/JensenNick has a good package (or two) also tracking power flows, costs / savings / ROI etc.

image

With differing versions of sensors, with different ID's / names etc we however end up with confusion/issues when using another package/card that expects its own sensor entities. Such as:

SunSynk_WLCRS_v1 4

Thinking that logical idea would be to combine and every agree on a standard set of derived sensors that 'any and all' addons and cards etc could leverage. ???

@Roving-Ronin
Copy link
Contributor

@heinemannj

This register is already in the huawel library: rn.STORAGE_RATED_CAPACITY: U32Register("Wh", 1, 37758),

Prior to seeing if Thijs would allow adding this sensor into the integration, by lodging a PULL request, would you like to try these changes and see if they work for you also ?

In sensor.py add the STORAGE_RATED_CAPACITY section, so it sits between STORAGE_STATE_OF_CAPACITY abd STORAGE_RUNNING_STATUS. Like this:

BATTERIES_SENSOR_DESCRIPTIONS: tuple[HuaweiSolarSensorEntityDescription, ...] = (
    HuaweiSolarSensorEntityDescription(
        key=rn.STORAGE_STATE_OF_CAPACITY,
        icon="mdi:home-battery",
        native_unit_of_measurement=PERCENTAGE,
        state_class=SensorStateClass.MEASUREMENT,
    ),
    HuaweiSolarSensorEntityDescription(
        key=rn.STORAGE_RATED_CAPACITY,
        icon="mdi:battery-charging",
        native_unit_of_measurement=UnitOfPower.WATT,
        state_class=SensorStateClass.MEASUREMENT,
        entity_category=EntityCategory.DIAGNOSTIC,
    ),
    HuaweiSolarSensorEntityDescription(
        key=rn.STORAGE_RUNNING_STATUS,
        entity_category=EntityCategory.DIAGNOSTIC,
    ),

Then in strings.json, same as above add the RATED_CAPACITY section, so it looks like:

            "storage_state_of_capacity": {
                "name": "State of capacity"
            },
            "storage_rated_capacity": {
                "name": "Rated Capacity"
            },
            "storage_running_status": {
                "name": "Status"
            },

Restart HA and then see if in the Batteries device, in its Diagnostic section you have:

image

Then open the sensor and make sure the name is displaying as 'Batteries Rated Capacity' and (click the settings/cog wheel) that the Entity ID = sensor.batteries_rated_capacity.

@heinemannj
Copy link
Author

You have to change the unit from Watt to KILO_WATT_HOUR:

    HuaweiSolarSensorEntityDescription(
        key=rn.STORAGE_RATED_CAPACITY,
        icon="mdi:home-battery",
        native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
        state_class=SensorStateClass.MEASUREMENT,
        entity_category=EntityCategory.DIAGNOSTIC,
    ),

In addition I had to modify the en.json as well.

My entity_ID was sensor.batteries_none - potentially due to the issue that I had not modified en.json at my first try.

@heinemannj heinemannj changed the title [Feature Request]: Register for 'batteries_rated_capacity' [Feature Request]: Register: 37758 - batteries_rated_capacity Jul 13, 2024
@Roving-Ronin
Copy link
Contributor

Roving-Ronin commented Jul 13, 2024

@heinemannj The Huawei documentation refers to the output in Wh, but I found it displayed as '15,000' (for a 15kWh LUNA) when I first tried it, hence I listed the Unit of Measurement as 'Watt'. What do you get when you use 'KILO_WATT_HOUR' ? I would have thought that would see you get '15,000kWh' ?

Ahh thanks re the en.json I totally overlooked that and was wondering where that was set.

@heinemannj
Copy link
Author

image

@heinemannj
Copy link
Author

Changing from KILO_WATT_HOUR to WATT_HOUR finally results to:

image

image

    HuaweiSolarSensorEntityDescription(
        key=rn.STORAGE_RATED_CAPACITY,
        icon="mdi:home-battery",
        native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
        state_class=SensorStateClass.MEASUREMENT,
        entity_category=EntityCategory.DIAGNOSTIC,
    ),

@heinemannj
Copy link
Author

My final solution: #746

@wlcrs
Copy link
Owner

wlcrs commented Jul 21, 2024

Done in #768

@wlcrs wlcrs closed this as completed Jul 21, 2024
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

3 participants