Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.79k stars 1.64k forks source link

[New device support]: unsupported device manufacturer with Zigbee model 'TS0601' and manufacturer name '_TZE200_bvu2wnxz' - Avatto MW167 #15009

Closed mikeg-de closed 1 year ago

mikeg-de commented 1 year ago

Link

https://de.aliexpress.com/item/1005004696707285.html?spm=a2g0o.order_list.0.0.6aaf5c5flG1pw9&gatewayAdapt=glo2deu

https://zigbee.blakadder.com/Avatto_TRV06.html

Database entry

{
  "id": 2,
  "type": "EndDevice",
  "ieeeAddr": "0x84ba20fffe9a617a",
  "nwkAddr": 53443,
  "manufId": 4098,
  "manufName": "_TZE200_bvu2wnxz",
  "powerSource": "Battery",
  "modelId": "TS0601",
  "epList": [
    1
  ],
  "endpoints": {
    "1": {
      "profId": 260,
      "epId": 1,
      "devId": 81,
      "inClusterList": [
        0,
        4,
        5,
        61184
      ],
      "outClusterList": [
        25,
        10
      ],
      "clusters": {
        "genBasic": {
          "attributes": {
            "65503": "L�\u0006+iV�\u0006+ia�\u0006+ik�\u0006+iu�\u0006+i��\u0006+i��\u0006+iS�\u0006+i",
            "65506": 31,
            "65508": 0,
            "modelId": "TS0601",
            "manufacturerName": "_TZE200_bvu2wnxz",
            "powerSource": 3,
            "zclVersion": 3,
            "appVersion": 65,
            "stackVersion": 0,
            "hwVersion": 1,
            "dateCode": ""
          }
        }
      },
      "binds": [],
      "configuredReportings": [],
      "meta": {}
    }
  },
  "appVersion": 65,
  "stackVersion": 0,
  "hwVersion": 1,
  "dateCode": "",
  "zclVersion": 3,
  "interviewCompleted": true,
  "meta": {},
  "lastSeen": 1668545364476,
  "defaultSendRequestWhen": "immediate"
}

Comments

Pairing did work but getting an unsupported manufacturer error message.

External converter

Checked https://github.com/Koenkk/zigbee2mqtt/discussions/14320 but that dies not work.

Found https://github.com/twhittock/avatto_me167 which happened to be the same manufacturer and model but seems to not work properly as I get errors like No converter available for 'local_temperature' ("")

Tried creating an external converter myself but failed miserably

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require("zigbee-herdsman-converters/lib/tuya");

const definition = {
    // Since a lot of Tuya devices use the same modelID, but use different data points
    // it's usually necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE200_bvu2wnxz'
        },
    ],
    model: 'TS0601-Zigbee',
    vendor: 'Avatto',
    description: 'Thermostat radiator valve',
    fromZigbee: [
        fz.ignore_basic_report, // Add this if you are getting no converter for 'genBasic'
        fz.tuya_data_point_dump, // This is a debug converter, it will be described in the next part
        fz.tuya_thermostat, // manuSpecificTuya
    ],
    toZigbee: [
        tz.tuya_data_point_test, // Another debug converter
    ],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [
        // Here you should put all functionality that your device exposes
        e.battery(), e.temperature()
    ],
};

module.exports = definition;

Debug log to attempt to generate the converter myself but can't figure out how to create the converter myself.

