tuya-local icon indicating copy to clipboard operation
tuya-local copied to clipboard

Request support for Smatrul SmartPlug 16A Pow

Open preussal opened this issue 1 year ago • 1 comments

Log Message


  "data": {
    "name": "Smartplug Wasserpumpe",
    "type": "smartplugv2_energy",
    "device_id": "**REDACTED**",
    "device_cid": "",
    "local_key": "**REDACTED**",
    "host": "**REDACTED**",
    "protocol_version": 3.5,
    "tinytuya_version": "1.13.2",
    "api_version_set": 3.5,
    "api_version_used": 3.5,
    "api_working": true,
    "status": {},
    "cached_state": {
      "updated_at": 1713796521.2452497,
      "1": true,
      "9": 0,
      "18": 277,
      "19": 848,
      "20": 2112,
      "21": 1,
      "22": 552,
      "23": 28527,
      "24": 15392,
      "25": 2710,
      "26": 0,
      "38": "memory",
      "39": "relay",
      "40": false,
      "41": "",
      "42": "",
      "43": "",
      "51": false
    },
    "pending_state": {},
    "connected": true,
    "force_dps": [],
    "home_assistant": {
      "name": "Smartplug Wasserpumpe",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": "min",
          "state": {
            "entity_id": "number.smartplug_wasserpumpe_timer",
            "state": "0.0",
            "attributes": {
              "min": 0.0,
              "max": 1440.0,
              "step": 1.0,
              "mode": "auto",
              "unit_of_measurement": "min",
              "friendly_name": "Smartplug Wasserpumpe Timer"
            },
            "last_changed": "2024-04-22T14:06:24.275783+00:00",
            "last_reported": "2024-04-22T14:06:42.010096+00:00",
            "last_updated": "2024-04-22T14:06:24.275783+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "outlet",
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.smartplug_wasserpumpe_none",
            "state": "on",
            "attributes": {
              "test_bit": 1,
              "fault_code": 0,
              "cycle_timer": "",
              "random_timer": "",
              "device_class": "outlet",
              "friendly_name": "Smartplug Wasserpumpe None"
            },
            "last_changed": "2024-04-22T14:06:24.276014+00:00",
            "last_reported": "2024-04-22T14:06:42.010220+00:00",
            "last_updated": "2024-04-22T14:06:24.276014+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.smartplug_wasserpumpe_overcharge_cutoff",
            "state": "unknown",
            "attributes": {
              "icon": "mdi:battery-charging",
              "friendly_name": "Smartplug Wasserpumpe Overcharge cutoff"
            },
            "last_changed": "2024-04-22T14:06:24.276134+00:00",
            "last_reported": "2024-04-22T14:06:42.010276+00:00",
            "last_updated": "2024-04-22T14:06:24.276134+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "lock.smartplug_wasserpumpe_child_lock",
            "state": "unlocked",
            "attributes": {
              "friendly_name": "Smartplug Wasserpumpe Child lock",
              "supported_features": 0
            },
            "last_changed": "2024-04-22T14:06:24.276226+00:00",
            "last_reported": "2024-04-22T14:06:42.010333+00:00",
            "last_updated": "2024-04-22T14:06:24.276226+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": "problem",
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "binary_sensor.smartplug_wasserpumpe_problem",
            "state": "off",
            "attributes": {
              "device_class": "problem",
              "friendly_name": "Smartplug Wasserpumpe Problem"
            },
            "last_changed": "2024-04-22T14:06:24.276327+00:00",
            "last_reported": "2024-04-22T14:06:42.010400+00:00",
            "last_updated": "2024-04-22T14:06:24.276327+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.smartplug_wasserpumpe_initial_state",
            "state": "Last State",
            "attributes": {
              "options": [
                "On",
                "Off",
                "Last State"
              ],
              "icon": "mdi:toggle-switch",
              "friendly_name": "Smartplug Wasserpumpe Initial state"
            },
            "last_changed": "2024-04-22T14:06:24.276430+00:00",
            "last_reported": "2024-04-22T14:06:42.010473+00:00",
            "last_updated": "2024-04-22T14:06:24.276430+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.smartplug_wasserpumpe_light",
            "state": "State",
            "attributes": {
              "options": [
                "State",
                "Position",
                "Off",
                "On"
              ],
              "icon": "mdi:circle-double",
              "friendly_name": "Smartplug Wasserpumpe Light"
            },
            "last_changed": "2024-04-22T14:06:24.276516+00:00",
            "last_reported": "2024-04-22T14:06:42.010526+00:00",
            "last_updated": "2024-04-22T14:06:24.276516+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": "Wh",
          "state": {
            "entity_id": "sensor.smartplug_wasserpumpe_energy",
            "state": "unknown",
            "attributes": {
              "calibration": 2710,
              "unit_of_measurement": "Wh",
              "friendly_name": "Smartplug Wasserpumpe Energy"
            },
            "last_changed": "2024-04-22T14:06:24.276617+00:00",
            "last_reported": "2024-04-22T14:06:42.010594+00:00",
            "last_updated": "2024-04-22T14:06:24.276617+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": "current",
          "icon": null,
          "unit_of_measurement": "mA",
          "state": {
            "entity_id": "sensor.smartplug_wasserpumpe_stromstarke",
            "state": "277",
            "attributes": {
              "state_class": "measurement",
              "calibration": 28527,
              "unit_of_measurement": "mA",
              "device_class": "current",
              "friendly_name": "Smartplug Wasserpumpe Stromst\u00e4rke"
            },
            "last_changed": "2024-04-22T14:35:20.247892+00:00",
            "last_reported": "2024-04-22T14:35:21.246053+00:00",
            "last_updated": "2024-04-22T14:35:20.247892+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": "power",
          "icon": null,
          "unit_of_measurement": "W",
          "state": {
            "entity_id": "sensor.smartplug_wasserpumpe_leistung",
            "state": "84.8",
            "attributes": {
              "state_class": "measurement",
              "calibration": 15392,
              "unit_of_measurement": "W",
              "device_class": "power",
              "friendly_name": "Smartplug Wasserpumpe Leistung"
            },
            "last_changed": "2024-04-22T14:35:20.248093+00:00",
            "last_reported": "2024-04-22T14:35:21.246136+00:00",
            "last_updated": "2024-04-22T14:35:20.248093+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": "voltage",
          "icon": null,
          "unit_of_measurement": "V",
          "state": {
            "entity_id": "sensor.smartplug_wasserpumpe_spannung",
            "state": "211.2",
            "attributes": {
              "state_class": "measurement",
              "calibration": 552,
              "unit_of_measurement": "V",
              "device_class": "voltage",
              "friendly_name": "Smartplug Wasserpumpe Spannung"
            },
            "last_changed": "2024-04-22T14:35:13.254630+00:00",
            "last_reported": "2024-04-22T14:35:14.253797+00:00",
            "last_updated": "2024-04-22T14:35:13.254630+00:00"
          }
        }
      ]
    }

Information about DPS mappings

{
  "result": {
    "category": "cz",
    "functions": [
      {
        "code": "switch_1",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "Switch 1",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "countdown_1",
        "lang_config": {
          "unit": "s"
        },
        "name": "Countdown 1",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "relay_status",
        "lang_config": {
          "last": "Remember last status",
          "power_off": "OFF",
          "power_on": "ON"
        },
        "name": "Relay Status",
        "type": "Enum",
        "values": "{\"range\":[\"power_off\",\"power_on\",\"last\"]}"
      },
      {
        "code": "light_mode",
        "lang_config": {
          "none": "Indicate LED off",
          "pos": "Indicate switch location",
          "relay": "Indicate switch on/off"
        },
        "name": "Light Mode",
        "type": "Enum",
        "values": "{\"range\":[\"relay\",\"pos\",\"none\"]}"
      },
      {
        "code": "child_lock",
        "lang_config": {
          "false": "off",
          "true": "on"
        },
        "name": "Child Lock",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "cycle_time",
        "lang_config": {
          "unit": "s"
        },
        "name": "Cycle Time",
        "type": "String",
        "values": "{}"
      },
      {
        "code": "random_time",
        "lang_config": {
          "unit": "s"
        },
        "name": "Random Time",
        "type": "String",
        "values": "{}"
      },
      {
        "code": "switch_inching",
        "lang_config": {
          "unit": ""
        },
        "name": "Inching Switch",
        "type": "String",
        "values": "{}"
      },
      {
        "code": "overcharge_switch",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "Overcharge Switch",
        "type": "Boolean",
        "values": "{}"
      }
    ],
    "status": [
      {
        "code": "switch_1",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "Switch 1",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "countdown_1",
        "lang_config": {
          "unit": "s"
        },
        "name": "Countdown 1",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "add_ele",
        "lang_config": {
          "unit": "W"
        },
        "name": "Add Electricity",
        "type": "Integer",
        "values": "{\"unit\":\"kwh\",\"min\":0,\"max\":50000,\"scale\":3,\"step\":100}"
      },
      {
        "code": "cur_current",
        "lang_config": {
          "unit": "mA"
        },
        "name": "Current",
        "type": "Integer",
        "values": "{\"unit\":\"mA\",\"min\":0,\"max\":80000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "cur_power",
        "lang_config": {
          "unit": "W"
        },
        "name": "Power",
        "type": "Integer",
        "values": "{\"unit\":\"W\",\"min\":0,\"max\":200000,\"scale\":1,\"step\":1}"
      },
      {
        "code": "cur_voltage",
        "lang_config": {
          "unit": "V"
        },
        "name": "Voltage",
        "type": "Integer",
        "values": "{\"unit\":\"V\",\"min\":0,\"max\":5000,\"scale\":1,\"step\":1}"
      },
      {
        "code": "relay_status",
        "lang_config": {
          "last": "Remember last status",
          "power_off": "OFF",
          "power_on": "ON"
        },
        "name": "Relay Status",
        "type": "Enum",
        "values": "{\"range\":[\"power_off\",\"power_on\",\"last\"]}"
      },
      {
        "code": "light_mode",
        "lang_config": {
          "none": "Indicate LED off",
          "pos": "Indicate switch location",
          "relay": "Indicate switch on/off"
        },
        "name": "Light Mode",
        "type": "Enum",
        "values": "{\"range\":[\"relay\",\"pos\",\"none\"]}"
      },
      {
        "code": "child_lock",
        "lang_config": {
          "false": "off",
          "true": "on"
        },
        "name": "Child Lock",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "cycle_time",
        "lang_config": {
          "unit": "s"
        },
        "name": "Cycle Time",
        "type": "String",
        "values": "{}"
      },
      {
        "code": "random_time",
        "lang_config": {
          "unit": "s"
        },
        "name": "Random Time",
        "type": "String",
        "values": "{}"
      },
      {
        "code": "switch_inching",
        "lang_config": {
          "unit": ""
        },
        "name": "Inching Switch",
        "type": "String",
        "values": "{}"
      },
      {
        "code": "overcharge_switch",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "Overcharge Switch",
        "type": "Boolean",
        "values": "{}"
      }
    ]
  },
  "success": true,
  "t": 1713795777141,
  "tid": "d08e40b600b311efad6aba50e5db0ba5"
}

Product ID

{
  "result": {
    "active_time": 1713691967,
    "category": "cz",
    "category_name": "Socket",
    "create_time": 1713691967,
    "gateway_id": "",
    "icon": "smart/icon/ay15107356719526e3ps/f1d0c8ad0822636028bd9117522687db.png",
    "id": "ebfb34bb2a76a85de3rueo",
    "ip": 
    "lat": 
    "local_key": 
    "lon": "103.0200",
    "model": "百视盾计量",
    "name": "SmartPlug",
    "online": false,
    "owner_id": "168922186",
    "product_id": "uqehhcrmk5depvtl",
    "product_name": "Smart Plug",
    "sub": false,
    "time_zone": "+07:00",
    "update_time": 1713784963,
    "uuid": "5a382c9916814a6a"
  },
  "success": true,
  "t": 1713795905812,
  "tid": "1d4faae500b411ef90a11a02def2ce40"
}

Information about how the device functions

Basically, this is a smart Plug for Thailand, and the Template "smartplugv2_energy" works in Local Mode. Firewall blog outgoing Traffic But i have problems to get the Energy Data kWh. This works only if the SmartPlug is connectet to the Cloud. grafik

SMATRUL 20A/16A Tuya/Smart life WiFi Socket, Universal US EU Smart Plug, Adapter Power Monitor European plug Wireless Remote Voice Timer for Google Home/Alexa/Tmall Genie https://www.lazada.co.th/products/smatrul-20a16a-tuyasmart-life-wifi-socket-universal-us-eu-smart-plug-adapter-power-monitor-european-plug-wireless-remote-voice-timer-for-google-homealexatmall-genie-i2911432612-s10659100650.html?

preussal avatar Apr 22 '24 14:04 preussal

This is normal for Tuya smartplugs. Use the power sensor with an integration helper to get more reliable energy usage.

make-all avatar Apr 22 '24 22:04 make-all