vooon / hass-myheat

Home Assistant intergration with myheat.net gas heating controllers
MIT License
9 stars 3 forks source link

Не отображается текущий пресет отопления #64

Open timurvafin opened 7 months ago

timurvafin commented 7 months ago

HA Core: 2024.4.0 MyHeat: 0.4.0

Логи

2024-04-04 22:47:09.783 DEBUG (MainThread) [custom_components.myheat] Data: {'data': {'heaters': [{'id': 12, 'name': 'Котел', 'disabled': False, 'flowTemp': 25.889999999999997, 'returnTemp': None, 'pressure': None, 'targetTemp': None, 'burnerWater': False, 'burnerHeating': False, 'modulation': 0, 'severity': 1, 'severityDesc': 'Котел работает исправно.'}], 'envs': [{'id': 94, 'type': 'boiler_temperature', 'name': 'Горячая вода', 'value': 58.8, 'target': 60, 'demand': False, 'severity': 1, 'severityDesc': 'Нормальное состояние.'}, {'id': 95, 'type': 'room_temperature', 'name': 'Температура помещения', 'value': 25, 'target': 24, 'demand': False, 'severity': 1, 'severityDesc': 'Нормальное состояние.'}], 'engs': [], 'alarms': [], 'dataActual': True, 'severity': 32, 'severityDesc': 'Низкий баланс SIM-карты.', 'weatherTemp': '5.980000000000018', 'city': 'Столбищи'}, 'err': 0, 'refreshPage': False}

2024-04-04 22:39:21.386 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.myheat.climate.MhEnvClimate'>) implements HVACMode(s): off, heat and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please create a bug report at https://github.com/vooon/hass-myheat/issues

Карточка

  - type: thermostat
    entity: climate.myheat_temperatura_pomeshcheniia
    features:
      - type: climate-preset-modes
        style: dropdown
        preset_modes:
          - home
          - eco
          - sleep
          - away
          - none
      - type: climate-hvac-modes
        hvac_modes:
          - 'off'
          - heat
    show_current_as_primary: false

Myheat.net

Названия режимов переименованы, но id остались такие же

Панель управления 2024-04-04 23-01-51

Проблема

Если в интерфейсе карточки выбирать режим, то в myheat.net от успешно переключается, после перезагрузки страницы в HA сбрасывается на None

https://github.com/vooon/hass-myheat/assets/571/381a8675-47ea-4ffb-b21e-e0a092ac2dfd

vooon commented 7 months ago

Из апи невозможно узнать текущий пресет. Так что они работают только если ставить из ХА.

timurvafin commented 7 months ago

Спасибо за ответ!

Те это ожидаемое поведение, как показано на видео выше?

vooon commented 7 months ago

Вообще нет, должен оставаться включенный. Раньше так и работало, видимо что-то изменилось или сломал.

timurvafin commented 7 months ago

Как я могу помочь отдебажить?

vooon commented 7 months ago

https://github.com/vooon/hass-myheat/blob/master/custom_components/myheat/climate.py#L109

Нужно посмотреть что менялось в ХА, вероятно нужно какую-нибудь опцию выставить.

timurvafin commented 7 months ago

Мобильное приложение myheat делат вот такой запрос, чтобы получить состояние

Req

POST /client/getBoilerState HTTP/1.1
Host: c2.myheat.net
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Connection: keep-alive
Accept: application/json
User-Agent: MyHeat2/3 CFNetwork/1492.0.1 Darwin/23.3.0
Content-Length: 148
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate, br

device=A4354AC9-****-****-****-****&app=mh&device_id=****&key=****&device_name=iPhone&proto=4&device_type=2

Resp

