sockless-coding / panasonic_cc

Panasonic Comfort Cloud - Home Assistant Component
MIT License
137 stars 35 forks source link

Using scene on fly won't work as expected #135

Open olivierSemet opened 11 months ago

olivierSemet commented 11 months ago

Scenario: I would like to use automation for stopping my air conditioner when windows are opened and turn it on again when closing the window. Easiest way to achieve it is to create scene on the fly and capture states before opening windows with the snapshot_entities parameter

Automation sample:

...
service: scene.create
data:
  scene_id: before_open_windows
  snapshot_entities:
    - climate.living_room
 ... 

Unfortunately with the current implementation, air conditioner will turn on when you close the window even if it was off before you opened the window

Issue comes from that the integration turn on the device when you update the _swing_mode, temprature, presetmode properties:

For fan mode, the behaviour is different, it doesn't turn on the device:

As it seems to be the expected behaviour, I won't flag it as a bug but:

sockless-coding commented 10 months ago

Hi @olivierSemet I have a vague memory of that the power parameter was required to be set to On for the device to honor the other settings. My Panasonic is currently not operational (Hopefully I get it fixed soon), so I can not verify this (and it might have changed).

olivierSemet commented 10 months ago

Hi @sockless-coding,

Tested this morning with pcomfortcloud app, it works well without turning ON devices:

pcomfortcloud <email>  <pwd> get 6
reading from device 'salon' (xxx)
id                       : xxxx
parameters
    temperatureInside    : 18
    temperatureOutside   : 21
    temperature          : 21
    power                : Off
    mode                 : Cool
    fanSpeed             : HighMid
    airSwingHorizontal   : Mid
    airSwingVertical     : DownMid
    eco                  : Auto
    nanoe                : Off
pcomfortcloud <email>  <pwd>  set -t 27 6
pcomfortcloud <email> <pwd>get 6
reading from device 'salon' (xxx)
id                       :xxx
parameters
    temperatureInside    : 18
    temperatureOutside   : 21
    temperature          : 27
    power                : Off
    mode                 : Heat
    fanSpeed             : HighMid
    airSwingHorizontal   : Mid
    airSwingVertical     : DownMid
    eco                  : Auto
    nanoe                : Off

I tested other parameters than temperature.

To fix my issue with automations and dynamic scenes, I added an option which I called CONF_ENABLE_AUTO_POWER_ON. By default this option is activated to keep the actual behaviour. It works fine except if you enable this option, there is no way to switch ON devices on thermostat widgets. I might need to implement a custom component working like the one from the official comfort cloud mobile app. Other solution is do an exception for parameter mode. When changing mode, we can still turn ON devices. I'll do a PR if you're interested by those changes.