home-assistant-configuration/config/zigbee2mqtt/smartwings.js

28 lines
1.1 KiB
JavaScript
Executable File

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 e = exposes.presets;
module.exports = [
{
zigbeeModel: ['WM25/L-Z'],
model: 'WM25L-Z',
vendor: 'Smartwings',
description: 'Roller Shade',
fromZigbee: [fz.cover_position_tilt, fz.battery],
toZigbee: [tz.cover_state, tz.cover_position_tilt],
meta: {battery: {dontDividePercentage: true}},
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'closuresWindowCovering']);
await reporting.batteryPercentageRemaining(endpoint);
await reporting.currentPositionLiftPercentage(endpoint);
device.powerSource = 'Battery';
device.save();
},
exposes: [e.cover_position(), e.battery()],
},
];