@@ -2,7 +2,6 @@ import assert from "node:assert";
22import * as libColor from "../lib/color" ;
33import * as constants from "../lib/constants" ;
44import * as exposes from "../lib/exposes" ;
5- import type { HeimanSpecificAirQualityCluster , HeimanSpecificInfraRedRemoteCluster , HeimanSpecificScenesCluster } from "../lib/heiman" ;
65import { logger } from "../lib/logger" ;
76import * as globalStore from "../lib/store" ;
87import type { Fz , KeyValue , KeyValueAny , KeyValueNumberString } from "../lib/types" ;
@@ -2651,68 +2650,6 @@ export const plaid_battery: Fz.Converter<"genPowerCfg", undefined, ["readRespons
26512650 return payload ;
26522651 } ,
26532652} ;
2654- export const heiman_ir_remote : Fz . Converter <
2655- "heimanSpecificInfraRedRemote" ,
2656- HeimanSpecificInfraRedRemoteCluster ,
2657- [ "commandStudyKeyRsp" , "commandCreateIdRsp" , "commandGetIdAndKeyCodeListRsp" ]
2658- > = {
2659- cluster : "heimanSpecificInfraRedRemote" ,
2660- type : [ "commandStudyKeyRsp" , "commandCreateIdRsp" , "commandGetIdAndKeyCodeListRsp" ] ,
2661- convert : ( model , msg , publish , options , meta ) => {
2662- // TODO: split converter for each cmd?
2663- switch ( msg . type ) {
2664- case "commandStudyKeyRsp" :
2665- assert ( "keyCode" in msg . data ) ;
2666- return {
2667- action : "learn" ,
2668- action_result : msg . data . result === 1 ? "success" : "error" ,
2669- action_key_code : msg . data . keyCode ,
2670- action_id : msg . data . result === 1 ? msg . data . id : undefined ,
2671- } ;
2672- case "commandCreateIdRsp" :
2673- assert ( "id" in msg . data ) ;
2674- assert ( "modelType" in msg . data ) ;
2675- return {
2676- action : "create" ,
2677- action_result : msg . data . id === 0xff ? "error" : "success" ,
2678- action_model_type : msg . data . modelType ,
2679- action_id : msg . data . id !== 0xff ? msg . data . id : undefined ,
2680- } ;
2681- case "commandGetIdAndKeyCodeListRsp" : {
2682- assert ( "packetNumber" in msg . data ) ;
2683- // See cluster.js with data format description
2684- if ( msg . data . packetNumber === 1 ) {
2685- // start to collect and merge list
2686- // so, we use store instance for temp storage during merging
2687- globalStore . putValue ( msg . endpoint , "db" , [ ] ) ;
2688- }
2689- const buffer = msg . data . learnedDevicesList ;
2690- for ( let i = 0 ; i < msg . data . packetLength ; ) {
2691- const modelDescription : KeyValueAny = {
2692- id : buffer [ i ] ,
2693- model_type : buffer [ i + 1 ] ,
2694- key_codes : [ ] ,
2695- } ;
2696- const numberOfKeys = buffer [ i + 2 ] ;
2697- for ( let j = i + 3 ; j < i + 3 + numberOfKeys ; j ++ ) {
2698- modelDescription . key_codes . push ( buffer [ j ] ) ;
2699- }
2700- i = i + 3 + numberOfKeys ;
2701- globalStore . getValue ( msg . endpoint , "db" ) . push ( modelDescription ) ;
2702- }
2703- if ( msg . data . packetNumber === msg . data . packetsTotal ) {
2704- // last packet, all data collected, can publish
2705- const result : KeyValueAny = {
2706- devices : globalStore . getValue ( msg . endpoint , "db" ) ,
2707- } ;
2708- globalStore . clearValue ( msg . endpoint , "db" ) ;
2709- return result ;
2710- }
2711- break ;
2712- }
2713- }
2714- } ,
2715- } ;
27162653export const meazon_meter : Fz . Converter < "seMetering" , undefined , [ "attributeReport" , "readResponse" ] > = {
27172654 cluster : "seMetering" ,
27182655 type : [ "attributeReport" , "readResponse" ] ,
@@ -3311,34 +3248,6 @@ export const U02I007C01_water_leak: Fz.Converter<"ssIasZone", undefined, "comman
33113248 } ;
33123249 } ,
33133250} ;
3314- export const heiman_hcho : Fz . Converter < "msFormaldehyde" , undefined , [ "attributeReport" , "readResponse" ] > = {
3315- cluster : "msFormaldehyde" ,
3316- type : [ "attributeReport" , "readResponse" ] ,
3317- convert : ( model , msg , publish , options , meta ) => {
3318- if ( msg . data . measuredValue ) {
3319- return { hcho : msg . data . measuredValue / 1000.0 } ;
3320- }
3321- } ,
3322- } ;
3323- export const heiman_air_quality : Fz . Converter < "heimanSpecificAirQuality" , HeimanSpecificAirQualityCluster , [ "attributeReport" , "readResponse" ] > = {
3324- cluster : "heimanSpecificAirQuality" ,
3325- type : [ "attributeReport" , "readResponse" ] ,
3326- convert : ( model , msg , publish , options , meta ) => {
3327- const result : KeyValueAny = { } ;
3328- if ( msg . data . batteryState ) {
3329- const lookup : KeyValueAny = {
3330- 0 : "not_charging" ,
3331- 1 : "charging" ,
3332- 2 : "charged" ,
3333- } ;
3334- result . battery_state = lookup [ msg . data . batteryState ] ;
3335- }
3336- if ( msg . data . tvocMeasuredValue ) result . voc = msg . data . tvocMeasuredValue ;
3337- if ( msg . data . aqiMeasuredValue ) result . aqi = msg . data . aqiMeasuredValue ;
3338- if ( msg . data . pm10measuredValue ) result . pm10 = msg . data . pm10measuredValue ;
3339- return result ;
3340- } ,
3341- } ;
33423251export const scenes_recall_scene_65024 : Fz . Converter < 65024 , undefined , [ "raw" ] > = {
33433252 cluster : 65024 ,
33443253 type : [ "raw" ] ,
@@ -3508,24 +3417,6 @@ export const STS_PRS_251_presence: Fz.Converter<"genBinaryInput", undefined, ["a
35083417 return { presence : true } ;
35093418 } ,
35103419} ;
3511- export const heiman_scenes : Fz . Converter <
3512- "heimanSpecificScenes" ,
3513- HeimanSpecificScenesCluster ,
3514- [ "commandAtHome" , "commandGoOut" , "commandCinema" , "commandRepast" , "commandSleep" ]
3515- > = {
3516- cluster : "heimanSpecificScenes" ,
3517- type : [ "commandAtHome" , "commandGoOut" , "commandCinema" , "commandRepast" , "commandSleep" ] ,
3518- convert : ( model , msg , publish , options , meta ) => {
3519- const lookup : KeyValueAny = {
3520- commandCinema : "cinema" ,
3521- commandAtHome : "at_home" ,
3522- commandSleep : "sleep" ,
3523- commandGoOut : "go_out" ,
3524- commandRepast : "repast" ,
3525- } ;
3526- if ( lookup [ msg . type ] !== undefined ) return { action : lookup [ msg . type ] } ;
3527- } ,
3528- } ;
35293420export const javis_lock_report : Fz . Converter < "genBasic" , undefined , "attributeReport" > = {
35303421 cluster : "genBasic" ,
35313422 type : "attributeReport" ,
@@ -4023,23 +3914,6 @@ export const rc_110_level_to_scene: Fz.Converter<"genLevelCtrl", undefined, ["co
40233914 return { action : `scene_${ scenes [ msg . data . level ] } ` } ;
40243915 } ,
40253916} ;
4026- export const heiman_doorbell_button : Fz . Converter < "ssIasZone" , undefined , "commandStatusChangeNotification" > = {
4027- cluster : "ssIasZone" ,
4028- type : "commandStatusChangeNotification" ,
4029- convert : ( model , msg , publish , options , meta ) => {
4030- if ( hasAlreadyProcessedMessage ( msg , model ) ) return ;
4031- const lookup : KeyValueAny = {
4032- 32768 : "pressed" ,
4033- 32772 : "pressed" ,
4034- } ;
4035- const zoneStatus = msg . data . zonestatus ;
4036- return {
4037- action : lookup [ zoneStatus ] ,
4038- tamper : ( zoneStatus & ( 1 << 2 ) ) > 0 ,
4039- battery_low : ( zoneStatus & ( 1 << 3 ) ) > 0 ,
4040- } ;
4041- } ,
4042- } ;
40433917export const sihas_people_cnt : Fz . Converter < "genAnalogInput" , undefined , [ "attributeReport" , "readResponse" ] > = {
40443918 cluster : "genAnalogInput" ,
40453919 type : [ "attributeReport" , "readResponse" ] ,
0 commit comments