@@ -4,8 +4,9 @@ import {readFileSync} from 'fs';
44import { join } from 'path' ;
55import { createHash } from 'crypto' ;
66import fetch from 'node-fetch' ;
7+ import { HealthServer } from './health' ;
78
8- const deviceGenerations = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 ] as const ;
9+ const deviceGenerations = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 50 ] as const ;
910type DeviceGen = typeof deviceGenerations [ number ] ;
1011const deviceTypes = [ "A" , "B" , "D" , "E" , "F" , "G" , "J" , "K" ] as const ;
1112type DeviceType = typeof deviceTypes [ number ] ;
@@ -149,6 +150,7 @@ function cleanAndValidate(config: Config): void {
149150class MQTTForwarder {
150151 private configBroker ! : mqtt . MqttClient ;
151152 private hameBroker ! : mqtt . MqttClient ;
153+ private healthServer ! : HealthServer ;
152154 private readonly MESSAGE_HISTORY_TIMEOUT = 1000 ; // 1 second timeout
153155 private readonly RATE_LIMIT_INTERVAL = 59900 ; // Rate limit interval in milliseconds
154156 private readonly MESSAGE_CACHE_TIMEOUT = 1000 ; // 1 second timeout for message loop prevention
@@ -161,6 +163,8 @@ class MQTTForwarder {
161163 constructor ( private readonly config : Config ) {
162164 // Initialize brokers
163165 this . initializeBrokers ( ) ;
166+ // Initialize health server
167+ this . healthServer = new HealthServer ( this . configBroker , this . hameBroker ) ;
164168 }
165169
166170 /**
@@ -429,6 +433,7 @@ class MQTTForwarder {
429433 public close ( ) : void {
430434 this . configBroker . end ( ) ;
431435 this . hameBroker . end ( ) ;
436+ this . healthServer . close ( ) ;
432437 }
433438
434439 // Clean up old message history entries periodically
0 commit comments