debug 2022-11-16 15:57:03Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,190],"type":"Buffer"},"datatype":2,"dp":5}],"seq":51712}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:03zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,190]}}': type='commandDataReport', datatype='value', value='190', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:57:06Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,190],"type":"Buffer"},"datatype":2,"dp":5}],"seq":51968}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:06zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,190]}}': type='commandDataReport', datatype='value', value='190', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:57:09Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,190],"type":"Buffer"},"datatype":2,"dp":5}],"seq":52224}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:09zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,190]}}': type='commandDataReport', datatype='value', value='190', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:57:12Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,190],"type":"Buffer"},"datatype":2,"dp":5}],"seq":52480}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:12zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,190]}}': type='commandDataReport', datatype='value', value='190', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:57:15Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,180],"type":"Buffer"},"datatype":2,"dp":5}],"seq":52736}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:15zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,180]}}': type='commandDataReport', datatype='value', value='180', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:57:15Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,200],"type":"Buffer"},"datatype":2,"dp":4}],"seq":52992}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:15zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #4 from 0x84ba20fffe9a617a with raw data '{"dp":4,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,200]}}': type='commandDataReport', datatype='value', value='200', known DP# usage: ["mode","moesSboostHeating","silvercrestSetColorTemp","haozeeBoostHeating","nousBattery","tthBattery","wlsBatteryPercentage","evanellHeatingSetpoint","AM02Mode","tshpsMaximumRange","lmsBattery"]
debug 2022-11-16 15:57:21Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[1],"type":"Buffer"},"datatype":4,"dp":3}],"seq":53248}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:21zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #3 from 0x84ba20fffe9a617a with raw data '{"dp":3,"datatype":4,"data":{"type":"Buffer","data":[1]}}': type='commandDataReport', datatype='enum', value='1', known DP# usage: ["dimmerLevel","dimmerMinLevel","localTemp","coverArrived","occupancy","moesScheduleEnable","moesSlocalTemp","moesCoverCalibration","saswellHeating","silvercrestSetBrightness","haozeeLocalTemp","tthBatteryLevel","thitBatteryPercentage","AM02PercentState","garageDoorContact","x5hWorkingStatus","tshpsMinimumRange"]
debug 2022-11-16 15:57:21Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,170],"type":"Buffer"},"datatype":2,"dp":4}],"seq":53504}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:21zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #4 from 0x84ba20fffe9a617a with raw data '{"dp":4,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,170]}}': type='commandDataReport', datatype='value', value='170', known DP# usage: ["mode","moesSboostHeating","silvercrestSetColorTemp","haozeeBoostHeating","nousBattery","tthBattery","wlsBatteryPercentage","evanellHeatingSetpoint","AM02Mode","tshpsMaximumRange","lmsBattery"]
debug 2022-11-16 15:57:30Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,190],"type":"Buffer"},"datatype":2,"dp":5}],"seq":53760}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:30zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,190]}}': type='commandDataReport', datatype='value', value='190', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:57:56Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0],"type":"Buffer"},"datatype":4,"dp":3}],"seq":54016}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:56zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #3 from 0x84ba20fffe9a617a with raw data '{"dp":3,"datatype":4,"data":{"type":"Buffer","data":[0]}}': type='commandDataReport', datatype='enum', value='0', known DP# usage: ["dimmerLevel","dimmerMinLevel","localTemp","coverArrived","occupancy","moesScheduleEnable","moesSlocalTemp","moesCoverCalibration","saswellHeating","silvercrestSetBrightness","haozeeLocalTemp","tthBatteryLevel","thitBatteryPercentage","AM02PercentState","garageDoorContact","x5hWorkingStatus","tshpsMinimumRange"]
debug 2022-11-16 15:57:56Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,180],"type":"Buffer"},"datatype":2,"dp":5}],"seq":54272}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:56zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,180]}}': type='commandDataReport', datatype='value', value='180', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:57:56Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,220],"type":"Buffer"},"datatype":2,"dp":4}],"seq":54528}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:56zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #4 from 0x84ba20fffe9a617a with raw data '{"dp":4,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,220]}}': type='commandDataReport', datatype='value', value='220', known DP# usage: ["mode","moesSboostHeating","silvercrestSetColorTemp","haozeeBoostHeating","nousBattery","tthBattery","wlsBatteryPercentage","evanellHeatingSetpoint","AM02Mode","tshpsMaximumRange","lmsBattery"]
debug 2022-11-16 15:57:59Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,180],"type":"Buffer"},"datatype":2,"dp":5}],"seq":54784}' from endpoint 1 with groupID 0
info 2022-11-16 15:57:59zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,180]}}': type='commandDataReport', datatype='value', value='180', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:58:02Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,180],"type":"Buffer"},"datatype":2,"dp":5}],"seq":55040}' from endpoint 1 with groupID 0
info 2022-11-16 15:58:02zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,180]}}': type='commandDataReport', datatype='value', value='180', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]
debug 2022-11-16 15:58:05Received Zigbee message from 'Büro Heizung', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,190],"type":"Buffer"},"datatype":2,"dp":5}],"seq":55296}' from endpoint 1 with groupID 0
info 2022-11-16 15:58:05zigbee-herdsman-converters:tuya_data_point_dump: Received Tuya DataPoint #5 from 0x84ba20fffe9a617a with raw data '{"dp":5,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,190]}}': type='commandDataReport', datatype='value', value='190', known DP# usage: ["fanMode","dimmerMaxLevel","motorDirection","config","moesSboostHeatingCountdown","neoAOVolume","silvercrestSetColor","lidlTimer","haozeeBoostHeatingCountdown","evanellLocalTemp","AM02Direction"]

Supported color modes

No response

Color temperature range

No response

mikeg-de commented 1 year ago

Might be duplicate: https://github.com/Koenkk/zigbee2mqtt/issues/12315

@Koenkk Would you agree to close this in favor of 12315?

mikeg-de commented 1 year ago

Works, to the greater extend, with the external converted from https://github.com/twhittock/avatto_me167

Some exchange is happening in https://github.com/Koenkk/zigbee2mqtt/issues/12315 which is already closed. Hence, keeping this open.

Battery is said to have no readout but got a blinking battery icon in the device pane after inserting an 1.2 V instead of 1.5 V battery when using 'e.battery()'.

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require("zigbee-herdsman-converters/lib/tuya");

const tuyaLocal = {
  dataPoints: {
    me167Mode: 2,
    me167HeatingSetpoint: 4,
    me167LocalTemp: 5,
    me167ChildLock: 7,
    me167Heating: 3,
    me167Schedule1: 28,
    me167Schedule2: 29,
    me167Schedule3: 30,
    me167Schedule4: 31,
    me167Schedule5: 32,
    me167Schedule6: 33,
    me167Schedule7: 34,
    me167ErrorCode: 35,
    me167FrostGuard: 36,
    me167AntiScaling: 39,
    me167TempCalibration: 47,
  },
};

