So liebe Leut, ich kann Vollzug verkünden heut.
Kurze Zusammenfassung:
Ich habe mich, notgedrungen, in MQTT und HA eingearbeitet (Youtube und ChatGPT waren meine Mentoren)
Alle 3 PDUs hab ich auf die neueste FW geupdatet die somit auch MQTT anbieten.
In HA das MQTT Mosquitto Broker AddOn installiert, danach die MQTT Integration.
Die verlinkten Seiten von Richard Kimble gaben dann die Grundlage für die yaml Einträge, danke nochmal.
Ob das ganze überhaupt von PDU über MQTT mit HA kommuniziert konnte ich mit MQTT Explorer sehen.
Die configuration.yaml sieht für eine PDU so aus:
mqtt:
switch:
- unique_id: pdu_1_switch_1
name: "PDU 1 Switch 1"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry" # -> delay but inital state data
value_template: "{{ value_json.portstates[0].state }}"
command_topic: "de/gudesystems/epc/00:19:32:01:95:e4/cmd/port/1"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
optimistic: false
qos: 0
retain: true
- unique_id: pdu_1_switch_2
name: "PDU 1 Switch 2"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry" # -> delay but inital state data
value_template: "{{ value_json.portstates[1].state }}"
command_topic: "de/gudesystems/epc/00:19:32:01:95:e4/cmd/port/2"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
optimistic: false
qos: 0
retain: true
- unique_id: pdu_1_switch_3
name: "PDU 1 Switch 3"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry" # -> delay but inital state data
value_template: "{{ value_json.portstates[2].state }}"
command_topic: "de/gudesystems/epc/00:19:32:01:95:e4/cmd/port/3"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
optimistic: false
qos: 0
retain: true
- unique_id: pdu_1_switch_4
name: "PDU 1 Switch 4"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry" # -> delay but inital state data
value_template: "{{ value_json.portstates[3].state }}"
command_topic: "de/gudesystems/epc/00:19:32:01:95:e4/cmd/port/4"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
optimistic: false
qos: 0
retain: true
- unique_id: pdu_1_switch_5
name: "PDU 1 Switch 5"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry" # -> delay but inital state data
value_template: "{{ value_json.portstates[4].state }}"
command_topic: "de/gudesystems/epc/00:19:32:01:95:e4/cmd/port/5"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
optimistic: false
qos: 0
retain: true
- unique_id: pdu_1_switch_6
name: "PDU 1 Switch 6"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry" # -> delay but inital state data
value_template: "{{ value_json.portstates[5].state }}"
command_topic: "de/gudesystems/epc00:19:32:01:95:e4/cmd/port/6"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
optimistic: false
qos: 0
retain: true
- unique_id: pdu_1_switch_7
name: "PDU 1 Switch 7"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry" # -> delay but inital state data
value_template: "{{ value_json.portstates[6].state }}"
command_topic: "de/gudesystems/epc/00:19:32:01:95:e4/cmd/port/7"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
optimistic: false
qos: 0
retain: true
- unique_id: pdu_1_switch_8
name: "PDU 1 Switch 8"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry" # -> delay but inital state data
value_template: "{{ value_json.portstates[7].state }}"
command_topic: "de/gudesystems/epc/00:19:32:01:95:e4/cmd/port/8"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
optimistic: false
qos: 0
retain: true
sensor:
#GUDE PDU: total system power consumption
- unique_id: pdu_1_consumption
name: "PDU 1 Total Consumption"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry"
value_template: "{{ (value_json.line_in[0].voltage * value_json.line_in[0].current) | round(1)}}"
unit_of_measurement: W
- unique_id: pdu_1_voltage
name: "PDU 1 Voltage"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry"
value_template: "{{ (value_json.line_in[0].voltage) | round(1)}}"
unit_of_measurement: V
- unique_id: pdu_1_current
name: "PDU 1 Current"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry"
value_template: "{{ (value_json.line_in[0].current) | round(1)}}"
unit_of_measurement: A
- unique_id: pdu_1_total_energy
name: "PDU 1 Total Energy"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry"
value_template: "{{ (value_json.line_in[0].tot_energy) | round(1)}}"
unit_of_measurement: kWh
- unique_id: pdu_1_res_energy
name: "PDU 1 Resettable Energy"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry"
value_template: "{{ (value_json.line_in[0].res_energy) | round(1)}}"
unit_of_measurement: kWh
- unique_id: pdu_1_res_time
name: "PDU 1 Resettable Time"
state_topic: "de/gudesystems/epc/00:19:32:01:95:e4/device/telemetry"
value_template: "{{ (value_json.line_in[0].res_time) | round(1)}}"
unit_of_measurement: h:m:s
Alles anzeigen
Das was noch verbesserungswürdig ist, wäre der Status der Schalter in HA.
Die reagieren nur auf die Statusmeldung von der PDU auch wenn ich in HA den Knopf drücke.
Status "on" wird erst angezeigt wenn der Meldezyklus von MQTT durchgelaufen ist.
Es müsste doch auch möglich sein den Knopfstatus in HA beim betätigen von selbigen gleich auf "on" zu stellen.