{
  "device_count": 1,
  "devices": [
    {
      "id": 63936,
      "deviceType": 31,
      "label": "Дом",
      "severity": 32,
      "stateTimeSeverity": 1,
      "severity_desc": "Низкий баланс SIM-карты.",
      "cityName": "",
      "updateTime": 1712881363311
    }
  ],
  "device": {
    "id": 63936,
    "deviceType": 31,
    "label": "Дом ",
    "version": 127,
    "updateTime": 1712881363311,
    "stateTimeSeverity": 1,
    "severity": 32,
    "severity_desc": "Низкий баланс SIM-карты.",
    "lastVersion": 138,
    "maxModes": 10,
    "maxSchedules": 2,
    "cityName": "",
    "cityId": 487444,
    "currency": "RUR",
    "simPresent": true,
    "modemBalance": 0.0,
    "simActive": true,
    "ownSimCard": false,
    "simSignalLevel": 32,
    "wifiConnected": true,
    "lockModes": false,
    "wifiIp": "192.168.1.1",
    "wifiSignal": -81,
    "wifi": {
      "mode": 1,
      "ssid": "",
      "pwd": "",
      "ips": 0,
      "ip": "",
      "netmask": "",
      "gw": "",
      "dns": ""
    },
    "readonly": false,
    "heating_modes": [
      {
        "id": 1,
        "name": "Home",
        "icon": "fa fa-home",
        "color": 4
      },
      {
        "id": 2,
        "name": "Eco",
        "icon": "fa fa-home",
        "color": 3
      },
      {
        "id": 3,
        "name": "Away",
        "icon": "fa fa-home",
        "color": 2
      },
      {
        "id": 4,
        "name": "Sleep",
        "icon": "fa fa-home",
        "color": 1
      }
    ],
    "modeId": 4,
    "scheduleId": 0,
    "security_mode": 0,
    "heating_curves": [
      {
        "id": 1,
        "name": "Кривая № 1"
      },
      {
        "id": 2,
        "name": "Кривая № 2"
      },
      {
        "id": 3,
        "name": "Кривая № 3"
      },
      {
        "id": 4,
        "name": "Кривая № 4"
      },
      {
        "id": 5,
        "name": "Кривая № 5"
      },
      {
        "id": 6,
        "name": "Кривая № 6"
      },
      {
        "id": 7,
        "name": "Кривая № 7"
      },
      {
        "id": 8,
        "name": "Кривая № 8"
      }
    ],
    "scripts": [],
    "objects_count": 10,
    "objects": [
      {
        "id": 40,
        "label": "Беспр.датчик влажности 1",
        "type": 203,
        "severity": 0,
        "severity_changetime": 1711716314785,
        "params": [
          {
            "param_id": 2210,
            "value": "3"
          },
          {
            "param_id": 3014,
            "value": "a21cc500000001cb"
          },
          {
            "param_id": 3016,
            "value": "0"
          },
          {
            "param_id": 3048,
            "value": "960"
          },
          {
            "param_id": 3107,
            "value": "0"
          },
          {
            "param_id": 3125,
            "value": "1"
          },
          {
            "param_id": 3151,
            "value": "1"
          },
          {
            "param_id": 3072,
            "value": ""
          },
          {
            "param_id": 2353,
            "value": null
          },
          {
            "param_id": 2355,
            "value": null
          },
          {
            "param_id": 3028,
            "value": "humidity"
          },
          {
            "param_id": 3096,
            "value": null
          }
        ],
        "state": [
          {
            "param_id": 1,
            "value": 32.80000000000001
          },
          {
            "param_id": 7,
            "value": 72.0
          },
          {
            "param_id": 9,
            "value": 28.0
          },
          {
            "param_id": 106,
            "value": 1.0
          }
        ],
        "value": 32.80000000000001
      },
      {
        "id": 80,
        "label": "Беспр.датчик влажности 2",
        "type": 203,
        "severity": 0,
        "severity_changetime": 1711717100095,
        "params": [
          {
            "param_id": 2210,
            "value": "3"
          },
          {
            "param_id": 3014,
            "value": "a21cc500000002cb"
          },
          {
            "param_id": 3016,
            "value": "0"
          },
          {
            "param_id": 3048,
            "value": "960"
          },
          {
            "param_id": 3107,
            "value": "0"
          },
          {
            "param_id": 3125,
            "value": "1"
          },
          {
            "param_id": 3151,
            "value": "1"
          },
          {
            "param_id": 3072,
            "value": ""
          },
          {
            "param_id": 2353,
            "value": null
          },
          {
            "param_id": 2355,
            "value": null
          },
          {
            "param_id": 3028,
            "value": "humidity"
          },
          {
            "param_id": 3096,
            "value": null
          }
        ],
        "state": [
          {
            "param_id": 1,
            "value": 31.6
          },
          {
            "param_id": 7,
            "value": 72.0
          },
          {
            "param_id": 9,
            "value": 74.0
          },
          {
            "param_id": 106,
            "value": 1.0
          }
        ],
        "value": 31.6
      },
      {
        "id": 30,
        "label": "Беспр.датчик темп-ры 1",
        "type": 202,
        "severity": 0,
        "severity_changetime": 1711716314782,
        "params": [
          {
            "param_id": 2210,
            "value": "3"
          },
          {
            "param_id": 3014,
            "value": "a21cc500000001ca"
          },
          {
            "param_id": 3016,
            "value": "0"
          },
          {
            "param_id": 3048,
            "value": "960"
          },
          {
            "param_id": 3107,
            "value": "0"
          },
          {
            "param_id": 3125,
            "value": "1"
          },
          {
            "param_id": 3151,
            "value": "1"
          },
          {
            "param_id": 3072,
            "value": ""
          },
          {
            "param_id": 2353,
            "value": null
          },
          {
            "param_id": 2355,
            "value": null
          },
          {
            "param_id": 3028,
            "value": "temperature"
          },
          {
            "param_id": 3096,
            "value": null
          }
        ],
        "state": [
          {
            "param_id": 1,
            "value": 23.1
          },
          {
            "param_id": 7,
            "value": 72.0
          },
          {
            "param_id": 9,
            "value": 28.0
          },
          {
            "param_id": 106,
            "value": 1.0
          }
        ],
        "value": 23.1
      },
      {
        "id": 70,
        "label": "Беспр.датчик темп-ры 2",
        "type": 202,
        "severity": 0,
        "severity_changetime": 1711717100093,
        "params": [
          {
            "param_id": 2210,
            "value": "3"
          },
          {
            "param_id": 3014,
            "value": "a21cc500000002ca"
          },
          {
            "param_id": 3016,
            "value": "0"
          },
          {
            "param_id": 3048,
            "value": "960"
          },
          {
            "param_id": 3107,
            "value": "0"
          },
          {
            "param_id": 3125,
            "value": "1"
          },
          {
            "param_id": 3151,
            "value": "1"
          },
          {
            "param_id": 3072,
            "value": ""
          },
          {
            "param_id": 2353,
            "value": null
          },
          {
            "param_id": 2355,
            "value": null
          },
          {
            "param_id": 3028,
            "value": "temperature"
          },
          {
            "param_id": 3096,
            "value": null
          }
        ],
        "state": [
          {
            "param_id": 1,
            "value": 23.0
          },
          {
            "param_id": 7,
            "value": 72.0
          },
          {
            "param_id": 9,
            "value": 74.0
          },
          {
            "param_id": 106,
            "value": 1.0
          }
        ],
        "value": 23.0
      },
      {
        "id": 94,
        "goal": 40.0,
        "label": "Горячая вода",
        "type": 104,
        "severity": 1,
        "severity_desc": "Нормальное состояние.",
        "severity_changetime": 1711733188564,
        "params": [
          {
            "param_id": 3008,
            "value": "40"
          },
          {
            "param_id": 3022,
            "value": "-16777216"
          },
          {
            "param_id": 3011,
            "value": "65"
          },
          {
            "param_id": 3012,
            "value": "30"
          },
          {
            "param_id": 3009,
            "value": "0"
          },
          {
            "param_id": 3010,
            "value": "3"
          },
          {
            "param_id": 3026,
            "value": "1"
          },
          {
            "param_id": 3028,
            "value": "temperature"
          },
          {
            "param_id": 3022,
            "value": "-16777216"
          },
          {
            "param_id": 3049,
            "value": null
          }
        ],
        "state": [
          {
            "param_id": 1,
            "value": 64.5
          },
          {
            "param_id": 2,
            "value": 1.0
          },
          {
            "param_id": 4,
            "value": 0.0
          },
          {
            "param_id": 6,
            "value": 0.0
          },
          {
            "param_id": 11,
            "value": 0.0
          },
          {
            "param_id": 106,
            "value": 0.0
          },
          {
            "param_id": 121,
            "value": 40.0
          },
          {
            "param_id": 135,
            "value": 0.0
          },
          {
            "param_id": 136,
            "value": 1712361600.0
          }
        ],
        "object_state": 0,
        "value": 64.5
      },
      {
        "id": 12,
        "label": "Котел",
        "type": 303,
        "severity": 1,
        "severity_desc": "Котел работает исправно.",
        "severity_changetime": 1711730864407,
        "params": [
          {
            "param_id": 3013,
            "value": "0"
          },
          {
            "param_id": 10001,
            "value": "Viessmann"
          },
          {
            "param_id": 10002,
            "value": "Vitodens 100-W (B1HC/B1KC)"
          },
          {
            "param_id": 10003,
            "value": "35"
          },
          {
            "param_id": 10004,
            "value": "35.0"
          }
        ],
        "state": [
          {
            "param_id": 2,
            "value": 1.0
          },
          {
            "param_id": 100,
            "value": 25.889999999999997
          },
          {
            "param_id": 103,
            "value": 64.59000000000002
          },
          {
            "param_id": 106,
            "value": 2336.0
          },
          {
            "param_id": 107,
            "value": 80.0
          },
          {
            "param_id": 110,
            "value": 0.0
          },
          {
            "param_id": 116,
            "value": 40.0
          },
          {
            "param_id": 120,
            "value": 399701.0
          },
          {
            "param_id": 129,
            "value": 300.0
          },
          {
            "param_id": 130,
            "value": 3014.0
          },
          {
            "param_id": 131,
            "value": 124.0
          },
          {
            "param_id": 132,
            "value": 102.0
          },
          {
            "param_id": 133,
            "value": 32499.11767578125
          }
        ],
        "object_state": 0
      },
      {
        "id": 2,
        "label": "Реле",
        "type": 404,
        "severity": 0,
        "severity_changetime": 1711716095364,
        "params": [
          {
            "param_id": 2204,
            "value": "0"
          },
          {
            "param_id": 3171,
            "value": "0"
          }
        ],
        "state": []
      },
      {
        "id": 93,
        "label": "Температура подачи",
        "type": 201,
        "severity": 0,
        "severity_changetime": 1711733075600,
        "params": [
          {
            "param_id": 2210,
            "value": "1"
          },
          {
            "param_id": 3014,
            "value": "2822a8c7262001ae"
          },
          {
            "param_id": 3016,
            "value": "0"
          },
          {
            "param_id": 3048,
            "value": "240"
          },
          {
            "param_id": 3072,
            "value": null
          },
          {
            "param_id": 3107,
            "value": "0"
          },
          {
            "param_id": 3151,
            "value": "1"
          },
          {
            "param_id": 3003,
            "value": "30"
          },
          {
            "param_id": 3028,
            "value": "temperature_wired"
          },
          {
            "param_id": 3096,
            "value": null
          }
        ],
        "state": [
          {
            "param_id": 1,
            "value": 25.75
          },
          {
            "param_id": 106,
            "value": 1.0
          }
        ],
        "value": 25.75
      },
      {
        "id": 95,
        "goal": 22.0,
        "label": "Температура помещения",
        "type": 101,
        "severity": 1,
        "severity_desc": "Нормальное состояние.",
        "severity_changetime": 1712867254026,
        "params": [
          {
            "param_id": 3008,
            "value": "22"
          },
          {
            "param_id": 3022,
            "value": "-16777216"
          },
          {
            "param_id": 3011,
            "value": "45"
          },
          {
            "param_id": 3012,
            "value": "10"
          },
          {
            "param_id": 3009,
            "value": "0"
          },
          {
            "param_id": 3010,
            "value": "0.5"
          },
          {
            "param_id": 3026,
            "value": "1"
          },
          {
            "param_id": 3028,
            "value": "temperature"
          },
          {
            "param_id": 3022,
            "value": "-16777216"
          },
          {
            "param_id": 3049,
            "value": null
          }
        ],
        "state": [
          {
            "param_id": 1,
            "value": 23.05
          },
          {
            "param_id": 2,
            "value": 1.0
          },
          {
            "param_id": 4,
            "value": 0.0
          },
          {
            "param_id": 6,
            "value": 0.0
          },
          {
            "param_id": 11,
            "value": 0.0
          },
          {
            "param_id": 106,
            "value": 0.0
          },
          {
            "param_id": 121,
            "value": 22.0
          },
          {
            "param_id": 135,
            "value": 0.0
          }
        ],
        "object_state": 0,
        "value": 23.05
      },
      {
        "id": 1,
        "label": "Цифровая шина",
        "type": 405,
        "severity": 0,
        "severity_changetime": 1711716095365,
        "params": [],
        "state": []
      }
    ],
    "weather": {
      "cityTemp": 9,
      "humidity": 81,
      "time": 1712880592209,
      "icon": "01n"
    }
  }
}
vooon commented 7 months ago

Не хотелось бы пользоваться реверсом на отдельное апи. По используемому сейчас хоть дока есть: https://github.com/vooon/hass-myheat/blob/master/custom_components/myheat/api.py