const fzLocal = {
  me167_thermostat: {
    cluster: 'manuSpecificTuya',
    type: ['commandDataResponse', 'commandDataReport'],
    convert: (model, msg, publish, options, meta) => {
        const result = {};

        function weeklySchedule(day, value) {
          // byte 0 - Day of Week (0~7 = Wed ~ Tue) ???
          // byte 1 - hour ???
          // byte 2 - minute ???
          // byte 3 - Temp (temp = value )
          // byte 4 - Temperature (temp = value / 10)

          const weekDays=[ 'wed', 'thu', 'fri', 'sat', 'sun','mon', 'tue'];
          // we get supplied in value only a weekday schedule, so we must add it to
          // the weekly schedule from meta.state, if it exists
          const weeklySchedule= meta.state.hasOwnProperty('weekly_schedule') ? meta.state.weekly_schedule : {};
          meta.logger.info(JSON.stringify({'received day': day, 'received values': value}));
          let daySchedule = []; // result array
          for (let i=1; i<16 && value[i]; ++i) {
            const aHour=value[i];
            ++i;
            const aMinute=value[i];
            ++i;
            const aTemp2=value[i];
            ++i;
            const aTemp=value[i];
            daySchedule=[...daySchedule, {
              temperature: Math.floor((aTemp+aTemp2*256)/10),
              hour: aHour,
              minute: aMinute,
            }];
          }
          meta.logger.info(JSON.stringify({'returned weekly schedule: ': daySchedule}));
          return {'weekly-schedule': {...weeklySchedule, [weekDays[day]]: daySchedule}};
        }

        for (const dpValue of msg.data.dpValues) {
            const value = tuya.getDataValue(dpValue);

            switch (dpValue.dp) {
            case tuyaLocal.dataPoints.me167ChildLock:
                result.child_lock = value ? 'LOCK' : 'UNLOCK';
                break;
            case tuyaLocal.dataPoints.me167HeatingSetpoint:
                result.current_heating_setpoint = value/10;
                break;
            case tuyaLocal.dataPoints.me167LocalTemp:
                result.local_temperature = value/10;
                break;
            case tuyaLocal.dataPoints.me167Heating:
                switch(value) {
                  case 0:
                    result.running_state = "heat"; // valve open
                    break;
                  case 1:
                    result.running_state = "idle"; // valve closed
                    break;
                  default:
                    meta.logger.warn('zigbee-herdsman-converters:me167_thermostat: ' +
                      `Running state ${value} is not recognized.`);
                    break;
                }
                break;
            case tuyaLocal.dataPoints.me167Mode:
                switch (value) {
                case 0: // auto
                    result.system_mode = 'auto';
                    break;
                case 1: // manu
                    result.system_mode = 'heat';
                    break;
                case 2: // off
                    result.system_mode = 'off';
                    break;
                default:
                    meta.logger.warn('zigbee-herdsman-converters:me167_thermostat: ' +
                      `Mode ${value} is not recognized.`);
                    break;
                }
                break;
            case tuyaLocal.dataPoints.me167Schedule1:
              weeklySchedule(0,value);
              break;
            case tuyaLocal.dataPoints.me167Schedule2:
              weeklySchedule(1,value);
              break;
            case tuyaLocal.dataPoints.me167Schedule3:
              weeklySchedule(2,value);
              break;
            case tuyaLocal.dataPoints.me167Schedule4:
              weeklySchedule(3,value);
              break;
            case tuyaLocal.dataPoints.me167Schedule5:
              weeklySchedule(4,value);
              break;
            case tuyaLocal.dataPoints.me167Schedule6:
              weeklySchedule(5,value);
              break;
            case tuyaLocal.dataPoints.me167Schedule7:
              weeklySchedule(6,value);
              break;
            case tuyaLocal.dataPoints.me167TempCalibration:
              if (value >= 4294967295 ){
                result.local_temperature_calibration = (value-4294967295)-1 // negative values
              }else{
                result.local_temperature_calibration = value
              }
              break;
            case tuyaLocal.dataPoints.me167ErrorCode:
                switch (value) {
                  case 0: // OK
                      result.battery_low = false;
                      meta.logger.info(`zigbee-herdsman-converters:me167_thermostat: BattOK - Error Code: ` +
                    `${JSON.stringify(dpValue)}`);
                      break;
                  case 1: // Empty Battery
                      result.battery_low = true;
                      meta.logger.info(`zigbee-herdsman-converters:me167_thermostat: BattEmtpy - Error Code: ` +
                    `${JSON.stringify(dpValue)}`);
                      break;
                  default:
                      meta.logger.warn(`zigbee-herdsman-converters:me167_thermostat: Error Code not recognized: ` +
                    `${JSON.stringify(dpValue)}`);
                      break;
                  }
                break; 
            case tuyaLocal.dataPoints.me167FrostGuard:
              result.frost_guard = value ? 'ON' : 'OFF';
              break;
            case tuyaLocal.dataPoints.me167AntiScaling:
              result.anti_scaling = value ? 'ON' : 'OFF';
              break;

            default:
                meta.logger.warn(`zigbee-herdsman-converters:me167_thermostat: NOT RECOGNIZED ` +
                  `DP #${dpValue.dp} with data ${JSON.stringify(dpValue)}`);
            }
        }
        return result;
    },
  },
};

