marcoboers / home-assistant-quatt

Unofficial Quatt heat pump integration for Home Assistant
MIT License
32 stars 5 forks source link

Options flow with update interval #54 #105

Closed patrickvorgers closed 2 months ago

patrickvorgers commented 2 months ago

This implements issue https://github.com/marcoboers/home-assistant-quatt/issues/54.

The integration now provides OptionFlow which enables the user to configure the options of the integration:

patrickvorgers commented 2 months ago

@marcoboers can you have a look?

marcoboers commented 2 months ago

I'm currently on holiday. I'll check it out when I'm back next week.

marcoboers commented 2 months ago

Closing this one since these changes were also in #107 that has been merged

patrickvorgers commented 2 months ago

I had a quick look and it seems that I am missing the changes in the strings.json. I have to check whether I forgot to include it.

{
    "config": {
        "step": {
            "user": {
                "description": "Set up your Quatt heatpump for monitoring.",
                "data": {
                    "ip_address": "[%key:common::config_flow::data::ip%]"
                },
                "data_description": {
                    "ip_address": "Without http:// and port."
                }
            }
        },
        "error": {
            "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
        },
        "abort": {
            "already_configured": "[%key:common::config_flow::abort::already_configured%]"
        }
    },
    "options": {
        "step": {
            "init": {
                "description": "Quatt options",
                "data": {
                    "scan_interval": "Update interval (Seconds)",
                    "power_sensor": "Power sensor (Optional)"
                },
                "data_description": {
                    "scan_interval": "Number of seconds between requesting information from the Quatt.",
                    "power_sensor": "External energy sensor that measures the current energy consumption of the Quatt."
                }
            }
        }
    }
}
marcoboers commented 2 months ago

Hmm, not sure where I missid this. With regard to the auto discovery PR. The config.step.confirm part should still be there right? So it should become this if I'm correct?

{
    "config": {
        "step": {
            "user": {
                "description": "Set up your Quatt heatpump for monitoring.",
                "data": {
                    "ip_address": "[%key:common::config_flow::data::ip%]"
                },
                "data_description": {
                    "ip_address": "Without http:// and port."
                }
            },
            "confirm": {
                "description": "[%key:common::config_flow::description::confirm_setup%]"
            }
        },
        "error": {
            "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
        },
        "abort": {
            "already_configured": "[%key:common::config_flow::abort::already_configured%]"
        }
    },
    "options": {
        "step": {
            "init": {
                "description": "Quatt options",
                "data": {
                    "scan_interval": "Update interval (Seconds)",
                    "power_sensor": "Power sensor (Optional)"
                },
                "data_description": {
                    "scan_interval": "Number of seconds between requesting information from the Quatt.",
                    "power_sensor": "External energy sensor that measures the current energy consumption of the Quatt."
                }
            }
        }
    }
}
patrickvorgers commented 2 months ago

More is missing, I will created a new PR which contains the changes needed for the optionsFlow