Skip to content

Commit

Permalink
feat: Expose deviceRunTime for STARKVIND air purifier (#7716)
Browse files Browse the repository at this point in the history
Also, add 'minutes' as unit for filter_age and device_age.
  • Loading branch information
indrajitr authored Jul 1, 2024
1 parent 7df9894 commit 8b07e08
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/lib/ikea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,16 @@ export function ikeaAirPurifier(): ModernExtend {
.binary('replace_filter', access.STATE_GET, true, false)
.withDescription('Indicates if the filter is older than 6 months and needs replacing')
.withCategory('diagnostic'),
presets.numeric('filter_age', access.STATE_GET).withDescription('Time the filter has been used in minutes').withCategory('diagnostic'),
presets
.numeric('filter_age', access.STATE_GET)
.withUnit('minutes')
.withDescription('Duration the filter has been used')
.withCategory('diagnostic'),
presets
.numeric('device_age', access.STATE_GET)
.withUnit('minutes')
.withDescription('Duration the air purifier has been used')
.withCategory('diagnostic'),
];

const fromZigbee: Fz.Converter[] = [
Expand Down Expand Up @@ -265,6 +274,10 @@ export function ikeaAirPurifier(): ModernExtend {
state['filter_age'] = parseInt(msg.data['filterRunTime']);
}

if (msg.data.hasOwnProperty('deviceRunTime')) {
state['device_age'] = parseInt(msg.data['deviceRunTime']);
}

if (msg.data.hasOwnProperty('controlPanelLight')) {
state['led_enable'] = msg.data['controlPanelLight'] == 0;
}
Expand Down Expand Up @@ -350,6 +363,12 @@ export function ikeaAirPurifier(): ModernExtend {
await entity.read('manuSpecificIkeaAirPurifier', ['filterRunTime']);
},
},
{
key: ['device_age'],
convertGet: async (entity, key, meta) => {
await entity.read('manuSpecificIkeaAirPurifier', ['deviceRunTime']);
},
},
{
key: ['child_lock'],
convertSet: async (entity, key, value, meta) => {
Expand Down

0 comments on commit 8b07e08

Please sign in to comment.