const tzLocal = {
  me167_thermostat_current_heating_setpoint: {
      key: ['current_heating_setpoint'],
      convertSet: async (entity, key, value, meta) => {
          const temp = Math.round(value * 10);
          await tuya.sendDataPointValue(entity, tuyaLocal.dataPoints.me167HeatingSetpoint, temp);
      },
  },
  me167_thermostat_system_mode: {
      key: ['system_mode'],
      convertSet: async (entity, key, value, meta) => {
          switch (value) {
          case 'off':
              await tuya.sendDataPointEnum(entity, tuyaLocal.dataPoints.me167Mode, 2 /* off */);
              break;
          case 'heat':
              await tuya.sendDataPointEnum(entity, tuyaLocal.dataPoints.me167Mode, 1 /* manual */);
              break;
          case 'auto':
              await tuya.sendDataPointEnum(entity, tuyaLocal.dataPoints.me167Mode, 0 /* auto */);
              break;
          }
      },
  },
  me167_thermostat_child_lock: {
      key: ['child_lock'],
      convertSet: async (entity, key, value, meta) => {
          await tuya.sendDataPointBool(entity, tuyaLocal.dataPoints.me167ChildLock, value === 'LOCK');
      },
    },

  me167_thermostat_schedule: {
    key: ['weekly_schedule'],
    convertSet: async (entity, key, value, meta) => {
      const weekDays=['wed', 'thu', 'fri', 'sat', 'sun', 'mon' , 'tue'];
      // we overwirte only the received days. The other ones keep stored on the device
      const keys = Object.keys(value);
      for (const dayName of keys) { // for loop in order to delete the empty day schedules
        const output= []; // empty output byte buffer
        const dayNo=weekDays.indexOf(dayName);
        output[0]=dayNo+1;
        const schedule=value[dayName];
        schedule.forEach((el, Index) => {
          if (Index <4) {
            output[1+4*Index]=el.hour;
            output[2+4*Index]=el.minute;
            output[3+4*Index]=Math.floor((el.temperature*10)/256);
            output[4+4*Index]=(el.temperature*10)%256;
          } else {
            meta.logger.warn('more than 4 schedule points supplied for week-day '+dayName +
            ' additional schedule points will be ignored');
          }
        });
        meta.logger.info(`zigbee-herdsman-converters:me167_thermostat: Writing Schedule to ` +
                  `DP #${tuyaLocal.dataPoints.me167Schedule1+dayNo} with data ${JSON.stringify(output)}`);
        await tuya.sendDataPointRaw(entity, tuyaLocal.dataPoints.me167Schedule1+dayNo, output);
        await new Promise((r) => setTimeout(r, 2000));
        // wait 2 seconds between schedule sends in order not to overload the device
      }
    },
  },
  me167_thermostat_calibration: {
    key: ['local_temperature_calibration'],
    convertSet: async (entity, key, value, meta) => {
      if (value >= 0) value = value;
      if (value < 0) value = value+4294967295+1;
      await tuya.sendDataPointValue(entity, tuyaLocal.dataPoints.me167TempCalibration, value);
    },
  },
  me167_thermostat_anti_scaling: {
    key: ['anti_scaling'],
    convertSet: async (entity, key, value, meta) => {
      await tuya.sendDataPointBool(entity, tuyaLocal.dataPoints.me167AntiScaling, value === 'ON');
    },
  },
  me167_thermostat_frost_guard: {
    key: ['frost_guard'],
    convertSet: async (entity, key, value, meta) => {
      await tuya.sendDataPointBool(entity, tuyaLocal.dataPoints.me167FrostGuard, value === 'ON');
    },
  },
};

const definition = {
    // Since a lot of Tuya devices use the same modelID, but use different data points
    // it's usually necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE200_bvu2wnxz'
        },
    ],
    model: 'ME167',
    vendor: 'Avatto',
    description: 'Thermostatic radiator valve',
    fromZigbee: [
        fz.ignore_basic_report, // Add this if you are getting no converter for 'genBasic'
        //fz.tuya_data_point_dump, // This is a debug converter, it will be described in the next part
        fzLocal.me167_thermostat,
    ],
    toZigbee: [
        //tz.tuya_data_point_test, // Another debug converter
        tzLocal.me167_thermostat_child_lock,
        tzLocal.me167_thermostat_current_heating_setpoint,
        tzLocal.me167_thermostat_system_mode,
        tzLocal.me167_thermostat_schedule,
        tzLocal.me167_thermostat_calibration,
        tzLocal.me167_thermostat_anti_scaling,
        tzLocal.me167_thermostat_frost_guard,
    ],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [
      e.child_lock(),
      exposes.switch().withState('anti_scaling', true).withDescription('Anti Scaling feature is ON or OFF'),
      exposes.switch().withState('frost_guard', true).withDescription('Frost Protection feature is ON or OFF'),
      exposes.climate().withSetpoint('current_heating_setpoint', 5, 35, 1)
                     .withLocalTemperature()
                     .withSystemMode(['auto','heat','off'])
                     .withRunningState(['idle', 'heat'], ea.STATE)
                     .withLocalTemperatureCalibration(-10, 10, 1, ea.STATE_SET)
    ],
};

module.exports = definition;
petos commented 1 year ago

Thanks for work. I am implemented, however getting errors on "Get":

Debug 2022-11-18 19:29:27Received MQTT message on 'zigbee2mqtt/Termohlavice: Obyvak L/get' with data '{"anti_scaling":""}'
Error 2022-11-18 19:29:27No converter available for 'get' 'anti_scaling' ()

For any of refresh attempt. Is that my device -- I see empty answer...

'{"anti_scaling":""}'

Thx.

mikeg-de commented 1 year ago

The kudos should go to @raketenemo per https://github.com/twhittock/avatto_me167

I don't get any errors and have the debug running since I installed all thermostats. However, I do get a strange behavior as if there is a manufacturer setting overwriting mine.

Commands send via Node-Red seem to take effect only briefly Bildschirm­foto 2022-11-19 um 07 51 38

Manualy overwrite via thermostat seems to be kept Bildschirm­foto 2022-11-19 um 07 57 39

But, settings are only kept for circa 15 to 20 minutes which significantly degrades comfort. Bildschirm­foto 2022-11-19 um 08 04 38

The product page states it is "programmable" so I assume there are some yet to be discovered and thus not exposed settings.

Bildschirm­foto 2022-11-19 um 08 03 44

I tried to retrieve / decipher the raw data points as described in https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html#requirements-and-caveats by registering as described but that tutorial isn't applying anymore and I got stuck.

I will try to follow https://www.zigbee2mqtt.io/advanced/support-new-devices/02_support_new_tuya_devices.html#_3-understanding-tuya-data-points and attempt to reach out to the manufacturer as well asking for UART protocol and DPIDs data formats for their functions.

Update Checking the manual it becomes apparent that there are different operation modes as such "manual" and "programming". The later indicated by the clock icon on the thermostat display. I figure out that, in order to switch on the thermostat to manual mode, you have to press the "rotator" button twice if it sleeps and once if enabled..

