Skip to content

Commit

Permalink
fix: Add categories to several config/diagnostic exposes (#6855)
Browse files Browse the repository at this point in the history
* add categories to several exposes

* also add category for right endpoint
  • Loading branch information
slugzero committed Jan 8, 2024
1 parent 6a2bd70 commit 2c08cdc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
42 changes: 28 additions & 14 deletions src/devices/bosch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,8 @@ const definitions: Definition[] = [
e.binary('window_open', ea.ALL, 'ON', 'OFF')
.withDescription('Window open'),
e.enum('display_orientation', ea.ALL, Object.keys(displayOrientation))
.withDescription('Display orientation'),
.withDescription('Display orientation')
.withCategory('config'),
e.numeric('remote_temperature', ea.ALL)
.withValueMin(0)
.withValueMax(35)
Expand All @@ -996,24 +997,29 @@ const definitions: Definition[] = [
e.numeric('display_ontime', ea.ALL)
.withValueMin(5)
.withValueMax(30)
.withDescription('Specifies the display on-time'),
.withDescription('Specifies the display on-time')
.withCategory('config'),
e.numeric('display_brightness', ea.ALL)
.withValueMin(0)
.withValueMax(10)
.withDescription('Specifies the brightness level of the display'),
.withDescription('Specifies the brightness level of the display')
.withCategory('config'),
e.enum('displayed_temperature', ea.ALL, Object.keys(displayedTemperature))
.withDescription('Temperature displayed on the thermostat'),
.withDescription('Temperature displayed on the thermostat')
.withCategory('config'),
e.child_lock().setAccess('state', ea.ALL),
e.battery(),
e.enum('setpoint_change_source', ea.STATE, Object.keys(setpointSource))
.withDescription('States where the current setpoint originated'),
e.enum('valve_adapt_status', ea.STATE, Object.keys(adaptationStatus))
.withLabel('Adaptation status')
.withDescription('Specifies the current status of the valve adaptation'),
.withDescription('Specifies the current status of the valve adaptation')
.withCategory('diagnostic'),
e.binary('valve_adapt_process', ea.ALL, true, false)
.withLabel('Trigger adaptation process')
.withDescription('Trigger the valve adaptation process. Only possible when adaptation status ' +
'is "ready_to_calibrate" or "error".'),
'is "ready_to_calibrate" or "error".')
.withCategory('config'),
],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
Expand Down Expand Up @@ -1375,21 +1381,29 @@ const definitions: Definition[] = [
e.battery_low(),
e.battery_voltage(),
e.text('config_led_top_left_press', ea.ALL).withLabel('LED config (top left short press)')
.withDescription(labelShortPress),
.withDescription(labelShortPress)
.withCategory('config'),
e.text('config_led_top_right_press', ea.ALL).withLabel('LED config (top right short press)')
.withDescription(labelShortPress),
.withDescription(labelShortPress)
.withCategory('config'),
e.text('config_led_bottom_left_press', ea.ALL).withLabel('LED config (bottom left short press)')
.withDescription(labelShortPress),
.withDescription(labelShortPress)
.withCategory('config'),
e.text('config_led_bottom_right_press', ea.ALL).withLabel('LED config (bottom right short press)')
.withDescription(labelShortPress),
.withDescription(labelShortPress)
.withCategory('config'),
e.text('config_led_top_left_longpress', ea.ALL).withLabel('LED config (top left long press)')
.withDescription(labelLongPress),
.withDescription(labelLongPress)
.withCategory('config'),
e.text('config_led_top_right_longpress', ea.ALL).withLabel('LED config (top right long press)')
.withDescription(labelLongPress),
.withDescription(labelLongPress)
.withCategory('config'),
e.text('config_led_bottom_left_longpress', ea.ALL).withLabel('LED config (bottom left long press)')
.withDescription(labelLongPress),
.withDescription(labelLongPress)
.withCategory('config'),
e.text('config_led_bottom_right_longpress', ea.ALL).withLabel('LED config (bottom right long press)')
.withDescription(labelLongPress),
.withDescription(labelLongPress)
.withCategory('config'),
],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
Expand Down
6 changes: 4 additions & 2 deletions src/devices/xiaomi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1500,10 +1500,12 @@ const definitions: Definition[] = [
'single_left', 'single_right', 'hold_release_left', 'hold_release_left']),
e.enum('operation_mode', ea.STATE_SET, ['control_left_relay', 'control_right_relay', 'decoupled'])
.withDescription('Operation mode for left button')
.withEndpoint('left'),
.withEndpoint('left')
.withCategory('config'),
e.enum('operation_mode', ea.STATE_SET, ['control_left_relay', 'control_right_relay', 'decoupled'])
.withDescription('Operation mode for right button')
.withEndpoint('right'),
.withEndpoint('right')
.withCategory('config'),
],
toZigbee: [tz.on_off, {...tz.xiaomi_switch_operation_mode_basic, convertGet: null}, tz.xiaomi_power],
meta: {multiEndpoint: true},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/exposes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ export const presets = {
power_factor: () => new Numeric('power_factor', access.STATE).withDescription('Instantaneous measured power factor'),
power_apparent: () => new Numeric('power_apparent', access.STATE).withUnit('VA').withDescription('Instantaneous measured apparent power'),
power_on_behavior: (values=['off', 'previous', 'on']) => new Enum('power_on_behavior', access.ALL, values).withLabel('Power-on behavior').withDescription('Controls the behavior when the device is powered on after power loss. If you get an `UNSUPPORTED_ATTRIBUTE` error, the device does not support it.'),
power_outage_count: (resetsWhenPairing = true) => new Numeric('power_outage_count', access.STATE).withDescription('Number of power outages' + (resetsWhenPairing ? ' (since last pairing)' : '')),
power_outage_count: (resetsWhenPairing = true) => new Numeric('power_outage_count', access.STATE).withDescription('Number of power outages' + (resetsWhenPairing ? ' (since last pairing)' : '')).withCategory('diagnostic'),
power_outage_memory: () => new Binary('power_outage_memory', access.ALL, true, false).withDescription('Enable/disable the power outage memory, this recovers the on/off mode after power failure'),
power_reactive: () => new Numeric('power_reactive', access.STATE).withUnit('VAR').withDescription('Instantaneous measured reactive power'),
presence: () => new Binary('presence', access.STATE, true, false).withDescription('Indicates whether the device detected presence'),
Expand Down

0 comments on commit 2c08cdc

Please sign in to comment.