sockless-coding / panasonic_cc

Panasonic Comfort Cloud - Home Assistant Component
MIT License
176 stars 38 forks source link

Setting up integration fails with API error "Missing required parameter: code" #338

Closed MrConorAE closed 3 days ago

MrConorAE commented 3 days ago

Checklist

What version of Home Assistant Core?

core-2024.11.1

Describe the issue

Tried to add my heat pump back to Home Assistant after upgrading to integration version 2024.11, after previously encountering the famed 'Precondition Failed'.

I input my login, press Submit, and it loads for a couple seconds before showing a dialog with 'Unexpected error when adding device'. Looking at the logs shows the Panasonic API call is missing a required parameter 'code'.

Let me know if you need any more information, and thank you for all your hard work :)

My installation details
Version             core-2024.11.1
Installation type   Home Assistant Container
Development             false
Supervisor          false
Docker                  true
User                    root
Virtual environment     false
Python version          3.12.4
OS family               Linux
OS version          6.6.47+rpt-rpi-2712
CPU architecture    aarch64
Timezone            Pacific/Auckland
Configuration directory /config

Error/Debug Logs

This error originated from a custom integration.

Logger: custom_components.panasonic_cc.pcomfortcloud.helpers
Source: custom_components/panasonic_cc/pcomfortcloud/helpers.py:27
integration: Panasonic Comfort Cloud (documentation, issues)
First occurred: 13:36:52 (1 occurrences)
Last logged: 13:36:52

Error in get_token Expected status code '200' but received '400' Response body: {"error":"invalid_request","error_description":"Missing required parameter: code"}
MrConorAE commented 3 days ago

Fixed! My 2FA for the Panasonic account was gone for some reason - setting it up again using the Comfort Cloud app fixed this.

(May be a good idea to add handling for this case (e.g. show a message instead of 'Unknown error'?)