ME167 Thermostat Manual.pdf

Checking the debug log I traced this back to "system_mode": "auto" vs. "system_mode": "heat". which is an exposed device setting.

About the error upon "GET". The Thermostat can not be actively called. It only support set.

Thanks for work. I am implemented, however getting errors on "Get":

Debug 2022-11-18 19:29:27Received MQTT message on 'zigbee2mqtt/Termohlavice: Obyvak L/get' with data '{"anti_scaling":""}'
Error 2022-11-18 19:29:27No converter available for 'get' 'anti_scaling' ()

For any of refresh attempt. Is that my device -- I see empty answer...

'{"anti_scaling":""}'

Thx.

GrumpyMeow commented 1 year ago

Indeed clicking on the button to retrieve the state of anti_scaling or frost_guard, will trigger an error. I've been comparing the me167.js file with https://github.com/Koenkk/zigbee-herdsman-converters/blob/4f7734b373921fb5524df33a777a290d1bc77bd4/lib/tuya.js.

I aligned the code by looking at other convertors. I ended up with this:

exposes: [
      e.child_lock(),
      exposes.binary('anti_scaling', ea.STATE_SET, 'ON', 'OFF').withDescription('Anti Scaling feature is ON or OFF'),
      exposes.binary('frost_guard', ea.STATE_SET, 'ON', 'OFF').withDescription('Frost Protection feature is ON or OFF'),
      exposes.climate().withSetpoint('current_heating_setpoint', 5, 35, 0.5, ea.STATE_SET)
                     .withLocalTemperature(ea.STATE)
                     .withSystemMode(['auto','heat','off'], ea.STATE_SET)
                     .withLocalTemperatureCalibration(-10, 10, 1, ea.STATE_SET)
    ],

this will result inL

petos commented 1 year ago

Is there actually merge request opened? This now seems to work for me. If not, I can do that...

mikeg-de commented 1 year ago

So far no PR was made as we are presumably still in discovery phase. The feedback form the manufacturer was not quite constructive as, apparently, he simply wants to sell his stuff (gateway).

Therefore, I dug up the logs to retrieve the date from the "interview" phase when pairing an and device and got this schema:

