Skip to content

Commit

Permalink
modify convertor to add temperature units toggler
Browse files Browse the repository at this point in the history
  • Loading branch information
devbis committed Nov 4, 2023
1 parent 7f0dd00 commit 2ca7dcc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions converters/lywsd03mmc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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 ota = require('zigbee-herdsman-converters/lib/ota');
Expand All @@ -9,8 +10,8 @@ const definition = {
model: 'LYWSD03MMC',
vendor: 'Xiaomi',
description: 'Temperature & humidity sensor',
fromZigbee: [fz.temperature, fz.humidity, fz.battery],
toZigbee: [],
fromZigbee: [fz.temperature, fz.humidity, fz.battery, fz.hvac_user_interface],
toZigbee: [tz.thermostat_temperature_display_mode],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
const bindClusters = ['msTemperatureMeasurement', 'msRelativeHumidity', 'genPowerCfg'];
Expand All @@ -20,7 +21,11 @@ const definition = {
await reporting.batteryVoltage(endpoint);
await reporting.batteryPercentageRemaining(endpoint);
},
exposes: [e.temperature(), e.humidity(), e.battery()],
exposes: [
e.temperature(), e.humidity(), e.battery(),
exposes.enum('temperature_display_mode', exposes.access.ALL, ['celsius', 'fahrenheit'])
.withDescription('The temperature format displayed on the screen'),
],
ota: ota.zigbeeOTA,
};

Expand Down

0 comments on commit 2ca7dcc

Please sign in to comment.