File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {
1919 WRITE_BIT ,
2020 parseType ,
2121 isReadable ,
22+ parseUnit ,
2223} from './zigbee2mqtt-property' ;
2324import mqtt from 'mqtt' ;
2425import DEBUG_FLAG from '../zb-debug' ;
@@ -319,7 +320,7 @@ export class Zigbee2MqttDevice extends Device {
319320 description : expose . description ,
320321 input : {
321322 type : parseType ( expose ) ,
322- unit : expose . unit ,
323+ unit : parseUnit ( expose . unit ) ,
323324 enum : expose . values ,
324325 minimum : expose . value_min ,
325326 maximum : expose . value_max ,
Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ export function parseType(expose: Expos): PropertyValueType {
4343 return 'string' ;
4444}
4545
46+ export function parseUnit ( unit ?: string ) : string | undefined {
47+ switch ( unit ) {
48+ case '°C' :
49+ return 'degree celsius' ;
50+ }
51+
52+ return unit ;
53+ }
54+
4655function isWritable ( access : number ) : boolean {
4756 return ( access & WRITE_BIT ) != 0 ;
4857}
@@ -64,7 +73,7 @@ export class Zigbee2MqttProperty<T extends PropertyValue> extends Property<T> {
6473 title : expose . name ,
6574 description : expose . description ,
6675 type : parseType ( expose ) ,
67- unit : expose . unit ,
76+ unit : parseUnit ( expose . unit ) ,
6877 enum : expose . values ,
6978 minimum : expose . value_min ,
7079 maximum : expose . value_max ,
You can’t perform that action at this time.
0 commit comments