make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.31k stars 516 forks source link

Request to support thermostat Hysen HY08WE-2 WIFI- black #104

Closed mpetcuRO closed 2 years ago

mpetcuRO commented 2 years ago

Hello, I have the following thermostat for Floor heating - link I have followed the info on how to configure it with this integration and is accepting it as an "anderson_gsh_heater" no other similar device in the list. image After that it shows in HA but the update is slow and the temperatures is adding one "0" Actual temp, current temp is 19, set temp is 9 image in Lovelace the thermostat entity is slow to react and showing like this. image What do I need to get from the Tuya developer account to continue troubleshooting.

mpetcuRO commented 2 years ago

I have found the following in the Tuya platform under "Get the specifications and properties of the device" { "result": { "category": "wk", "functions": [ { "code": "switch", "desc": "{}", "name": "开关", "type": "Boolean", "values": "{}" }, { "code": "temp_set", "desc": "{\"unit\":\"℃\",\"min\":5,\"max\":1220,\"scale\":1,\"step\":1}", "name": "温度设置", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":5,\"max\":1220,\"scale\":1,\"step\":1}" }, { "code": "child_lock", "desc": "{}", "name": "童锁", "type": "Boolean", "values": "{}" } ], "status": [ { "code": "switch", "name": "开关", "type": "Boolean", "values": "{}" }, { "code": "temp_set", "name": "温度设置", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":5,\"max\":1220,\"scale\":1,\"step\":1}" }, { "code": "temp_current", "name": "当前温度", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":0,\"max\":1580,\"scale\":1,\"step\":1}" }, { "code": "child_lock", "name": "童锁", "type": "Boolean", "values": "{}" } ] }, "success": true, "t": 1641226734040 }

under "Get the instruction set of the device" { "result": { "category": "wk", "functions": [ { "code": "switch", "desc": "switch", "name": "switch", "type": "Boolean", "values": "{}" }, { "code": "temp_set", "desc": "temp set", "name": "temp set", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":5,\"max\":1220,\"scale\":1,\"step\":1}" }, { "code": "child_lock", "desc": "child lock", "name": "child lock", "type": "Boolean", "values": "{}" } ] }, "success": true, "t": 1641228140092 }

The thermostat has two temperature sensors, one in the main unit on the wall and one in the floor, the temperatures are booth shown in the aplication, it will be nice if you can choose what sensor will be the target temperature for HA thermostat as my idea on this is to keep the floor hot with electricity just for comfort and the ambient air temperature will be kept by the radiators in the house with gas. image

make-all commented 2 years ago

Also required will be the full output from the device. It is printed in the HA log as a warning message when you add the device if it is not an exact match. Otherwise, you need to set the log level to debug to see it every time the device is polled, or use some other method like tuyaapi/cli or tinytuya to query the device.

mpetcuRO commented 2 years ago

All I can find in the log after adding the Thermostat Warning 1 This error originated from a custom integration.

Logger: custom_components.tuya_local.config_flow Source: custom_components/tuya_local/config_flow.py:73 Integration: Tuya Local (documentation, issues) First occurred: 8:55:27 AM (1 occurrences) Last logged: 8:55:27 AM

Device matches andersson_gsh_heater with quality of 21%. DPS: {'1': True, '2': 50, '3': 170, '4': 'Manual', '6': False, '12': 0, '101': False, '102': False, '103': 170, '104': 4, '105': 15, '106': True, '107': True, '108': True, '109': -10, '110': 10, '111': 2, '112': 35, '113': 5, '114': 30, '115': 5, '116': 'all', '117': 'keep', '118': '2days', 'updated_at': 1641279321.0747674}

Warning 2 This error originated from a custom integration.

Logger: custom_components.tuya_local.config_flow Source: custom_components/tuya_local/config_flow.py:76 Integration: Tuya Local (documentation, issues) First occurred: 8:55:27 AM (1 occurrences) Last logged: 8:55:27 AM

Report this to https://github.com/make-all/tuya-local/issues/

Found that this was useful in other post, this is form Tuya debug. image

image

make-all commented 2 years ago

There isn't a lot of datapoints defined in the Tuya developer site, most of the settings may not be available via cloud. But that limits what I can decipher from the info the device is returning. I assume the external temperature is the other one reading 17 (same as the internal temperature reading), as nothing else seems close. If you save the following as hysen_hy08we2_thermostat.yaml in custom_components/tuya_local/devices/, it may help move things forward. But I'd be interested in figuring out more of these settings before commiting this.

