feat: Refactor BedHardware to support both Serial and MQTT implementations

- Added MQTT support to BedHardware, allowing for connection to MQTT brokers.
- Created BedHardwareMQTT and BedHardwareSerial classes to handle respective connections.
- Introduced a unified BedHardwareConfig interface for configuration management.
- Implemented event forwarding from the underlying implementations to the BedHardware class.
- Added MQTT adapter for handling MQTT connections and message subscriptions.
- Updated package.json to include the mqtt library as a dependency.
- Created a singleton MQTTService for managing MQTT client instances.
- Enhanced error handling and logging throughout the BedHardware and MQTT classes.
This commit is contained in:
Siwat Sirichai 2025-06-21 14:55:10 +07:00
parent 0c5c7bcb5f
commit fb87e74ec9
8 changed files with 753 additions and 158 deletions

View file

@ -15,6 +15,7 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.519.0",
"mqtt": "^5.13.1",
"next": "15.3.4",
"port": "^0.8.1",
"react": "^19.1.0",