Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Dec 21, 2020
1 parent f55e9a0 commit c0e84ec
Show file tree
Hide file tree
Showing 12 changed files with 9,049 additions and 1,050 deletions.
400 changes: 0 additions & 400 deletions converters/common.js

This file was deleted.

310 changes: 155 additions & 155 deletions converters/fromZigbee.js

Large diffs are not rendered by default.

298 changes: 150 additions & 148 deletions converters/toZigbee.js

Large diffs are not rendered by default.

309 changes: 0 additions & 309 deletions converters/utils.js

This file was deleted.

20 changes: 10 additions & 10 deletions devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
* {voltageToPercentage: '3V_2100'}: convert voltage to percentage using specified option. See utils.batteryVoltageToPercentage()
*/

const common = require('./converters/common');
const fz = {...require('./converters/fromZigbee'), legacy: require('./lib/legacy').fromZigbee};
const tz = require('./converters/toZigbee');
const utils = require('./converters/utils');
const utils = require('./lib/utils');
const globalStore = require('./lib/store');
const ota = require('./lib/ota');
const exposes = require('./lib/exposes');
const tuya = require('./lib/tuya');
const constants = require('./lib/constants');
const livolo = require('./lib/livolo');
const legrand = require('./lib/legrand');
const xiaomi = require('./lib/xiaomi');
Expand Down Expand Up @@ -1327,7 +1327,7 @@ const devices = [
vendor: 'TuYa',
description: 'Radiator valve with thermostat',
whiteLabel: [{vendor: 'Moes', model: 'HY369RT'}, {vendor: 'SHOJZJ', model: '378RT'}],
meta: {tuyaThermostatPreset: common.TuyaThermostatPresets},
meta: {tuyaThermostatPreset: tuya.thermostatPresets},
ota: ota.zigbeeOTA,
onEvent: tuya.onEventSetLocalTime,
fromZigbee: [fz.tuya_thermostat, fz.ignore_basic_report, fz.ignore_tuya_set_time],
Expand Down Expand Up @@ -1356,7 +1356,7 @@ const devices = [
thermostat: {
weeklyScheduleMaxTransitions: 4,
weeklyScheduleSupportedModes: [1], // bits: 0-heat present, 1-cool present (dec: 1-heat,2-cool,3-heat+cool)
weeklyScheduleFirstDayDpId: common.TuyaDataPoints.schedule,
weeklyScheduleFirstDayDpId: tuya.dataPoints.schedule,
},
},
exposes: [e.child_lock(), exposes.climate().withSetpoint('current_heating_setpoint', 5, 35, 0.5).withLocalTemperature()
Expand All @@ -1376,7 +1376,7 @@ const devices = [
thermostat: {
weeklyScheduleMaxTransitions: 4,
weeklyScheduleSupportedModes: [1], // bits: 0-heat present, 1-cool present (dec: 1-heat,2-cool,3-heat+cool)
weeklyScheduleFirstDayDpId: common.TuyaDataPoints.schedule,
weeklyScheduleFirstDayDpId: tuya.dataPoints.schedule,
},
},
exposes: [
Expand Down Expand Up @@ -1650,7 +1650,7 @@ const devices = [
exposes: [exposes.climate().withSetpoint('current_heating_setpoint', 5, 30, 0.5).withLocalTemperature()
.withSystemMode(['off', 'auto', 'heat']).withRunningState(['idle', 'heat', 'cool'])],
fromZigbee: [fz.tuya_thermostat, fz.ignore_basic_report, fz.tuya_dimmer],
meta: {tuyaThermostatSystemMode: common.TuyaThermostatSystemModes2, tuyaThermostatPreset: common.TuyaThermostatPresets},
meta: {tuyaThermostatSystemMode: tuya.thermostatSystemModes2, tuyaThermostatPreset: tuya.thermostatPresets},
toZigbee: [tz.tuya_thermostat_current_heating_setpoint, tz.tuya_thermostat_system_mode,
tz.tuya_thermostat_fan_mode, tz.tuya_dimmer_state],
},
Expand Down Expand Up @@ -9776,7 +9776,7 @@ const devices = [
thermostat: {
weeklyScheduleMaxTransitions: 4,
weeklyScheduleSupportedModes: [1], // bits: 0-heat present, 1-cool present (dec: 1-heat,2-cool,3-heat+cool)
weeklyScheduleFirstDayDpId: common.TuyaDataPoints.schedule,
weeklyScheduleFirstDayDpId: tuya.dataPoints.schedule,
},
},
exposes: [e.battery_low(), e.child_lock(), exposes.climate().withSetpoint('current_heating_setpoint', 5, 35, 0.5)
Expand Down Expand Up @@ -10008,9 +10008,9 @@ const devices = [
data.data &&
data.data.userid !== undefined &&
// Don't read RF events, we can do this with retrieve_state
(data.data.programeventsrc === undefined || common.lockSourceName[data.data.programeventsrc] != 'rf')
(data.data.programeventsrc === undefined || constants.lockSourceName[data.data.programeventsrc] != 'rf')
) {
await utils.getDoorLockPinCode( device.endpoints[0], data.data.userid );
await device.endpoints[0].command('closuresDoorLock', 'getPinCode', {userid: data.data.userid}, {});
}
},
exposes: [e.lock(), e.battery()],
Expand Down Expand Up @@ -13869,7 +13869,7 @@ const devices = [
vendor: 'Siterwell',
description: 'Radiator valve with thermostat',
fromZigbee: [fz.tuya_thermostat, fz.ignore_basic_report],
meta: {tuyaThermostatSystemMode: common.TuyaThermostatSystemModes, tuyaThermostatPreset: common.TuyaThermostatPresets},
meta: {tuyaThermostatSystemMode: tuya.thermostatSystemModes, tuyaThermostatPreset: tuya.thermostatPresets},
toZigbee: [tz.tuya_thermostat_child_lock, tz.siterwell_thermostat_window_detection, tz.tuya_thermostat_valve_detection,
tz.tuya_thermostat_current_heating_setpoint, tz.tuya_thermostat_system_mode, tz.tuya_thermostat_auto_lock,
tz.tuya_thermostat_calibration, tz.tuya_thermostat_min_temp, tz.tuya_thermostat_max_temp, tz.tuya_thermostat_boost_time,
Expand Down
Loading

0 comments on commit c0e84ec

Please sign in to comment.