Skip to content

Commit

Permalink
feat(add): POK014, POK015 (#8695)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Osin <[email protected]>
  • Loading branch information
zombierzn and Andrey Osin authored Jan 29, 2025
1 parent 9a94890 commit 123b4e4
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion src/devices/pushok.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {access, presets} from '../lib/exposes';
import * as m from '../lib/modernExtend';
import {DefinitionWithExtend} from '../lib/types';
import {DefinitionWithExtend, Fz, ModernExtend, Tz} from '../lib/types';

const pushokExtend = {
valveStatus: (args?: Partial<m.EnumLookupArgs>) =>
Expand Down Expand Up @@ -28,6 +29,33 @@ const pushokExtend = {
reporting: null,
...args,
}),
extendedTemperature: (): ModernExtend => {
const exposes = [presets.numeric('temperature', access.STATE).withUnit('°C').withDescription('Measured temperature value')];
const fromZigbee: Fz.Converter[] = [
{
cluster: 'msTemperatureMeasurement',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
if (msg.data['measuredValue'] !== undefined) {
let temperature = msg.data.measuredValue / 100.0;

if (msg.data[0xf001] !== undefined) {
temperature += msg.data[0xf001] / 10.0;
}
return {temperature};
}
return {};
},
},
];
const toZigbee: Tz.Converter[] = [];
return {
exposes,
fromZigbee,
toZigbee,
isModernExtend: true,
};
},
};

const definitions: DefinitionWithExtend[] = [
Expand Down Expand Up @@ -297,6 +325,22 @@ const definitions: DefinitionWithExtend[] = [
],
ota: true,
},
{
zigbeeModel: ['POK014'],
model: 'POK014',
vendor: 'PushOk Hardware',
description: 'External probe temperature sensor: k-type',
extend: [pushokExtend.extendedTemperature(), m.battery({percentage: true, voltage: true, lowStatus: false, percentageReporting: false})],
ota: true,
},
{
zigbeeModel: ['POK015'],
model: 'POK015',
vendor: 'PushOk Hardware',
description: 'External probe temperature sensor: pt1000',
extend: [pushokExtend.extendedTemperature(), m.battery({percentage: true, voltage: true, lowStatus: false, percentageReporting: false})],
ota: true,
},
];

export default definitions;
Expand Down

0 comments on commit 123b4e4

Please sign in to comment.