Raw log info 2022-11-23 11:20:52: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"Thermostatic radiator valve","exposes":[{"features":[{"access":3,"description":"Enables/disables physical input on the device","name":"state","property":"child_lock","type":"binary","value_off":"UNLOCK","value_on":"LOCK"}],"type":"lock"},{"description":"Anti Scaling feature is ON or OFF","features":[{"access":7,"name":"state","property":"anti_scaling","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"description":"Frost Protection feature is ON or OFF","features":[{"access":7,"name":"state","property":"frost_guard","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"features":[{"access":7,"description":"Temperature setpoint","name":"current_heating_setpoint","property":"current_heating_setpoint","type":"numeric","unit":"°C","value_max":35,"value_min":5,"value_step":1},{"access":5,"description":"Current temperature measured on the device","name":"local_temperature","property":"local_temperature","type":"numeric","unit":"°C"},{"access":7,"description":"Mode of this device","name":"system_mode","property":"system_mode","type":"enum","values":["auto","heat","off"]},{"access":1,"description":"The current running state","name":"running_state","property":"running_state","type":"enum","values":["idle","heat"]},{"access":3,"description":"Offset to be used in the local_temperature","name":"local_temperature_calibration","property":"local_temperature_calibration","type":"numeric","unit":"°C","value_max":10,"value_min":-10,"value_step":1}],"type":"climate"},{"access":1,"description":"Link quality (signal strength)","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"ME167","options":[],"supports_ota":false,"vendor":"Avatto"},"friendly_name":"0x84ba20fffe9a6a5e","ieee_address":"0x84ba20fffe9a6a5e","status":"successful","supported":true},"type":"device_interview"}'

Formatted JSON

{
  "data": {
    "definition": {
      "description": "Thermostatic radiator valve",
      "exposes": [
        {
          "features": [
            {
              "access": 3,
              "description": "Enables/disables physical input on the device",
              "name": "state",
              "property": "child_lock",
              "type": "binary",
              "value_off": "UNLOCK",
              "value_on": "LOCK"
            }
          ],
          "type": "lock"
        },
        {
          "description": "Anti Scaling feature is ON or OFF",
          "features": [
            {
              "access": 7,
              "name": "state",
              "property": "anti_scaling",
              "type": "binary",
              "value_off": "OFF",
              "value_on": "ON",
              "value_toggle": "TOGGLE"
            }
          ],
          "type": "switch"
        },
        {
          "description": "Frost Protection feature is ON or OFF",
          "features": [
            {
              "access": 7,
              "name": "state",
              "property": "frost_guard",
              "type": "binary",
              "value_off": "OFF",
              "value_on": "ON",
              "value_toggle": "TOGGLE"
            }
          ],
          "type": "switch"
        },
        {
          "features": [
            {
              "access": 7,
              "description": "Temperature setpoint",
              "name": "current_heating_setpoint",
              "property": "current_heating_setpoint",
              "type": "numeric",
              "unit": "°C",
              "value_max": 35,
              "value_min": 5,
              "value_step": 1
            },
            {
              "access": 5,
              "description": "Current temperature measured on the device",
              "name": "local_temperature",
              "property": "local_temperature",
              "type": "numeric",
              "unit": "°C"
            },
            {
              "access": 7,
              "description": "Mode of this device",
              "name": "system_mode",
              "property": "system_mode",
              "type": "enum",
              "values": [
                "auto",
                "heat",
                "off"
              ]
            },
            {
              "access": 1,
              "description": "The current running state",
              "name": "running_state",
              "property": "running_state",
              "type": "enum",
              "values": [
                "idle",
                "heat"
              ]
            },
            {
              "access": 3,
              "description": "Offset to be used in the local_temperature",
              "name": "local_temperature_calibration",
              "property": "local_temperature_calibration",
              "type": "numeric",
              "unit": "°C",
              "value_max": 10,
              "value_min": -10,
              "value_step": 1
            }
          ],
          "type": "climate"
        },
        {
          "access": 1,
          "description": "Link quality (signal strength)",
          "name": "linkquality",
          "property": "linkquality",
          "type": "numeric",
          "unit": "lqi",
          "value_max": 255,
          "value_min": 0
        }
      ],
      "model": "ME167",
      "options": [],
      "supports_ota": false,
      "vendor": "Avatto"
    },
    "friendly_name": "0x84ba20fffe9a6a5e",
    "ieee_address": "0x84ba20fffe9a6a5e",
    "status": "successful",
    "supported": true
  },
  "type": "device_interview"
}

However, that seems to be incomplete as I also received a preprogrammed weekly schedule for one day Raw

debug 2022-11-23 10:41:05: Received Zigbee message from '0x84ba20fffe97d741', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[1,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200],"type":"Buffer"},"datatype":0,"dp":28}],"seq":8960}' from endpoint 1 with groupID 0
info  2022-11-23 10:41:05: {"received day":0,"received values":{"type":"Buffer","data":[1,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}}
info  2022-11-23 10:41:05: {"returned weekly schedule: ":[{"temperature":12,"hour":6,"minute":0},{"temperature":16,"hour":8,"minute":0},{"temperature":22,"hour":18,"minute":0},{"temperature":20,"hour":20,"minute":0}]}

Formatted

{
  "dpValues": [
    {
      "data": {
        "data": [
          1,
          6,
          0,
          0,
          120,
          8,
          0,
          0,
          160,
          18,
          0,
          0,
          220,
          20,
          0,
          0,
          200
        ],
        "type": "Buffer"
      },
      "datatype": 0,
      "dp": 28
    }
  ],
  "seq": 8960
}

{
  "received day": 0,
  "received values": {
    "type": "Buffer",
    "data": [
      1,
      6,
      0,
      0,
      120,
      8,
      0,
      0,
      160,
      18,
      0,
      0,
      220,
      20,
      0,
      0,
      200
    ]
  }
}
{
  "returned weekly schedule: ": [
    {
      "temperature": 12,
      "hour": 6,
      "minute": 0
    },
    {
      "temperature": 16,
      "hour": 8,
      "minute": 0
    },
    {
      "temperature": 22,
      "hour": 18,
      "minute": 0
    },
    {
      "temperature": 20,
      "hour": 20,
      "minute": 0
    }
  ]
}

Raw data for entire weekly schedule

info  2022-11-23 10:41:05: {"received day":0,"received values":{"type":"Buffer","data":[1,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}}
info  2022-11-23 10:41:05: {"returned weekly schedule: ":[{"temperature":12,"hour":6,"minute":0},{"temperature":16,"hour":8,"minute":0},{"temperature":22,"hour":18,"minute":0},{"temperature":20,"hour":20,"minute":0}]}
info  2022-11-23 10:41:05: MQTT publish: topic 'zigbee2mqtt/0x84ba20fffe97d741', payload '{"anti_scaling":null,"child_lock":"UNLOCK","current_heating_setpoint":5,"device":{"applicationVersion":65,"dateCode":"","friendlyName":"0x84ba20fffe97d741","hardwareVersion":1,"ieeeAddr":"0x84ba20fffe97d741","manufacturerID":4098,"manufacturerName":"_TZE200_bvu2wnxz","model":"ME167","networkAddress":27353,"powerSource":"Battery","stackVersion":0,"type":"EndDevice","zclVersion":3},"frost_guard":null,"last_seen":"2022-11-23T10:41:05+01:00","linkquality":109,"local_temperature":17,"local_temperature_calibration":null,"running_state":"idle","system_mode":"off"}'
debug 2022-11-23 10:41:05: Received Zigbee message from '0x84ba20fffe97d741', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[2,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200],"type":"Buffer"},"datatype":0,"dp":29}],"seq":9216}' from endpoint 1 with groupID 0
info  2022-11-23 10:41:05: {"received day":1,"received values":{"type":"Buffer","data":[2,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}}
info  2022-11-23 10:41:05: {"returned weekly schedule: ":[{"temperature":12,"hour":6,"minute":0},{"temperature":16,"hour":8,"minute":0},{"temperature":22,"hour":18,"minute":0},{"temperature":20,"hour":20,"minute":0}]}
info  2022-11-23 10:41:05: MQTT publish: topic 'zigbee2mqtt/0x84ba20fffe97d741', payload '{"anti_scaling":null,"child_lock":"UNLOCK","current_heating_setpoint":5,"device":{"applicationVersion":65,"dateCode":"","friendlyName":"0x84ba20fffe97d741","hardwareVersion":1,"ieeeAddr":"0x84ba20fffe97d741","manufacturerID":4098,"manufacturerName":"_TZE200_bvu2wnxz","model":"ME167","networkAddress":27353,"powerSource":"Battery","stackVersion":0,"type":"EndDevice","zclVersion":3},"frost_guard":null,"last_seen":"2022-11-23T10:41:05+01:00","linkquality":109,"local_temperature":17,"local_temperature_calibration":null,"running_state":"idle","system_mode":"off"}'
debug 2022-11-23 10:41:05: Received Zigbee message from '0x84ba20fffe97d741', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[3,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200],"type":"Buffer"},"datatype":0,"dp":30}],"seq":9472}' from endpoint 1 with groupID 0
info  2022-11-23 10:41:05: {"received day":2,"received values":{"type":"Buffer","data":[3,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}}
info  2022-11-23 10:41:05: {"returned weekly schedule: ":[{"temperature":12,"hour":6,"minute":0},{"temperature":16,"hour":8,"minute":0},{"temperature":22,"hour":18,"minute":0},{"temperature":20,"hour":20,"minute":0}]}
info  2022-11-23 10:41:05: MQTT publish: topic 'zigbee2mqtt/0x84ba20fffe97d741', payload '{"anti_scaling":null,"child_lock":"UNLOCK","current_heating_setpoint":5,"device":{"applicationVersion":65,"dateCode":"","friendlyName":"0x84ba20fffe97d741","hardwareVersion":1,"ieeeAddr":"0x84ba20fffe97d741","manufacturerID":4098,"manufacturerName":"_TZE200_bvu2wnxz","model":"ME167","networkAddress":27353,"powerSource":"Battery","stackVersion":0,"type":"EndDevice","zclVersion":3},"frost_guard":null,"last_seen":"2022-11-23T10:41:05+01:00","linkquality":109,"local_temperature":17,"local_temperature_calibration":null,"running_state":"idle","system_mode":"off"}'
debug 2022-11-23 10:41:06: Received Zigbee message from '0x84ba20fffe97d741', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[4,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200],"type":"Buffer"},"datatype":0,"dp":31}],"seq":9728}' from endpoint 1 with groupID 0
info  2022-11-23 10:41:06: {"received day":3,"received values":{"type":"Buffer","data":[4,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}}
info  2022-11-23 10:41:06: {"returned weekly schedule: ":[{"temperature":12,"hour":6,"minute":0},{"temperature":16,"hour":8,"minute":0},{"temperature":22,"hour":18,"minute":0},{"temperature":20,"hour":20,"minute":0}]}
info  2022-11-23 10:41:06: MQTT publish: topic 'zigbee2mqtt/0x84ba20fffe97d741', payload '{"anti_scaling":null,"child_lock":"UNLOCK","current_heating_setpoint":5,"device":{"applicationVersion":65,"dateCode":"","friendlyName":"0x84ba20fffe97d741","hardwareVersion":1,"ieeeAddr":"0x84ba20fffe97d741","manufacturerID":4098,"manufacturerName":"_TZE200_bvu2wnxz","model":"ME167","networkAddress":27353,"powerSource":"Battery","stackVersion":0,"type":"EndDevice","zclVersion":3},"frost_guard":null,"last_seen":"2022-11-23T10:41:06+01:00","linkquality":109,"local_temperature":17,"local_temperature_calibration":null,"running_state":"idle","system_mode":"off"}'
debug 2022-11-23 10:41:06: Received Zigbee message from '0x84ba20fffe97d741', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[5,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200],"type":"Buffer"},"datatype":0,"dp":32}],"seq":9984}' from endpoint 1 with groupID 0
info  2022-11-23 10:41:06: {"received day":4,"received values":{"type":"Buffer","data":[5,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}}
info  2022-11-23 10:41:06: {"returned weekly schedule: ":[{"temperature":12,"hour":6,"minute":0},{"temperature":16,"hour":8,"minute":0},{"temperature":22,"hour":18,"minute":0},{"temperature":20,"hour":20,"minute":0}]}
info  2022-11-23 10:41:06: MQTT publish: topic 'zigbee2mqtt/0x84ba20fffe97d741', payload '{"anti_scaling":null,"child_lock":"UNLOCK","current_heating_setpoint":5,"device":{"applicationVersion":65,"dateCode":"","friendlyName":"0x84ba20fffe97d741","hardwareVersion":1,"ieeeAddr":"0x84ba20fffe97d741","manufacturerID":4098,"manufacturerName":"_TZE200_bvu2wnxz","model":"ME167","networkAddress":27353,"powerSource":"Battery","stackVersion":0,"type":"EndDevice","zclVersion":3},"frost_guard":null,"last_seen":"2022-11-23T10:41:06+01:00","linkquality":109,"local_temperature":17,"local_temperature_calibration":null,"running_state":"idle","system_mode":"off"}'
debug 2022-11-23 10:41:06: Received Zigbee message from '0x84ba20fffe97d741', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[6,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200],"type":"Buffer"},"datatype":0,"dp":33}],"seq":10240}' from endpoint 1 with groupID 0
info  2022-11-23 10:41:06: {"received day":5,"received values":{"type":"Buffer","data":[6,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}}
info  2022-11-23 10:41:06: {"returned weekly schedule: ":[{"temperature":12,"hour":6,"minute":0},{"temperature":16,"hour":8,"minute":0},{"temperature":22,"hour":18,"minute":0},{"temperature":20,"hour":20,"minute":0}]}
info  2022-11-23 10:41:06: MQTT publish: topic 'zigbee2mqtt/0x84ba20fffe97d741', payload '{"anti_scaling":null,"child_lock":"UNLOCK","current_heating_setpoint":5,"device":{"applicationVersion":65,"dateCode":"","friendlyName":"0x84ba20fffe97d741","hardwareVersion":1,"ieeeAddr":"0x84ba20fffe97d741","manufacturerID":4098,"manufacturerName":"_TZE200_bvu2wnxz","model":"ME167","networkAddress":27353,"powerSource":"Battery","stackVersion":0,"type":"EndDevice","zclVersion":3},"frost_guard":null,"last_seen":"2022-11-23T10:41:06+01:00","linkquality":109,"local_temperature":17,"local_temperature_calibration":null,"running_state":"idle","system_mode":"off"}'
debug 2022-11-23 10:41:06: Received Zigbee message from '0x84ba20fffe97d741', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[7,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200],"type":"Buffer"},"datatype":0,"dp":34}],"seq":10496}' from endpoint 1 with groupID 0
info  2022-11-23 10:41:06: {"received day":6,"received values":{"type":"Buffer","data":[7,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}}
info  2022-11-23 10:41:06: {"returned weekly schedule: ":[{"temperature":12,"hour":6,"minute":0},{"temperature":16,"hour":8,"minute":0},{"temperature":22,"hour":18,"minute":0},{"temperature":20,"hour":20,"minute":0}]}
info  2022-11-23 10:41:06: MQTT publish: topic 'zigbee2mqtt/0x84ba20fffe97d741', payload '{"anti_scaling":null,"child_lock":"UNLOCK","current_heating_setpoint":5,"device":{"applicationVersion":65,"dateCode":"","friendlyName":"0x84ba20fffe97d741","hardwareVersion":1,"ieeeAddr":"0x84ba20fffe97d741","manufacturerID":4098,"manufacturerName":"_TZE200_bvu2wnxz","model":"ME167","networkAddress":27353,"powerSource":"Battery","stackVersion":0,"type":"EndDevice","zclVersion":3},"frost_guard":null,"last_seen":"2022-11-23T10:41:06+01:00","linkquality":109,"local_temperature":17,"local_temperature_calibration":null,"running_state":"idle","system_mode":"off"}'

The two payloads, Buffer with data and weekly schedule with array, and their structure are not quite conclusive but the first kind of matches the later albeit in a different value order.

Buffer: {"type":"Buffer","data":[1,6,0,0,120,8,0,0,160,18,0,0,220,20,0,0,200]}} Values: 17 in total Value Structure

