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

Precondition Failed #331

Closed
3 tasks done
evakq8r opened this issue Nov 5, 2024 · 149 comments · Fixed by #336
Closed
3 tasks done

Precondition Failed #331

evakq8r opened this issue Nov 5, 2024 · 149 comments · Fixed by #336
Labels
bug Something isn't working

Comments

@evakq8r
Copy link

evakq8r commented Nov 5, 2024

Checklist

  • I have verified that the account and device works in the Comfort Cloud App.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

What version of Home Assistant Core?

core-2024.10.4

Describe the issue

Aircon dashboard went unavailable ~30 minutes ago. Reviewed logs, found 'Precondition failed'. Logging into the Panasonic App works without issue and the Aircon can still be controlled via the app, just not HA.

image

image

Error/Debug Logs

Logger: custom_components.panasonic_cc.coordinator
Source: custom_components/panasonic_cc/coordinator.py:86
integration: Panasonic Comfort Cloud (documentation, issues)
First occurred: 11:37:36 (56 occurrences)
Last logged: 12:05:05

Error fetching device data from API: (get_status: Expected status code 200, received: 412: { "code":41201, "message":"Precondition Failed" }
Traceback (most recent call last):
  File "/config/custom_components/panasonic_cc/coordinator.py", line 86, in _fetch_device_data
    if await self._api_client.try_update_device(self._device):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 178, in try_update_device
    json_response = await self._get_device_status(device.info)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 169, in _get_device_status
    json_response = await self.execute_get(self._get_device_status_now_url(device_info.guid), "get_status", 200)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 145, in execute_get
    await check_response(response, function_description, expected_status_code)
  File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response
    raise exceptions.ResponseError(
custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (get_status: Expected status code 200, received: 412: {
  "code":41201,
  "message":"Precondition Failed"
}
@evakq8r evakq8r added the bug Something isn't working label Nov 5, 2024
@Adavidebaba
Copy link

mee to today

@rtr3983
Copy link

rtr3983 commented Nov 5, 2024

Same issue here.
Appeared around the same time too.

@Adavidebaba
Copy link

I wonder if we'll ever be able to manage everything just on local. ...

@rtr3983
Copy link

rtr3983 commented Nov 5, 2024

I wonder if we'll ever be able to manage everything just on local. ...

That would be lovely

@larayorch
Copy link

larayorch commented Nov 5, 2024

I wonder if we'll ever be able to manage everything just on local. ...

There IS a way to manage locally only, but it involves building your own WiFi adapter for the AC unit and replacing the original one. There is a guide somewhere, I'll see if I can find the link again.

UPDATE:
Here's the link: https://www.espthings.io/index.php/2023/09/02/esphome-panasonic-climate-interface/

@craigwhiteheadnz
Copy link

Same issue, within the last 90 minutes

@Adavidebaba
Copy link

I wonder if we'll ever be able to manage everything just on local. ...

There IS a way to manage locally only, but it involves building your own WiFi adapter for the AC unit and replacing the original one. There is a guide somewhere, I'll see if I can find the link again.

UPDATE: Here's the link: https://www.espthings.io/index.php/2023/09/02/esphome-panasonic-climate-interface/

Thank you man!!!

@notio-ca
Copy link

notio-ca commented Nov 5, 2024

I am down too, Panasonic app ok but the integration failed to connect to the api.
All entities unavailable.
Thanks for anyone to help!!
Cheers!

@JinksKid
Copy link

JinksKid commented Nov 5, 2024

Mine is also down :(

@djmaxim1981
Copy link

djmaxim1981 commented Nov 5, 2024

Facing the same issue :(
Appreciate all that you do for us! Thank you team!

__Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 10:53:10 AM (2 occurrences)
Last logged: 11:12:16 AM

Error setting up entry for panasonic_cc
Traceback (most recent call last):
File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 64, in start_session
await self._get_groups()
File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 79, in _get_groups
self._groups = await self.execute_get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 145, in execute_get
await check_response(response, function_description, expected_status_code)
File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response
raise exceptions.ResponseError(
custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (get_groups: Expected status code 200, received: 412: {
"code":41201,
"message":"Precondition Failed"
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/panasonic_cc/init.py", line 76, in async_setup_entry
await api.start_session()
File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 67, in start_session
await self.reauthenticate()
File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 71, in reauthenticate
await super().reauthenticate()
File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 68, in reauthenticate
await self._authentication.authenticate(self._username, self._password)
File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicauthentication.py", line 68, in authenticate
await self.retrieve_client_acc()
File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicauthentication.py", line 263, in retrieve_client_acc
await check_response(response, 'get_acc_client_id', 200)
File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response
raise exceptions.ResponseError(
custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (get_acc_client_id: Expected status code 200, received: 412: {
"code":41201,
"message":"Precondition Failed"

}

@blurizi
Copy link

blurizi commented Nov 5, 2024

Same here. Hoping Panasonic won't Block and it's just temporary issue..

@Garagoos
Copy link

Garagoos commented Nov 5, 2024

Same here :(

Without HomeAssistant, Panasonic systems are de facto useless in Germany because they constantly cycle during transition periods. I pray that this is only a temporary problem.

2024-11-05 06:14:22.084 ERROR (MainThread) [custom_components.panasonic_cc.pcomfortcloud.helpers] Error in get_groups
Expected status code '200' but received '412'
Response body: {
"code":41201,
"message":"Precondition Failed"
}
2024-11-05 06:14:22.084 WARNING (MainThread) [custom_components.panasonic_cc.pcomfortcloud.apiclient] Could not get groups, trying to re-authenticate
Traceback (most recent call last):
File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 64, in start_session
await self._get_groups()
File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 79, in _get_groups
self._groups = await self.execute_get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 145, in execute_get
await check_response(response, function_description, expected_status_code)
File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response
raise exceptions.ResponseError(
custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (get_groups: Expected status code 200, received: 412: {
"code":41201,
"message":"Precondition Failed"

@aceindy
Copy link

aceindy commented Nov 5, 2024

And here too...

@Herbi-1966
Copy link

+1

@adamk125
Copy link

adamk125 commented Nov 5, 2024

Broken here too. Deleted the integration and tried re-adding, same issue.

@drseltsamford
Copy link

Same issue here!

@BenLeitch4654
Copy link

Oh well at lest it's not just me:)

@CasCas2
Copy link

CasCas2 commented Nov 5, 2024

Same issue here!

@robertjan
Copy link

same over here :(

@dannybloe
Copy link

Please don't all reply telling you have the same problem. I guess it is already clear that everybody has this problem.
Thanks.

@Auka84
Copy link

Auka84 commented Nov 5, 2024

Same for me :( but worked until now and didn't work after a reboot a my HA

@mizreh
Copy link

mizreh commented Nov 5, 2024

Hello,
Seems we have the same problem...
Same for me since this morning.
Panasonic Comfort Cloud app android working fine. Home assistant get the same error as you all...

@dannybloe
Copy link

Peeps. Please stop replying with 'Same here'!!
Many have notifications turned on but don't want these kind of updates.

@sockless-coding
Copy link
Owner

I'm going to take a look and see if I can find out what they have changed... hopefully it isn't the activation of x-cfc-api-key validation.

@mkz212
Copy link

mkz212 commented Nov 5, 2024

Same here. For Homebridge plugin also stop working with same error code.

@lawrencedudley
Copy link

If anyone from Panasonic is reading this, please stop it. It makes me never want to buy any Panasonic stuff ever again.

@pacholoamit
Copy link

I'm also having the same issue here. Happened 8 hours ago

Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 5:26:00 PM (3 occurrences)
Last logged: 5:55:20 PM

Error setting up entry for panasonic_cc
Traceback (most recent call last):
  File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 64, in start_session
    await self._get_groups()
  File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 79, in _get_groups
    self._groups = await self.execute_get(
                   ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 145, in execute_get
    await check_response(response, function_description, expected_status_code)
  File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response
    raise exceptions.ResponseError(
custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (get_groups: Expected status code 200, received: 412: {
  "code":41201,
  "message":"Precondition Failed"
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/panasonic_cc/__init__.py", line 76, in async_setup_entry
    await api.start_session()
  File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 67, in start_session
    await self.reauthenticate()
  File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 71, in reauthenticate
    await super().reauthenticate()
  File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 68, in reauthenticate
    await self._authentication.authenticate(self._username, self._password)
  File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicauthentication.py", line 68, in authenticate
    await self._retrieve_client_acc()
  File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicauthentication.py", line 263, in _retrieve_client_acc
    await check_response(response, 'get_acc_client_id', 200)
  File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response
    raise exceptions.ResponseError(
custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (get_acc_client_id: Expected status code 200, received: 412: {
  "code":41201,
  "message":"Precondition Failed"
}

@nhdson
Copy link

nhdson commented Nov 8, 2024

Thanks to all for getting this up and running again - amazing work. All working well here with a restart after updating

@adamk125
Copy link

adamk125 commented Nov 8, 2024

Looks like its working. Thanks team :)

@evakq8r
Copy link
Author

evakq8r commented Nov 8, 2024

Yep, all working here also. Thanks very much!

@djmaxim1981
Copy link

djmaxim1981 commented Nov 8, 2024

Version 2024.11.0 has been released

Nailed it again! Thank you for all that you guys do despite all the complaints!
Its working perfectly now.

Much gratitude from Malaysia!

@slavlad
Copy link

slavlad commented Nov 8, 2024

Looks like its working. Thanks team :)

@Garagoos
Copy link

Garagoos commented Nov 8, 2024

@sockless-coding
Great Work

pls send a paypal adress . i cant buy coffee
thx

@freman
Copy link

freman commented Nov 8, 2024

Danke, I guess I won't be pulling apart aircons this weekend, thats great cos I have Christmas props to manufacture

@marcel-st
Copy link

Awesome work. I'll keep the ordered hardware on the shelf because i expect Panasonic isn't done messing about with their API.

@Auka84
Copy link

Auka84 commented Nov 8, 2024

@sockless-coding Great Work

pls send a paypal adress . i cant buy coffee thx

good idea, he deserves it :).

@Herbi-1966
Copy link

Version 2024.11.0 has been released

Wow, incredible !!😃
I followed the topic and almost gave up hope. But: you did it again! Great achievement!
Thank you so much!

Regards
Herbi

@arkasz-dev
Copy link

@sockless-coding Great Work

pls send a paypal adress . i cant buy coffee thx
@Garagoos, @Auka84
I will definitely send a coffee tip, too. I found the tipping link on home assistant forums (see end of his first post):
https://community.home-assistant.io/t/panasonic-comfort-cloud/229090

or just wait till he is online and confirms the link :)

@MatthK
Copy link

MatthK commented Nov 8, 2024

Awesome job. You're such a lifesaver. Thank you very much.

I ordered the hardware solution on pcbway.com. When that arrives, I can hopefully get rid of the cloud solution and access the A/Cs finally direct.

@lawrencedudley
Copy link

@MatthK can you share the order with me? They couldn't source the ESP variant when I tried to order the same.

@willie013
Copy link

Awesome job. You're such a lifesaver. Thank you very much.

I ordered the hardware solution on pcbway.com. When that arrives, I can hopefully get rid of the cloud solution and access the A/Cs finally direct.

I am also opting for the local control route, however, the fix is still much appriated! I genuinely think this is not Panasonic's last attempt to keep us out of the API..

But why do people still order the pcbway.com components? The only thing you need is an ESP32 and a connector with jumper wires to control the AC locally? DomiStyle/esphome-panasonic-ac#111 (comment)

@lawrencedudley
Copy link

@willie013 I think that wants to have a level shifter on it, 5v GPIO will make the ESP go bang. I am going to pop one together as I do have some level shifters sat here but a nice PCB is prettier.

@willie013
Copy link

@willie013 I think that wants to have a level shifter on it, 5v GPIO will make the ESP go bang. I am going to pop one together as I do have some level shifters sat here but a nice PCB is prettier.

No, most esp32 board are 5v tolerant, so that's why I don't see any benefit in the dedicated pcb..

@lawrencedudley
Copy link

Fair enough! I'll probably use one anyway as it's best-practice. Fun little project for this afternoon.

@kollarg80
Copy link

Awesome job. You're such a lifesaver. Thank you very much.
I ordered the hardware solution on pcbway.com. When that arrives, I can hopefully get rid of the cloud solution and access the A/Cs finally direct.

I am also opting for the local control route, however, the fix is still much appriated! I genuinely think this is not Panasonic's last attempt to keep us out of the API..

But why do people still order the pcbway.com components? The only thing you need is an ESP32 and a connector with jumper wires to control the AC locally? DomiStyle/esphome-panasonic-ac#111 (comment)

Actually is it working? I have the 3.3 to 5v level shifter and couple of esp-s, but that repo has at least 3 year old code.

@kennethhaspeel
Copy link

Awesome job. You're such a lifesaver. Thank you very much.
I ordered the hardware solution on pcbway.com. When that arrives, I can hopefully get rid of the cloud solution and access the A/Cs finally direct.

I am also opting for the local control route, however, the fix is still much appriated! I genuinely think this is not Panasonic's last attempt to keep us out of the API..
But why do people still order the pcbway.com components? The only thing you need is an ESP32 and a connector with jumper wires to control the AC locally? DomiStyle/esphome-panasonic-ac#111 (comment)

Actually is it working? I have the 3.3 to 5v level shifter and couple of esp-s, but that repo has at least 3 year old code.

You don't even need the level shifter. The esp works on 5V, as you can read in the link. But if you have the hardware, why not use it. There is nothing wrong with a repo with 3 year old code if nothing has changed. And AC commands don't really change.
I have some esp's lying around for months for this but this add-on did the job. I looked for the boards yesterday but since the add-on works again, the urgency has dropped again. Seems like the esp's are going to continue to collect dust for now ;-)

@3003M
Copy link

3003M commented Nov 8, 2024

AWESOME!! Thank you very much @sockless-coding!!!
And FU Panasonic!

@Maarc
Copy link
Contributor

Maarc commented Nov 8, 2024

Thank you so much @sockless-coding 🙇 You are awesome!

@mkz212
Copy link

mkz212 commented Nov 8, 2024

Thank you!! 🚀

@Auka84
Copy link

Auka84 commented Nov 8, 2024

@sockless-coding received many coffees today :D. Thx a lot again :)

@Peter-Versluis
Copy link

Thank you very much for the fix, much appreciated.

@jaknil0
Copy link

jaknil0 commented Nov 8, 2024

Wow, many thanks to those contributing to fixing this one!!

@tomt25
Copy link

tomt25 commented Nov 8, 2024 via email

@david-collett
Copy link

I wonder if we'll ever be able to manage everything just on local. ...

If your controller also has Bluetooth, you may be interested in this integration:
https://github.com/david-collett/panasonic_hc

@MatthK
Copy link

MatthK commented Nov 9, 2024

@MatthK can you share the order with me? They couldn't source the ESP variant when I tried to order the same.

At first the order got stuck under review. They claimed they can't source the ESP and thus not solder it, and I also had to choose the optional temperature sensor.

I told them I'd be fine without the ESP (having the illusion I might find a way to get them myself, and solder them somehow). But in the confirmed order, they suddenly did list the ESP as well. It's in production now, so I'm cautiously optimistic to get them.

How to load the necessary code and get them working will be another task, but I'll cross that bridge when I get there.

Here is the BOM of my order.
espthings.io - ET-P1101 ESPHome Panasonic Climate Interface_BOM_PCBWay(3).xlsx

@david-collett
Copy link

I wonder if we'll ever be able to manage everything just on local. ...

If your controller also has Bluetooth, you may be interested in this integration:
https://github.com/david-collett/panasonic_hc

@jack3308
Copy link

jack3308 commented Nov 9, 2024

@MatthK can you share the order with me? They couldn't source the ESP variant when I tried to order the same.

At first the order got stuck under review. They claimed they can't source the ESP and thus not solder it, and I also had to choose the optional temperature sensor.

I told them I'd be fine without the ESP (having the illusion I might find a way to get them myself, and solder them somehow). But in the confirmed order, they suddenly did list the ESP as well. It's in production now, so I'm cautiously optimistic to get them.

How to load the necessary code and get them working will be another task, but I'll cross that bridge when I get there.

Here is the BOM of my order.
espthings.io - ET-P1101 ESPHome Panasonic Climate Interface_BOM_PCBWay(3).xlsx

Just so you're aware, I did a similar thing 6 months ago (didn't end up getting it to work right but also couldn't be bothered once this started working again) and the screwed up the order of the wires on the connector. Just double check they got the direction of the connector right for you cause I had to snip all the wires and re do them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.