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

Power Off Command Inverts AC Unit State #324

Closed
3 tasks done
peteger opened this issue Oct 13, 2024 · 20 comments
Closed
3 tasks done

Power Off Command Inverts AC Unit State #324

peteger opened this issue Oct 13, 2024 · 20 comments
Labels
bug Something isn't working stale

Comments

@peteger
Copy link

peteger commented Oct 13, 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.2

Describe the issue

The problem

Issue: HomeKit Bridge Integration Inverts AC Unit State on Power Off Command

Description:

When using HomeKit Bridge to control the AC unit from Apple HomeKit, the power off command inverts the current state of the unit.

• If the AC is turned on, issuing the off command through HomeKit will turn it off, as expected.
• However, if the AC is already off, issuing the off command will turn it on instead of keeping it off.
This causes confusion and requires manual intervention to ensure the AC is in the correct state. It would be helpful if the off command consistently kept the unit off, regardless of its prior state.

Steps to Reproduce:

  1. Turn off the AC unit via HomeKit.
  2. Issue a power off command via Shortcut
  3. Observe the state of the AC unit
    Expected Result: The AC unit should remain off when issuing the power off command.

Actual Result: The power off command turns the AC unit on if it was previously off.

367175619-6883141e-52f8-4268-a1d7-ef08c0b89e11 367175623-41e6f4b3-eb35-4ad9-9347-dff4a4888342

Log file:

home-assistant_2024-09-13T06-15-02.870Z.log

Error/Debug Logs

No response

@peteger peteger added the bug Something isn't working label Oct 13, 2024
@sockless-coding
Copy link
Owner

@peteger as far as I can see, you do not seem to be using this integration to control your AC. This integration has nothing to do with HomeKit.

@mkz212
Copy link

mkz212 commented Oct 13, 2024

I also notice this problem. Using HomeKit, when AC is turned on and I will send command to turn off it will turn off. But if it is turned off and I send command (via automation) to turn off it will... turn on!

@peteger
Copy link
Author

peteger commented Oct 13, 2024

@sockless-coding Thanks, Jimmy, and sorry if I misunderstood. I thought the way I was using it was that the HomeKit Bridge integration simply exposes the controls of this integration to Apple HomeKit, and when I send a command from the iOS HomeKit app, it is relayed to this integration via the HomeKit Bridge. Or is this working differently?

@mkz212
Copy link

mkz212 commented Oct 13, 2024

I think that I know what is wrong. If you set automation in Apple Home to turn off AC it send not only command to set off but also command to set target temperature. If you create scene using Eve app and in this scene you set only turn off command it works ok. I think it is bug cause set target temp should not enable AC. (Other plugin for other brand AC not have this behaviour).

@sockless-coding
Copy link
Owner

This integration talks directly to the Panasonic API, it reads and sets the states directly... You should probably avoid mixing "controller", adding automations in HA and HomeKit is just asking for trouble.

@mkz212
Copy link

mkz212 commented Oct 14, 2024

This integration talks directly to the Panasonic API, it reads and sets the states directly... You should probably avoid mixing "controller", adding automations in HA and HomeKit is just asking for trouble.

I know it can be solved, cause Gree Integration works ok. In HomeKit it also shows as thermostat + fan.

@peteger
Copy link
Author

peteger commented Oct 14, 2024

This integration talks directly to the Panasonic API, it reads and sets the states directly... You should probably avoid mixing "controller", adding automations in HA and HomeKit is just asking for trouble.

Yes, that’s correct. When I use this integration within HA, it works fine (the “turn off” action only sends a signal to turn off the unit, without setting the temperature). I reported this issue because many users rely on this integration to control Panasonic AC units through HomeKit via HA. It worked well before, but since a recent update (not sure if this was related to HA Core or this integration), I’ve been experiencing problems. Fixing this would be a great help.

At the moment, I’ve had to remove all my HomeKit automations related to Panasonic AC units because they’re not functioning as expected. For example, I want to turn off all AC units when I leave the house, but currently, it turns some units off and others on. I even discussed this with a few Apple HomeKit engineers and reported the issue, but I don’t believe they see it as a problem as setting the target temperature on a turned-off unit shouldn’t turn it back on.

@peteger
Copy link
Author

peteger commented Oct 14, 2024

I believe the issue is related to this line of code, which turns the AC unit on when a set_target_temperature command is called:

// custom_components/panasonic_cc/pcomfortcloud/changerequestbuilder.py

@property
    def target_temperature(self) -> int | None:
        return self._request["temperatureSet"] if "temperatureSet" in self._request else None
    
    def set_target_temperature(self, new_value: int):
        """ Set target temperature """
        self._ensure_powered_on() // <---- THIS LINE
        self._request["temperatureSet"] = new_value
        return self

