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 'battery_usage' sensor to powerflow #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lochstar
Copy link

@lochstar lochstar commented Nov 21, 2021

Closes #66

I've added the config values battery and battery_device_id.

battery_usage is included as P_Akku via GetPowerFlowRealtimeData.fcgi.

The following sensors are provided by GetStorageRealtimeData.cgi.

battery_designed_capacity
battery_maximum_capacity
battery_charge
battery_temperature
battery_current
battery_voltage

I'd also like to include battery_manufacturer, battery_model and battery_serial, the JSON response has these values nested under Details (see below). Currently the json_key attribute doesn't support a keypath. I wasn't sure how to handle this, either an extra json_sub_key attribute or add a library such as python-benedict that supports keypaths. Unsure if HA provides something similar already. Thoughts?

Sample response of GetStorageRealtimeData:

{

    "Body": {
        "Data": {
            "Controller": {
                "Capacity_Maximum": 5120,
                "Current_DC": 2.0950622981079836,
                "DesignedCapacity": 5120,
                "Details": {
                    "Manufacturer": "BYD",
                    "Model": "BYD Battery-Box Premium HV",
                    "Serial": "P030T020Z2103032208     "
                },
                "Enable": 1,
                "StateOfCharge_Relative": 86.099999999999994,
                "Status_BatteryCell": 3.0,
                "Temperature_Cell": 23.0,
                "TimeStamp": 1638155622.0,
                "Voltage_DC": 216.69999999999999
            },
            "Modules": [ ]
        }
    },
    "Head": {
        "RequestArguments": {
            "DeviceId": "0",
            "Scope": "Device"
        },
        "Status": {
            "Code": 0,
            "Reason": "",
            "UserMessage": ""
        },
        "Timestamp": "2021-11-29T03:13:43+00:00"
    }
}

Also consider naming it storage instead or battery to match the API.

…ttery_designed_capacity, battery_maximum_capacity, battery_charge, battery_temperature, battery_current, battery_voltage
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.

Fronius Battery Support in Energy Manager
1 participant