tomasmcguinness / homeassistant-mixergy

Add support for Mixergy's smart water tank into Home Assistant
MIT License
31 stars 8 forks source link

PV diverter updates #34

Closed mattjgalloway closed 4 months ago

mattjgalloway commented 5 months ago

This fixes #32 and #33.

I've added entities for PV charge limit and PV diverter enabled:

Screenshot 2024-02-14 at 19 36 42

In the process, it meant I added number and switch platforms to the integration. I also pulled out a MixergyEntityBase class that puts some of the logic all entities use into one place.

I've tested this on my own tank and it works well.

@tomasmcguinness I wouldn't mind you letting me know if in your settings API call you get the pv_charge_limit and divert_exported_enabled fields? I'm using absence of those to disable PV related entities. But if they appear in your response, even though you don't have a diverter, then I'll have to think of something different.

tomasmcguinness commented 5 months ago

I'll check that as soon as I can!

tomasmcguinness commented 5 months ago

In my settings, I get back this payload:

{
    "cleansing_temperature": 60,
    "dsr_enabled": false,
    "automatic_schedule_adjust_target": false,
    "automatic_schedule_heat_source": "indirect",
    "target_temperature_control_enabled": false,
    "frost_protection_enabled": true,
    "distributed_computing_enabled": true,
    "heatpump_topup_mode": false,
    "pv_cut_in_threshold": 0,
    "pv_charge_limit": 100,
    "pv_target_current": -0.2,
    "max_temp": 50,
    "timezone": "Europe/London",
    "automatic_schedule_control": "off",
    "divert_exported_enabled": true,
    "cleansing_schedule": {
        "start": "01:30",
        "days": [
            "fri"
        ]
    }
}

@mattjgalloway The fields you mention are present. Now, I am using their Solar PV integration box. It's not a solar diverter, but the thing aimed at people that don't have a dual element immersion. Fun Fact: I have a dual element immersion, so I wasted money on it :)

mattjgalloway commented 5 months ago

Ah ok. That means that the options will show for you as well then. I guess that’s not the end of the world, they can be hidden manually. But I want to try to find something that indicates the presence of the diverter as it would be nice to auto hide those if we can!

mattjgalloway commented 5 months ago

@tomasmcguinness - sorry, I was away over the weekend so couldn't do any changes on this.

In your API response for the tank, what do you get for this line:

"configuration": "{\"tankType\":\"NORMAL\",\"mixergyPvType\":\"RS485_CLAMP_AND_INVERTER\"}"

I am wondering if that mixergyPvType can tell us if the PV diverter is enabled.

Also by the way - do you have any documentation from Mixergy on the API?

tomasmcguinness commented 5 months ago

I'll check when I can.

tomasmcguinness commented 4 months ago

Hey, sorry @mattjgalloway for the delay -

This is what I get back for my tank

"configuration": "{\"tankType\":\"NORMAL\",\"mixergyPvType\":\"NO_INVERTER\"}"
tomasmcguinness commented 4 months ago

Hi @mattjgalloway, there are some merge conflicts in this - I've also replied with the configuration response. Sorry that took so long!

mattjgalloway commented 4 months ago

Thanks @tomasmcguinness, and no worries about the delay!

I've updated the PR to make it properly only show the PV diverter settings I added if the tank has a diverter. And I resolved the conflicts (were with my own changes to add clamp power).