fix(mqtt): FR-013 device_class aus binary_sensor Discovery entfernt (v1.5.1)

- binary_sensor laser_active: device_class 'running' entfernt
- HA zeigt jetzt 'An' / 'Aus' statt 'In Betrieb' / 'Ausser Betrieb'
This commit is contained in:
MaPaLo76 2026-03-04 21:40:45 +01:00
parent c00a3a8651
commit db1fd0b787
3 changed files with 23 additions and 7 deletions

View File

@ -25,6 +25,18 @@ Status: `[ ]` = offen · `[x]` = erledigt
## Erledigt
### Version 1.5.1
- [x] **FR-013** Bug: `binary_sensor` Laser aktiv zeigt "In Betrieb" / "Außer Betrieb" statt "An" / "Aus" ✅
- **Symptom**: HA Tile-Card zeigt unter dem Sensor-Status "Außer Betrieb" statt "Aus"
- **Ursache**: `device_class: running` in der MQTT Discovery-Config erzeugt HA-spezifische Texte ("In Betrieb" / "Außer Betrieb")
- **Fix**: `device_class` aus der `publishDiscovery()`-binary_sensor-Config in `mqtt_client.cpp` entfernt → HA zeigt generisch "An" / "Aus"
- **Betroffene Dateien**: `src/mqtt_client.cpp`
- Commit: `TODO`
- Version: 1.5.1
---
### Version 1.5.0
- [x] **FR-012** Feature: Home Assistant MQTT Discovery (automatische Device-Erkennung ohne configuration.yaml) ✅

View File

@ -23,7 +23,7 @@ build_flags =
-DCORE_DEBUG_LEVEL=1 ; 0=keine, 1=Fehler, 3=Info, 5=Verbose
-DARDUINO_LOOP_STACK_SIZE=8192
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
-DFIRMWARE_VERSION='"1.5.0"' ; Semantic Versioning hier erhöhen bei neuem Release
-DFIRMWARE_VERSION='"1.5.1"' ; Semantic Versioning hier erhöhen bei neuem Release
lib_deps =
majicDesigns/MD_Parola @ ^3.7.3
majicDesigns/MD_MAX72XX @ ^3.5.1
@ -56,10 +56,10 @@ monitor_rts = 0
; upload_flags = --auth=${sysenv.LASERCUTTER_OTA_PW}
; =============================================================================
[env:az-delivery-devkit-v4-ota]
;upload_port = 172.30.30.90
upload_port = 192.168.2.62
upload_port = 172.30.30.90
;upload_port = 192.168.2.62
upload_protocol = espota
upload_flags = --auth=${sysenv.LASERCUTTER_OTA_PW}
upload_flags = --auth=${sysenv.LASERCUTTER_OTA_PW} --timeout=60
; Vor dem Upload in PowerShell: $env:LASERCUTTER_OTA_PW = "DeinPasswort"
; Vor dem Upload in CMD: set LASERCUTTER_OTA_PW=DeinPasswort
; Kein Passwort gesetzt: Variable leer lassen oder weglassen (espota ignoriert leeren --auth)
@ -70,8 +70,8 @@ upload_flags = --auth=${sysenv.LASERCUTTER_OTA_PW}
; pio run -e az-delivery-devkit-v4-ota-http --target upload
; =============================================================================
[env:az-delivery-devkit-v4-ota-http]
;upload_port = 172.30.30.90
upload_port = 192.168.2.62
upload_port = 172.30.30.90
;upload_port = 192.168.2.62
upload_protocol = custom
extra_scripts = upload_ota.py

View File

@ -240,7 +240,7 @@ void MqttClient::publishDiscovery() {
"\"state_topic\":\"" MQTT_TOPIC_STATUS "\","
"\"value_template\":\"{{ value_json.laser_active }}\","
"\"payload_on\":\"True\",\"payload_off\":\"False\","
"\"device_class\":\"running\",%s,%s}", av, dev);
"%s,%s}", av, dev);
_client->publish(t, p, true);
vTaskDelay(pdMS_TO_TICKS(50));
@ -528,6 +528,7 @@ void MqttClient::onMessage(const char* topic, byte* payload, unsigned int length
LOG_I("MQTT", "CMD reset_session_nvs -> laserTracker.resetTotal()");
laserTracker.resetTotal();
mqttClient.resetSessionCounter();
mqttClient.publishHeartbeat();
}
// {"reset_session_ram":true} nur RAM-Session-Summe auf 0, NVS bleibt
@ -536,6 +537,7 @@ void MqttClient::onMessage(const char* topic, byte* payload, unsigned int length
LOG_I("MQTT", "CMD reset_session_ram -> laserTracker.resetSessionSum()");
laserTracker.resetSessionSum();
mqttClient.resetSessionCounter();
mqttClient.publishHeartbeat();
}
// {"display":true/false} Display ein-/ausschalten
@ -544,6 +546,8 @@ void MqttClient::onMessage(const char* topic, byte* payload, unsigned int length
bool on = vDisplay.as<bool>();
display.setEnabled(on);
LOG_I("MQTT", "CMD display -> %s", on ? "an" : "aus");
// Sofortiges Feedback an HA (kein 60s warten auf naechsten Heartbeat)
mqttClient.publishHeartbeat();
}
// {"reboot":true} ESP32 neu starten