Hey there,
Thanks for building these drivers! I've started off with a few of the LYWSD03MMC (Xiaomi Mi Temperature & Humidity Monitor 2) temperature sensors.
Your driver works with this firmware github[.com]/devbis/z03mmc just fine ... but there is a newer fork of the firmware here:
github[.com]/pvvx/ZigbeeTLc (this is the same person who has been doing the BLE custom firmware for these devices).
[I guess I'm too new here to post links!]
I was wondering if you might be able to update the driver to work with pvvx's firmware, it seems like that code is being more actively updated and also might be a bit more efficient with battery power management? It looks like (from a very quick glance) that there are differences in the at least some of the cluster/attributes in the different versions of the firmware.
Edited to add...
I took a swing at this myself and I think I have it working. I have a sensor reporting in as expected, and the custom functions (smiley, temperature offsets) work as expected. The "display off" function seems to just freeze the display instead of blanking it. I'm not sure if that is a firmware bug or not? I've also added the Measurement Interval setting that this version of firmware supports -- so it is possible to have the sensor read the temperature less often, which is supposed to save some battery life.
This is my first time doing anything for hubitat and in groovy, so edits are appreciated! thanks!
Here's the diff from 5.3.0:
< @Field static final String DRIVER_NAME = 'Xiaomi Mi Temperature and Humidity Monitor 2 (LYWSD03MMC) pvvx'
< @Field static final String DRIVER_VERSION = '5.3.0.1'
---
> @Field static final String DRIVER_NAME = 'Xiaomi Mi Temperature and Humidity Monitor 2 (LYWSD03MMC)'
> @Field static final String DRIVER_VERSION = '5.3.0'
36c36
< fingerprint profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0020,0204,0402,0405', outClusters:'0019', model:'LYWSD03MMC-z', manufacturer:'Xiaomi', controllerType:'ZGB' // Firmware: Unknown
---
> fingerprint profileId:'0104', endpointId:'01', inClusters:'0000,0003,0001,0405,0402,0204', outClusters:'0019', model:'LYWSD03MMC', manufacturer:'Xiaomi', controllerType:'ZGB' // Firmware: Unknown
78,83d77
< input (
< name:'measurementInterval', type:'number', title:'Measurement Interval', required:true,
< description:'Measurement interval (range 3 - 255 seconds, default 10 seconds)',
< range:'3..255',
< defaultValue: 10
< )
136c130
< cmds += zigbee.writeAttribute(0x0204, 0x0100, DataType.INT16, temperatureDelta)
---
> cmds += zigbee.writeAttribute(0x0402, 0x0010, DataType.INT16, temperatureDelta)
144c138
< cmds += zigbee.writeAttribute(0x0204, 0x0101, DataType.INT16, humidityDelta)
---
> cmds += zigbee.writeAttribute(0x0405, 0x0010, DataType.INT16, humidityDelta)
151c145
< cmds += zigbee.writeAttribute(0x0204, 0x0106, DataType.ENUM8, enableDisplay ? 0x00 : 0x01)
---
> cmds += zigbee.writeAttribute(0x0204, 0x0011, DataType.BOOLEAN, enableDisplay ? 0x01 : 0x00)
158,168c152
< cmds += zigbee.writeAttribute(0x0204, 0x0002, DataType.ENUM8, showSmiley ? 0x00 : 0x01)
<
< if (measurementInterval == null) {
< measurementInterval = 10
< device.updateSetting 'measurementInterval', [value:measurementInterval, type:'number']
< }
< log_info "ߛ️ measurementInterval = ${measurementInterval}"
< Integer measurementInterval = new BigDecimal(measurementInterval).intValue()
< cmds += zigbee.writeAttribute(0x0204, 0x0107, DataType.UINT8, measurementInterval)
<
<
---
> cmds += zigbee.writeAttribute(0x0204, 0x0010, DataType.BOOLEAN, showSmiley ? 0x01 : 0x00)
285,289c269,272
< cmds += zigbee.readAttribute(0x0204, 0x0100) // TemperatureCalibration
< cmds += zigbee.readAttribute(0x0204, 0x0101) // HumidityCalibration
< cmds += zigbee.readAttribute(0x0204, 0x0106) // EnableDisplay
< cmds += zigbee.readAttribute(0x0204, 0x0002) // ShowSmiley
< cmds += zigbee.readAttribute(0x0204, 0x0107) // MeasurementInterval
---
> cmds += zigbee.readAttribute(0x0402, 0x0010) // TemperatureCalibration
> cmds += zigbee.readAttribute(0x0405, 0x0010) // HumidityCalibration
> cmds += zigbee.readAttribute(0x0204, 0x0011) // EnableDisplay
> cmds += zigbee.readAttribute(0x0204, 0x0010) // ShowSmiley
474c457
< case { contains it, [clusterInt:0x0204, commandInt:0x01, attrInt:0x0100] }:
---
> case { contains it, [clusterInt:0x0402, commandInt:0x01, attrInt:0x0010] }:
481c464
< case { contains it, [clusterInt:0x0204, commandInt:0x01, attrInt:0x0101] }:
---
> case { contains it, [clusterInt:0x0405, commandInt:0x01, attrInt:0x0010] }:
488,489c471,472
< case { contains it, [clusterInt:0x0204, commandInt:0x01, attrInt:0x00106] }:
< enableDisplay = msg.value == '00'
---
> case { contains it, [clusterInt:0x0204, commandInt:0x01, attrInt:0x0011] }:
> enableDisplay = msg.value == '01'
495,496c478,479
< case { contains it, [clusterInt:0x0204, commandInt:0x01, attrInt:0x0002] }:
< showSmiley = msg.value == '00'
---
> case { contains it, [clusterInt:0x0204, commandInt:0x01, attrInt:0x0010] }:
> showSmiley = msg.value == '01'
500,506d482
<
< // Read Attributes: MeasurementInterval
< case { contains it, [clusterInt:0x0204, commandInt:0x01, attrInt:0x0107] }:
< device.updateSetting 'measurementInterval', [value:measurementInterval, type:'number']
< utils_processedZclMessage 'Read Attributes Response', "MeasurementInterval=${msg.value} (${measurementInterval})"
< return
<