mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 21:47:39 +02:00
Enhanced MQTT support with separate topics and multipliers (#173)
- Add separate MQTT topics for power, energy, and state monitoring - mqtt_power_topic, mqtt_power_path, mqtt_power_multiplier - mqtt_energy_topic, mqtt_energy_path, mqtt_energy_multiplier - mqtt_state_topic, mqtt_state_path, mqtt_state_on_value - Support different MQTT topics per data type (e.g., Zigbee2MQTT with separate power/energy/state topics) - Individual multipliers for power and energy (e.g., mW→W, Wh→kWh) - Configurable ON value for state monitoring (e.g., "ON", "true", "1") - Maintain backward compatibility with legacy mqtt_topic/mqtt_multiplier - Database migration auto-copies legacy fields to new fields - Update backup/restore to handle new MQTT fields - Add backend tests for new MQTT configurations - Update frontend form with organized Power/Energy/State sections Closes #173
This commit is contained in:
@@ -21,12 +21,24 @@ const createMockPlug = (overrides: Partial<SmartPlug> = {}): SmartPlug => ({
|
||||
plug_type: 'tasmota',
|
||||
ip_address: '192.168.1.100',
|
||||
ha_entity_id: null,
|
||||
// MQTT fields
|
||||
ha_power_entity: null,
|
||||
ha_energy_today_entity: null,
|
||||
ha_energy_total_entity: null,
|
||||
// MQTT fields (legacy)
|
||||
mqtt_topic: null,
|
||||
mqtt_power_path: null,
|
||||
mqtt_energy_path: null,
|
||||
mqtt_state_path: null,
|
||||
mqtt_multiplier: 1.0,
|
||||
// MQTT power fields
|
||||
mqtt_power_topic: null,
|
||||
mqtt_power_path: null,
|
||||
mqtt_power_multiplier: 1.0,
|
||||
// MQTT energy fields
|
||||
mqtt_energy_topic: null,
|
||||
mqtt_energy_path: null,
|
||||
mqtt_energy_multiplier: 1.0,
|
||||
// MQTT state fields
|
||||
mqtt_state_topic: null,
|
||||
mqtt_state_path: null,
|
||||
mqtt_state_on_value: null,
|
||||
printer_id: 1,
|
||||
enabled: true,
|
||||
auto_on: true,
|
||||
|
||||
Reference in New Issue
Block a user