{
  "schema": "devcap1.schema.json",
  "manufacturername": "OWON",
  "modelid": "AC201",
  "product": "AC201",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/ac201.json",
  "subdevices": [
    {
      "type": "$TYPE_THERMOSTAT",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0201"
      ],
      "meta": {
        "values": {
          "config/fanmode": {
            "auto": "Auto",
            "high": "High",
            "low": "Low",
            "medium": "Medium",
            "off": "Off",
            "on": "On",
            "smart": "Smart"
          },
          "config/mode": {
            "auto": "Auto",
            "cool": "Cool",
            "dry": "Dry",
            "emergency heating": "Emergency Heating",
            "fan only": "Fan Only",
            "heat": "Heat",
            "off": "Off",
            "precooling": "Precooling",
            "sleep": "Sleep",
            "unknown": "Unknown"
          },
          "config/swingmode": {
            "fully closed": "Fully Closed",
            "fully open": "Fully Open",
            "half open": "Half Open",
            "off": "Off",
            "quarter open": "Quarter Open",
            "three quarters open": "Three Quarters Open"
          }
        }
      },
      "fingerprint": {
        "profile": "0x0104",
        "device": "0xC202",
        "endpoint": "0x01",
        "in": [
          "0x0000",
          "0x0201",
          "0x0202"
        ]
      },
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/coolsetpoint",
          "description": "Target cooling temperature of a thermostat.",
          "read": {
            "at": "0x0011",
            "cl": "0x0201",
            "ep": 0,
            "fn": "zcl:attr"
          },
          "write": {
            "at": "0x0011",
            "cl": "0x0201",
            "dt": "0x29",
            "ep": 0,
            "eval": "Item.val;",
            "fn": "zcl:attr"
          },
          "parse": {
            "at": "0x0011",
            "cl": "0x0201",
            "ep": 0,
            "eval": "Item.val = Attr.val;",
            "fn": "zcl:attr"
          },
          "default": 0
        },
        {
          "name": "config/fanmode",
          "description": "Specifies the current speed of the fan for sensors.",
          "read": {
            "at": "0x0000",
            "cl": "0x0202",
            "ep": 0,
            "fn": "zcl:attr"
          },
          "write": {
            "at": "0x0000",
            "cl": "0x0202",
            "dt": "0x30",
            "ep": 0,
            "eval": "({ 'off': 0, 'low' : 1, 'medium' : 2, 'high' : 3, 'on' : 4, 'auto' : 5, 'smart' : 6 }[Item.val]);",
            "fn": "zcl:attr"
          },
          "parse": {
            "at": "0x0000",
            "cl": "0x0202",
            "ep": 0,
            "eval": "Item.val = Attr.val < 7 ? ({ 0: 'off', 1: 'low', 2: 'medium', 3: 'high', 4: 'on', 5: 'auto', 6: 'smart' }[Attr.val]) : null;",
            "fn": "zcl:attr"
          },
          "default": "auto"
        },
        {
          "name": "config/heatsetpoint",
          "description": "Target temperature of a thermostat.",
          "default": 0
        },
        {
          "name": "config/mode",
          "description": "Mode of the device.",
          "refresh.interval": 84000,
          "read": {
            "at": "0x001c",
            "cl": "0x0201",
            "ep": 0,
            "fn": "zcl:attr"
          },
          "write": {
            "at": "0x001c",
            "cl": "0x0201",
            "dt": "0x30",
            "ep": 0,
            "eval": "({ 'off': 0, 'auto' : 1, 'unknown' : 2, 'cool' : 3, 'heat' : 4, 'emergency heating' : 5, 'precooling' : 6, 'fan only' : 7, 'dry' : 8, 'sleep' : 9 }[Item.val]);",
            "fn": "zcl:attr"
          },
          "parse": {
            "at": "0x001c",
            "cl": "0x0201",
            "ep": 0,
            "eval": "Item.val = Attr.val < 10 ? ({ 0: 'off', 1: 'auto', 2: 'unknown', 3: 'cool', 4: 'heat', 5: 'emergency heating', 6: 'precooling', 7: 'fan only', 8: 'dry', 9: 'sleep' }[Attr.val]) : null;",
            "fn": "zcl:attr"
          },
          "default": "auto"
        },
        {
          "name": "config/offset",
          "description": "Relative offset to the main measured value.",
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/pulseconfiguration",
          "description": "Pulse Configuration represents the IR emitter code pulses configuration.",
          "refresh.interval": 86400,
          "read": {
            "cl": "0xffac",
            "cmd": "0x00",
            "ep": 1,
            "eval": "''",
            "fc": 5,
            "fn": "zcl:cmd",
            "mf": "0x113c"
          },
          "write": {
            "cl": "0xffac",
            "ep": 1,
            "cmd": "0x20",
            "eval": "((Item.val & 0x00ff) >> 0).toString(16).padStart(2, '0') + ((Item.val & 0xff00) >> 8).toString(16).padStart(2, '0')",
            "fn": "zcl:cmd",
            "mf": "0x113c"
          },
          "parse": {
            "cl": "0xffac",
            "cmd": "0x00",
            "ep": 1,
            "eval": "Item.val = (ZclFrame.at(1) << 8 | ZclFrame.at(0))",
            "fn": "zcl:cmd",
            "mf": "0x113c"
          },
          "default": 0
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "config/swingmode",
          "description": "Indicates the position of Louver on the AC.",
          "read": {
            "at": "0x0045",
            "cl": "0x0201",
            "ep": 0,
            "fn": "zcl:attr"
          },
          "write": {
            "at": "0x0045",
            "cl": "0x0201",
            "dt": "0x30",
            "ep": 0,
            "eval": "({ 'off': 0, 'fully closed' : 1, 'fully open' : 2, 'quarter open' : 3, 'half open' : 4, 'three quarters open' : 5 }[Item.val]);",
            "fn": "zcl:attr"
          },
          "parse": {
            "at": "0x0045",
            "cl": "0x0201",
            "ep": 0,
            "eval": "Item.val = Attr.val < 6 ? ({ 0: 'off', 1: 'fully closed', 2: 'fully open', 3: 'quarter open', 4: 'half open', 5: 'three quarters open' }[Attr.val]) : null;",
            "fn": "zcl:attr"
          },
          "default": "off"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/on",
          "description": "True when device is on; false when off.",
          "refresh.interval": 5
        },
        {
          "name": "state/temperature",
          "description": "The current temperature in °C &times; 100.",
          "default": 0
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0201",
      "report": [
        {
          "at": "0x0000",
          "dt": "0x29",
          "min": 1,
          "max": 600,
          "change": "0x00000032"
        }
      ]
    }
  ]
}
