localtuya icon indicating copy to clipboard operation
localtuya copied to clipboard

Add support for Tuya WIFI plugged Temp and Humidity sensors

Open poolMiniDomo opened this issue 2 years ago • 5 comments

Hello,

looking for support for Temp and Humidity sensors. I bought this device to work locally: https://www.amazon.fr/MOES-Commutation-Intelligent-temp%C3%A9rature-t%C3%A9l%C3%A9commande/dp/B09TBBT1CD/ref=sr_1_4?__mk_fr_FR=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=13OM3XJQP117T&keywords=MOES+WiFi+Smart+Temperature+Sensor&qid=1655097785&sprefix=moes+wifi+smart+temperature+sensor%2Caps%2C127&sr=8-4

"category": "wkcz", "name": "Two-way temperature and humidity switch", "product_id": "dlsdk5zvkuuhufpy", "product_name": "Two-way temperature and humidity switch",

I need temperature in C° (switches don't interest me) I am new to HA, but I believe that this sensor is not yet supported.

thanks in advance

poolMiniDomo avatar Jun 13 '22 05:06 poolMiniDomo

Please follow these instructions to obtain a DPs dump and report back the results: https://github.com/rospogrigio/localtuya/wiki/HOWTO-get-a-DPs-dump

The dev's are a little busy with bugs from the big v4 upgrade, but if you can get the DPs info it'll help a lot. We might even be able to set up some sensors that achieve what you need, without any changes.

jeremysherriff avatar Jun 15 '22 05:06 jeremysherriff

I excute the DPs Dump

DPS [1] VALUE [True] DPS [2] VALUE [False] DPS [3] VALUE [False] DPS [4] VALUE [manual] DPS [6] VALUE [241] DPS [8] VALUE [False] DPS [9] VALUE [0] DPS [11] VALUE [False] DPS [12] VALUE [0] DPS [18] VALUE [0] DPS [20] VALUE [0] DPS [21] VALUE [0] DPS [22] VALUE [0] DPS [24] VALUE [] DPS [101] VALUE [] DPS [102] VALUE [] DPS [103] VALUE [0] DPS [104] VALUE [0] DPS [105] VALUE [off] DPS [106] VALUE [mix]

MOES

poolMiniDomo avatar Jun 26 '22 16:06 poolMiniDomo

Depending on what you are trying to achieve, I can see that you can set up a sensor device to capture temperature (DPS 6, scaling factor 0.1). Normally DPS 1 is a switch (on/off maps to true/false) but that may not be correct for your device.

You may need to capture the DPS values after making changes through the app, so that you can understand which DPS values map to which app functions.

jeremysherriff avatar Jun 26 '22 19:06 jeremysherriff

nformation obtained from DPs dump:

"interrupteur principal"(switch): dp1 on/off "Commutateur 1"(switch) - dp 2 : on/off "Commutateur 1"(switch) - dp 3 : on/off "Manuel / automatique" - dp 4 : auto/manuel "temperature" - dp 6 : integer (scale 0.1 ) "étalonnage temperature" - dp18 : integer (scale 0.1 ) "automatique Commutateur 1" dp 101 : somthing like 8000010000000101FFFFFFFF01 with auto selected and a rule set "automatique Commutateur 2" dp 102 : somthing like 0000010000000101FFFFFFFF01 with auto selected and a rule set "Compte à rebour 1" - dp 103 : integer (second) "Compte à rebour 2" - dp 104 : integer (second) "etat de redemarage" - dp 105 : on/off/memory

poolMiniDomo avatar Jun 29 '22 21:06 poolMiniDomo

I managed to get Tuya to add this to the official Tuya Cloud API (it was actually really easy!)

Passing the Tuya Cloud and DP dump values along in case that's helpful

    "status": {
      "switch_1": true,
      "countdown_1": 0,
      "cycle_time": "",
      "work_mode": "hot",
      "customize_mode_switch": false,
      "add_ele": 107,
      "cur_current": 2980,
      "cur_power": 7140,
      "cur_voltage": 2336,
      "voltage_coe": 584,
      "electric_coe": 25300,
      "power_coe": 14000,
      "electricity_coe": 2970,
      "power_limit": 36000,
      "test_bit": 1,
      "temp_unit_convert": "c",
      "temp_set_f": 770,
      "temp_set": 250,
      "temp_current": 265,
      "temp_current_f": 797,
      "vibration_value": 20,
      "temp_correction": 0,
      "humidity_set": 50,
      "hum_rangle": 4,
      "humidity_value": 63,
      "hum_calibration": 0,
      "fault": 0,
      "cold_delay": 2,
      "cold_delay_switch": false
    },
   "status_range": {
      "switch_1": {
        "type": "Boolean",
        "value": {}
      },
      "countdown_1": {
        "type": "Integer",
        "value": {
          "unit": "s",
          "min": 0,
          "max": 86400,
          "scale": 0,
          "step": 1
        }
      },
      "cycle_time": {
        "type": "String",
        "value": {}
      },
      "work_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "hot",
            "dehumidify",
            "colding",
            "wet"
          ]
        }
      },
      "customize_mode_switch": {
        "type": "Boolean",
        "value": {}
      },
      "add_ele": {
        "type": "Integer",
        "value": {
          "unit": "kW\u00b7h",
          "min": 0,
          "max": 50000,
          "scale": 3,
          "step": 100
        }
      },
      "cur_current": {
        "type": "Integer",
        "value": {
          "unit": "mA",
          "min": 0,
          "max": 30000,
          "scale": 0,
          "step": 1
        }
      },
      "cur_power": {
        "type": "Integer",
        "value": {
          "unit": "W",
          "min": 0,
          "max": 80000,
          "scale": 1,
          "step": 1
        }
      },
      "cur_voltage": {
        "type": "Integer",
        "value": {
          "unit": "V",
          "min": 0,
          "max": 5000,
          "scale": 1,
          "step": 1
        }
      },
      "voltage_coe": {
        "type": "Integer",
        "value": {
          "min": 0,
          "max": 2147483647,
          "scale": 0,
          "step": 1
        }
      },
      "electric_coe": {
        "type": "Integer",
        "value": {
          "min": 0,
          "max": 2147483647,
          "scale": 0,
          "step": 1
        }
      },
      "power_coe": {
        "type": "Integer",
        "value": {
          "min": 0,
          "max": 2147483647,
          "scale": 0,
          "step": 1
        }
      },
      "electricity_coe": {
        "type": "Integer",
        "value": {
          "min": 0,
          "max": 2147483647,
          "scale": 0,
          "step": 1
        }
      },
      "power_limit": {
        "type": "Integer",
        "value": {
          "unit": "W",
          "min": 0,
          "max": 80000,
          "scale": 1,
          "step": 1
        }
      },
      "test_bit": {
        "type": "Integer",
        "value": {
          "min": 0,
          "max": 5,
          "scale": 0,
          "step": 1
        }
      },
      "temp_unit_convert": {
        "type": "Enum",
        "value": {
          "range": [
            "c",
            "f"
          ]
        }
      },
      "temp_set_f": {
        "type": "Integer",
        "value": {
          "unit": "\u2109",
          "min": -40,
          "max": 2210,
          "scale": 1,
          "step": 5
        }
      },
      "temp_set": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -200,
          "max": 1050,
          "scale": 1,
          "step": 5
        }
      },
      "temp_current": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -200,
          "max": 1050,
          "scale": 1,
          "step": 1
        }
      },
      "temp_current_f": {
        "type": "Integer",
        "value": {
          "unit": "\u2109",
          "min": -40,
          "max": 2100,
          "scale": 1,
          "step": 1
        }
      },
      "vibration_value": {
        "type": "Integer",
        "value": {
          "min": 10,
          "max": 90,
          "scale": 1,
          "step": 5
        }
      },
      "temp_correction": {
        "type": "Integer",
        "value": {
          "min": -9,
          "max": 9,
          "scale": 0,
          "step": 1
        }
      },
      "humidity_set": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 1,
          "max": 99,
          "scale": 0,
          "step": 1
        }
      },
      "hum_rangle": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 2,
          "max": 20,
          "scale": 0,
          "step": 2
        }
      },
      "humidity_value": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 1,
          "max": 99,
          "scale": 0,
          "step": 1
        }
      },
      "hum_calibration": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": -9,
          "max": 9,
          "scale": 0,
          "step": 1
        }
      },
      "fault": {
        "type": "Bitmap",
        "value": {
          "label": [
            "ov_cr",
            "ov_vol",
            "ov_pwr",
            "ls_cr",
            "ls_vol",
            "ls_pow"
          ]
        }
      },
      "cold_delay": {
        "type": "Integer",
        "value": {
          "unit": "min",
          "min": 0,
          "max": 10,
          "scale": 0,
          "step": 1
        }
      },
      "cold_delay_switch": {
        "type": "Boolean",
        "value": {}
      }
    },

DPs:

{
  "2": true,
  "4": 0,
  "7": "",
  "8": "hot",
  "9": false,
  "10": 119,
  "11": 2980,
  "12": 7140,
  "13": 2336,
  "14": 584,
  "15": 25300,
  "16": 14000,
  "17": 2970,
  "18": 36000,
  "19": 1,
  "20": "c",
  "21": 770,
  "22": 250,
  "27": 272,
  "28": 809,
  "29": 20,
  "30": 0,
  "41": 50,
  "42": 4,
  "46": 61,
  "47": 0,
  "50": 0,
  "55": 2,
  "56": false
}

werdnum avatar Oct 21 '22 03:10 werdnum