You can replicate the issue directly in HA by setting a temperature on a turned-off AC unit—it turns the unit back on.

@peteger
Copy link
Author

peteger commented Oct 14, 2024

A suggestion for a workaround if you want to keep the functionality as it is:

  • If the target_temperature matches the current temperature on the AC unit, do nothing.

This would resolve the automation issue in HomeKit, as I can set the same temperature for both On and Off automations.

@mkz212
Copy link

mkz212 commented Oct 14, 2024

I believe the issue is related to this line of code, which turns the AC unit on when a set_target_temperature command is called:

// custom_components/panasonic_cc/pcomfortcloud/changerequestbuilder.py

@property
    def target_temperature(self) -> int | None:
        return self._request["temperatureSet"] if "temperatureSet" in self._request else None
    
    def set_target_temperature(self, new_value: int):
        """ Set target temperature """
        self._ensure_powered_on() // <---- THIS LINE
        self._request["temperatureSet"] = new_value
        return self

You can replicate the issue directly in HA by setting a temperature on a turned-off AC unit—it turns the unit back on.

If your AC is turned off and you select quiet mode it also turn on AC (see #325). So it is not only to set target temp. But this is not correct behaviour. Only set mode (auto/heat/cool/off) should turn AC on / off.

@mkz212
Copy link

mkz212 commented Oct 14, 2024

@peteger I see you're using HomeKit. Do you also have such an error as I described here : #323 ? Problem setting speed in HomeKit?

@sockless-coding
Copy link
Owner

The reason most calls has the self._ensure_powered_on() is because these actions requires the AC to be on when setting them from the App. Making requests not available in the app can result in "suspicious activity blocks".

@peteger
Copy link
Author

peteger commented Oct 14, 2024

The reason most calls has the self._ensure_powered_on() is because these actions requires the AC to be on when setting them from the App. Making requests not available in the app can result in "suspicious activity blocks".

Thank you, Jimmy. Does this mean you cannot set or get the target temperature if the AC unit is off? Would my suggested workaround be helpful in this situation? I appreciate your time and patience with us!

@peteger
Copy link
Author

peteger commented Oct 14, 2024

@peteger I see you're using HomeKit. Do you also have such an error as I described here : #323 ? Problem setting speed in HomeKit?

When I try to change the fan speed of the turned-off unit in HomeKit, it has no effect (the unit is not turned on).

@mkz212
Copy link

mkz212 commented Oct 14, 2024

@peteger I see you're using HomeKit. Do you also have such an error as I described here : #323 ? Problem setting speed in HomeKit?

When I try to change the fan speed of the turned-off unit in HomeKit, it has no effect (the unit is not turned on).

But when AC is turned on can you change speed via HomeKit?

@mkz212
Copy link

mkz212 commented Oct 14, 2024

The reason most calls has the self._ensure_powered_on() is because these actions requires the AC to be on when setting them from the App. Making requests not available in the app can result in "suspicious activity blocks".

Panasonic block IP for 24h when:

  • there is too wrong login atempts (with wrong login / password / app version)
  • request are too frequent

There is no blocking if you send set target temp or or other command when AC is turned off. I have automation that works every 15 minutes and it never blocked api (using Homebridge plugin for years with this setup).

So maybe make this function as option, to enable / disable in config?

@peteger
Copy link
Author

peteger commented Oct 14, 2024

@peteger I see you're using HomeKit. Do you also have such an error as I described here : #323 ? Problem setting speed in HomeKit?

When I try to change the fan speed of the turned-off unit in HomeKit, it has no effect (the unit is not turned on).

But when AC is turned on can you change speed via HomeKit?

I just tried and changing the fan speed does not have any effect on my AC unit.

@mkz212
Copy link

mkz212 commented Oct 14, 2024

@peteger I see you're using HomeKit. Do you also have such an error as I described here : #323 ? Problem setting speed in HomeKit?

When I try to change the fan speed of the turned-off unit in HomeKit, it has no effect (the unit is not turned on).

But when AC is turned on can you change speed via HomeKit?

I just tried and changing the fan speed does not have any effect on my AC unit.

Ok thank you. Same here. Everything works well in HomeKit, except speed. And turning on AC via commands that should not turn on AC (this behaviour exist also directly in HA).

Copy link

Hi there! This issue has been marked as stale due to inactivity. If you believe this is still relevant, please let us know. Otherwise, it will be closed soon.

@github-actions github-actions bot added the stale label Dec 14, 2024
Copy link

This issue has been automatically closed due to inactivity. If you still need help, feel free to reopen or create a new issue. Thank you!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants