bodyscape / cielo_home

Integration with Cielo Home
Apache License 2.0
49 stars 13 forks source link

setting preset mode #64

Open galmeida opened 3 months ago

galmeida commented 3 months ago

Hi,

is there anyway to set the preset mode using automation?

Thanks.

bodyscape commented 3 months ago

i will add it in the next version.

bodyscape commented 3 months ago

@galmeida try version 1.7.7

galmeida commented 3 months ago

Thanks @bodyscape, I tried 1.7.7 but couldn't get it to work. I added a Climate 'Set preset mode' action to an automation but it won't show the cielo thermostat as a possible target in choose area, device or entity. I also tried calling the service directly from developer tools like:

service: climate.set_preset_mode
data:
  entity_id: climate.XXXXXXX
  preset_mode: away

but that led to "Failed to call service climate.set_preset_mode. Entity climate.XXXXXXX does not support this service."

When I check the device info page I also don't see a preset control or any "disabled" controls (I see: main control, fan, mode, power, swing and target temperature), if I click the main control I also don't see a preset selector.

When I check device attributes I see:

{
    'hvac_modes': [
        <HVACMode.OFF: 'off'>,
        <HVACMode.COOL: 'cool'>,
        <HVACMode.DRY: 'dry'>,
        <HVACMode.AUTO: 'auto'>,
        <HVACMode.HEAT: 'heat'>
    ],
    'min_temp': 59,
    'max_temp': 89,
    'target_temp_step': 1,
    'fan_modes': [
        'auto',
        'Low',
        'Medium',
        'High'
    ],
    'swing_modes': [
        'Auto',
        'Position 1',
        'Position 2',
        'Position 3',
        'Position 4',
        'Position 5'
    ],
    'current_temperature': 71,
    'temperature': XX,
    'current_humidity': 'XX',
    'fan_mode': 'auto',
    'swing_mode': 'Auto',
    'friendly_name': 'XXXXXXX',
    'supported_features': <ClimateEntityFeature.TARGET_TEMPERATURE|FAN_MODE|SWING_MODE|TURN_OFF|TURN_ON: 425>
}

Maybe the issue is that preset is not present in supported features, despite its availability in both Cielo app and thermostat.

Device Info: BREEZ-MAX (BM02) by CIELO HOME Firmware: 1.0.4,1.0.2

Let me know if there's anything I can do on my side to help debug that, I'm fluent in python and comfortable making changes myself, applying patches and with general git stuff. I'd be glad to help if I can.

Thanks.

side note: it seems current_humidity is returned as a string, while temperature is an integer, not sure that's intentional.

bodyscape commented 3 months ago

Ohhh well you use BREEZ-MAX. I never test it and i don't have one. So there are features who are not supported by this integration with BREEZ-MAX.

galmeida commented 3 months ago

Oh ok, not tested on breeze max, totally understand that. If/when there's anything I can help with to help with support for it, let me know.

Thanks.

galmeida commented 3 months ago

Did a little bit more digging here and what I noticed is that device["appliance"]["turbo"] == "" for my device, also looking at the code, it seems there are only two possible preset modes today: [PRESET_NONE, PRESET_TURBO], is that right?

for breeze max, cielo provides a list of pre-defined presets in device, something like:

    "breezPresets": [
      {
        "mode": "auto",
        "heatTemp": "XX",
        "coolTemp": "YY",
        "heatFanspeed": "auto",
        "presetId": 1,
        "coolFanspeed": "auto",
        "title": "Home"
      },
      {
        "mode": "smart mode",
        "heatTemp": "XX",
        "coolTemp": "YY",
        "heatFanspeed": "auto",
        "presetId": 2,
        "coolFanspeed": "auto",
        "title": "Away"
      },
      {
        "mode": "smart mode",
        "heatTemp": "XX",
        "coolTemp": "YY",
        "heatFanspeed": "auto",
        "presetId": 3,
        "coolFanspeed": "auto",
        "title": "Sleep"
      }
    ],

and active preset seems to be defined by setting "preset": <presetId>. Does that look like the reason it doesn't work to you? If you confirm that, I will try to work on a PR

EDIT: that seems to be it, I hacked a version that makes the preset input box appear, I will try to work on a PR