Worth to note the later can be generally described as x*y (x representing the hour and y representing the respective settings). Therefore, the mapping between the two messages looks like so:

[
  1, // Day of week, ranging from 1 to 7
  6,0,0,120, // Hour of day, unknown or minute, desired temperature as int
  8,0,0,160,
  18,0,0,220,
  20,0,0,200
]

Day-wise

[
  {"temperature":12,"hour":6,"minute":0},
  {"temperature":16,"hour":8,"minute":0},
  {"temperature":22,"hour":18,"minute":0},
  {"temperature":20,"hour":20,"minute":0}
]

What is intriguing is the extra value in the buffer message as there are four values vs. three in the day-wise data. Maybe the datatype per initial debug message which is preceding the info messages?

I am also curious if, in order for a day wise scheduling, sending both or only either of two messages is required.

Evgeka07 commented 1 year ago

@mikeg-de Hello, I installed according to your introduction. Works great But don't understand where and how to enter the schedules Can I somehow do this via the card or do I need a special card for this? Formatted JSON - in which file does the text go? Formatted - where does that go? or can you upload the finished files? Sorry for my English

woody4165 commented 1 year ago

Hi I got it working with me167, but when I set system_mode to heat and set a temperature, after some minutes it always returns to auto and changes the temperature set before. Any suggestion? Thanks

