rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.86k stars 551 forks source link

hvac_action not being provided despite being configured #1156

Closed apbarratt closed 2 weeks ago

apbarratt commented 1 year ago

The problem

Hi guys, I have an unusual smart thermostat for my underfloor heating that works far better using localtuya than it does using the official tuya integration. When using the official integration for instance, the only data available is on/off (represented by "heating / cooling" or Off, despite having no kind of cooling feature" and the target temperature. Through Local Tuya, I am able to show the current temperature, the hvac mode (as heat/off) and the target temperature. It'd be neat to be able to also show the additional floor temperature but not a big deal right now.

The issue I'm having is the so called hvac_action. On my device this is represented as heating or warming. With warming being what is shown when no heating is on, regardless of whether it's been on at all.

Anyway, I've been able to set this up in my configuration, I've got hvac_action_dp set to 118 (which has a value of "warming" or "heating" as noted. And I've set hvac_action_set to "Heat/Warming".

However, when I look at this thermostat's list of attributes, hvac_action simply isn't there where on other thermostats provided by other integrations it is. I'm not entirely sure if this is a localtuya issue or something else.

Environment

Steps to reproduce

  1. Add a thermostat that presents its hvac_action as heating/warming
  2. On dev tools template viewer, load the full state object for it using {{ states.climate.your_thermostat }}
  3. Observe that hvac_action is not shown in the object.

Configuration configuration.yaml or config_flow

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.11.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "5.15.61-v8",
    "supervisor": "2022.11.2",
    "host_os": "Home Assistant OS 9.3",
    "docker_version": "20.10.18",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "tapo": {
      "version": "1.2.18",
      "requirements": [
        "plugp100==2.1.20"
      ]
    },
    "super_soco_custom": {
      "version": "1.0.0-beta.5",
      "requirements": []
    },
    "hacs": {
      "version": "1.28.4",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "octopus_energy": {
      "version": "4.6.4",
      "requirements": []
    },
    "localtuya": {
      "version": "4.1.1",
      "requirements": []
    },
    "fontawesome": {
      "version": "2.1.5",
      "requirements": []
    },
    "waste_collection_schedule": {
      "version": "1.27.0",
      "requirements": [
        "icalendar",
        "recurring_ical_events",
        "icalevents",
        "bs4"
      ]
    },
    "alexa_media": {
      "version": "4.3.2",
      "requirements": [
        "alexapy==1.26.4",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "myenergi": {
      "version": "0.0.20",
      "requirements": [
        "pymyenergi==0.0.24"
      ]
    }
  },
  "integration_manifest": {
    "domain": "localtuya",
    "name": "LocalTuya integration",
    "version": "4.1.1",
    "documentation": "https://github.com/rospogrigio/localtuya/",
    "dependencies": [],
    "codeowners": [
      "@rospogrigio",
      "@postlund"
    ],
    "issue_tracker": "https://github.com/rospogrigio/localtuya/issues",
    "requirements": [],
    "config_flow": true,
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "device_config": {
      "friendly_name": "Office thermostat",
      "host": "192.168.8.6",
      "local_key": "super sexy local key",
      "protocol_version": "3.3",
      "scan_interval": 5,
      "entities": [
        {
          "friendly_name": "Office Thermostat",
          "target_temperature_dp": 102,
          "current_temperature_dp": 105,
          "temperature_step": 1,
          "hvac_mode_dp": 101,
          "hvac_mode_set": "True/False",
          "hvac_action_dp": 118,
          "hvac_action_set": "Heat/Warming",
          "temperature_unit": "celsius",
          "heuristic_action": false,
          "id": 101,
          "platform": "climate"
        }
      ],
      "model": "WIFI thermostat",
      "device_id": "a cute little device id",
      "dps_strings": [
        "101 (value: True)",
        "102 (value: 200)",
        "103 (value: smart)",
        "104 (value: 0)",
        "105 (value: 270)",
        "106 (value: 150)",
        "107 (value: False)",
        "108 (value: False)",
        "109 (value: 0)",
        "110 (value: 0)",
        "111 (value: 0)",
        "112 (value: 50)",
        "113 (value: 0)",
        "114 (value: 1)",
        "116 (value: 100)",
        "117 (value: 23)",
        "118 (value: warming)",
        "121 (value: 270)"
      ],
      "product_key": "a delectable product key"
    },
    "device_cloud_info": {
      "active_time": 1666784222,
      "biz_type": 18,
      "category": "wk",
      "create_time": 1652367704,
      "icon": "smart/icon/1536734562f0k6qabd34t_0.png",
      "id": "super sexy id",
      "ip": "super sexy ip",
      "lat": "a lovely Scottish lattitude",
      "local_key": "such a pretty local key",
      "lon": "a bonny wee Scottish longitude",
      "model": "61Plus/61Plus/81Plus",
      "name": "Office thermostat",
      "online": true,
      "owner_id": "a very handsome owner's id",
      "product_id": "beautiful product id",
      "product_name": "WIFI thermostat",
      "status": [
        {
          "code": "switch",
          "value": true
        },
        {
          "code": "temp_set",
          "value": 160
        },
        {
          "code": "temp_unit_convert",
          "value": "c"
        },
        {
          "code": "child_lock",
          "value": false
        },
        {
          "code": "holiday_days_set",
          "value": 0
        },
        {
          "code": "factory_reset",
          "value": false
        }
      ],
      "sub": false,
      "time_zone": "+00:00",
      "uid": "a pretty uid",
      "update_time": 1666784228,
      "uuid": "an adorable uuid"
    }
  }
}

DP dump

I think that's in the stuff above though I'd note I can never actually get this to update past the state it was when I first configured the component.

Provide Home Assistant taceback/logs

Additional information

rrooggiieerr commented 1 year ago

Hi! Just wanted to say that I have the same heating/warming values but for hvac_action_dp 3

Brand and model of my thermostat is Magnum MRC

apbarratt commented 1 year ago

I have done a lot of work qualifying my DPs and I think I've found the issue. My HVAC options are not Heat/Warming but rather heating/warming. To be honest, I'd much prefer some ability to map these options too, especially as warming is not really accurate when the underfloor heating hasn't been on for quite some time. An ideal solution would be one matching the select entity, where I can type heating;warming as options and map these to more realistic Heat;Idle that I'd expect from other thermostats such as my Nest.

apbarratt commented 1 year ago

I have managed to resolve the issue by adding these options to the code base and have opened a PR: https://github.com/rospogrigio/localtuya/pull/1177

rrooggiieerr commented 1 year ago

Thanks for your followup @apbarratt. Yes for me heating means the thermostat is actually heating the floor while warming means it's idle