name: Hysen HY08WE-2 Thermostat
primary_entity:
  entity: climate
  dps:
    - id: 1
      type: boolean
      name: hvac_mode
      mapping:
        - dps_val: true
          value: heat
        - dps_val: false
          value: "off"
    - id: 2
      type: integer
      name: temperature
      range:
        min: 5
        max: 1220
      mapping:
        - scale: 10
    - id: 3
      type: integer
      name: current_temperature
      mapping:
        - scale: 10
    - id: 4
      type: string
      name: unknown_4
    - id: 12
      type: integer
      name: unknown_12
    - id: 101
      type: boolean
      name: unknown_101
    - id: 102
      type: boolean
      name: unknown_102
    - id: 104
      type: integer
      name: unknown_104
    - id: 105
      type: integer
      name: unknown_105
    - id: 106
      type: boolean
      name: unknown_106
    - id: 107
      type: boolean
      name: unknown_107
    - id: 108
      type: boolean
      name: unknown_108
    - id: 109
      type: integer
      name: unknown_109
    - id: 110
      type: integer
      name: unknown_110
    - id: 111
      type: integer
      name: unknown_111
    - id: 112
      type: integer
      name: unknown_112
    - id: 113
      type: integer
      name: unknown_113
    - id: 114
      type: integer
      name: unknown_114
    - id: 115
      type: integer
      name: unknown_115
    - id: 116
      type: string
      name: unknown_116
    - id: 117
      type: string
      name: unknown_117
    - id: 118
      type: string
      name: unknown_118
secondary_entities:
  - entity: lock
    name: Child Lock
    category: config
    dps:
      - id: 6
        type: boolean
        name: lock
        mapping:
          - dps_val: True
            icon: "mdi:hand-back-right-off"
          - dps_val: False
            icon: "mdi:hand-back-right"
  - entity: sensor
    name: External Temperature
    class: temperature
    category: diagnostic
    dps:
      - id: 103
        type: integer
        name: unknown_103
mpetcuRO commented 2 years ago

yes, you are right, at the time when I added the thermostat booth external and internal sensor where reading 17, will try now the yaml, I assume I need to restart HA or remove/add the thermostat. Is there other way I can help in getting more info from the thermostat?

make-all commented 2 years ago

Once you have this config installed, you should be able to see all the "unknown_XXX" attributes in the Developer Tools tab of Home Assistant. Then you can change things from the control panel and see what they effect (you may need to reload the Developer Tools page to see changes). I guess that unknown_4 is the mode (Manual), the diagram for the control panel has Manual, Auto and Holiday icons next to each other, so I expect those (or something close) are the 3 values that can take, for example. And there is an anti-frost indicator, so probably one of the other True/False values is the anti-frost. Some of the others will be related to the program modes. Whatever you can figure out makes the config more complete, whatever you can't will still be there for observation as unknowns.

mpetcuRO commented 2 years ago

yes, you are right again.

changes to match the Tuya app min_temp: 5 (based on unknown_114) max_temp: 30 (based on unknown_115) target_temp_step: 0.5 current_temperature: 17 - internal sensor (no external temp sensor was created in HA) temperature: 5 - target temperature of internal device thermostat

unknown_4:

unknown_12: 0 ??? unknown_101: false ???

unknown_102:

unknown_106: true ??? unknown_107: true ??? unknown_108: true ??? unknown_109: -9 to 9 - Temp calibration internal sensor only (range -9 to 9) unknown_110: 5 to 25 - Int. Temperature Deadzone (0.5-2.5 range degrees) unknown_111: 1 to 10 - Ext. Temperature Deadzone unknown_112: 35 to 70 - High Temp Protection unknown_113: 1 to 10 - Low Temp Protection unknown_114: 2 to 70 - Max Temperature Limit unknown_115: 1 to 10 - Min Temperature Limit

From the Tuya app there's a settings page that you can configure what temp sensor to use. unknown_116:

State of thermostat after power out unknown_117:

Program Type unknown_118:

mpetcuRO commented 2 years ago

Hello, thank you for everything. Things that pops out right now:

  1. while installing the thermostat some of the options have no description image

  2. external temperature is wrong image

Will test in the following days with automations to see how it works, thank you again!!!

make-all commented 2 years ago

The blank strings will probably resolve if you refresh the page with Shift-Refresh, Home Assistant does a lot of caching to speed up the UI, and updating an integration does not seem to invalidate the cache. The scale of the external thermometer has been fixed I hope.

mpetcuRO commented 2 years ago

Hello, I have tested the thermostat/integration for the past two weeks with no issues, did not find any problems, all options working flawless. The thermostat goes to offline sometimes for 10 seconds but I think is because of wi-fi, but is rare and you will not notice if you are not playing with it all the time. Thanks for you work and time invested in this, you have a coffee from me anytime.

make-all commented 2 years ago

Thanks for the confirmation, and the coffee!

karnas99 commented 1 year ago

Sorry for re-opening it thread it this way. But I would like to ask for advise. I am using this integration for HY08WE-4 and it works really grate. However I would like to calculate power consumption based on time when thermostat is heating, I can see entity thermostat which have three measurement - current temperature, target temperature and heating. Heating is showing when the heating is on. However I don't know how to extract this state. I believe it is field 101, but in DB it look weird.

Ideally would it be possible to implement this? I know W consumption of floor heating so I just need to calculate with the time when the it heating.

Thanks in advance. 2 1

make-all commented 1 year ago

The "heating" state is coming from the hvac_action attribute of the climate entity. You would need to make a template sensor that conditionally sets the value to the power consumption of the heater or 0 depending on whether the value of hvac_action is "heating", or "idle" or "off".

If you have access to iot.tuya.com, you could also help to figure out what unknown_101 and the other unknown dps are by following the instructions from https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html for finding the datapoints in the debugger (start from step 7 if you already have an iot.tuya.com account, and ignore anything that talks about the Zigbee hub and sub devices).