mikeg-de commented 1 year ago

@Evgeka07 I haven't figured out the scheduling by back engineering the format form my earlier post https://github.com/Koenkk/zigbee2mqtt/issues/15009#issuecomment-1324892985 either yet. The manufacturer was quite reluctant sharing the UART protocol and DPIDs data formats. had no time to test but plan to do so soon.

@woody4165 check your thermostats. I had the exact same issue and the timing / auto function was active. Please see my previous comment as well:

Checking the manual it becomes apparent that there are different operation modes as such "manual" and "programming". The later indicated by the clock icon on the thermostat display. I figure out that, in order to switch on the thermostat to manual mode, you have to press the "rotator" button twice if it sleeps and once if enabled..

ME167 Thermostat Manual.pdf

Checking the debug log I traced this back to "system_mode": "auto" vs. "system_mode": "heat". which is an exposed device setting.

woody4165 commented 1 year ago

@woody4165 check your thermostats. I had the exact same issue and the timing / auto function was active. Please see my previous comment as well:

Checking the manual it becomes apparent that there are different operation modes as such "manual" and "programming". The later indicated by the clock icon on the thermostat display. I figure out that, in order to switch on the thermostat to manual mode, you have to press the "rotator" button twice if it sleeps and once if enabled.. ME167 Thermostat Manual.pdf Checking the debug log I traced this back to "system_mode": "auto" vs. "system_mode": "heat". which is an exposed device setting.

Thanks, I've tried, but strangely after few seconds, sometimes minutes, it returns in programming mode, even if don't do anything physically or from zigbee2mqtt My model should be _TZE200_bvu2wnxz

scoof commented 1 year ago

Thanks, I've tried, but strangely after few seconds, sometimes minutes, it returns in programming mode, even if don't do anything physically or from zigbee2mqtt My model should be _TZE200_bvu2wnxz

Set system mode to "heat", and it will not go back to the schedule, but will just target the setpoint.

woody4165 commented 1 year ago

I've solved installing the dev branch It was recognized immediately and now it's working well

It's recognized as Brand [TuYa] Model [TS0601_thermostat_3]

Thanks

Evgeka07 commented 1 year ago

@woody4165 How did you do it? Can you set the instructions?

woody4165 commented 1 year ago

@Evgeka07 I've followed these steps https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html I'm using Proxmox with Z2M in a container. So I was sure that if anything was going to fail, I can restore the backup of the CT

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days