Gude Systems PDU 8035 series integration via MQTT: Part 2 - Preparation
Look for the main article at Gude Systems PDU 8035 series integration via MQTT: Part 1 - Introduction
Preparation
Step 1 - Get your mqtt broker details
I assume you use the mqtt broker that comes with HA.
Get the:
- ip address of the mqtt broker (normally the ip address of your HA),
- mqtt username and password that you and HA are using to login to the mqtt broker.
If you panic on that one, watch this instruction on YouTube https://youtu.be/sfsZF0R0HtE.
Step 2 - PDU: configure mqtt
- Login to the WebGUI of your PDU, click on the tab
Configuration > Protocols > MQTT
At least fill in: - Broker: the ip address of your broker instance,
- TCP port: (leave default),
- Username: your mqtt username,
- Set new password: the password of your mqtt user,
repeat password: same as above, - Topic Prefix: stick to de/gudesystems/epc/[mac],
(write down the mac address that is shown here. You need it later), - Permit CLI commands: yes,
Very important since HA will control the PDU by using cli commands, - Publish device data summary interval: 60
(In my case this means that each 60 seconds telemetry data is published on mqtt topicde/gudesystems/epc/00:19:32:02:4f:40).
Click on Apply to save this configuration.
When you are here, also make note of the ip address of your PDU.
Check your connection
Now would be a good time to check if your PDU is able to connect to your mqtt broker by using – for instance – the MQTT Explorer (More information on how to get, install and use the MQTT Explorer in HA can be found here https://community.home-assistant.io/t/addon-mqtt-explorer-new-version/603739).
When your PDU is able to connect, you see in MQTT Explorer a topic called de/gudesystems/epc/[mac]/device/telemetry, in my case de/gudesystems/epc/00:19:32:02:4f:40/device/telemetry.
If you don’t see this after two minutes or so, you need to start troubleshooting before you can continue.
Step 2b - PDU: Check your Power Port label and delay settings
In the WebGUI of your PDU, go to Configuration > Power Ports. Here, I can set parameters on a per port base of the 8035 PDU as shown below.
You can set the label of a port (a description that makes sense to you), but more important is the Coldstart section. Coldstart means: “when the PDU boots, what will happen with this outlet and when?”. In the picture shown here, the outlet will be turned on 35 seconds after the PDU is ready after a boot.
Coldstart delay (2) vs Reset action duration (3)
When the PDU is powered on, the Coldstart delay (2) is used to delay an action that is set in Coldstart status for a port.
When a port is power cycled, the Reset action duration (3) is used to switch on a port again.
How to calculate values (2) and (3)?
My script sets the Reset action duration (3) value automatically for each port. The Coldstart delay (2), you have to set yourself. To calculate the value for Coldstart delay: determine the time in seconds after an outlet has to be turned on + 30 seconds (see text below why).
Most network equipment use a switched power supply. Switched power supplies don’t like to be switched off and immediately turn back on. This is due capacitors inside a switched power supply that are not yet discharged enough. As a rule of thumb, wait 30 seconds before turning of a switched power supply after it has switched off.
Step 3 - Before you can use the MQTT discovery script,
You need to change a few things before you can use my script code for your PDU.
Things that need to be changed are:
- ip address of the PDU
- mac address of the PDU
Get my script code (see part 3) and copy and paste it in your favorite text or YAML editor.
Get the ip and mac address of your PDU that you wrote down in step 2.
Write the mac address of your PDU in two formats:
like this: 001932024f40
and like this: 00:19:32:02:4f:40.
To replace, open my MQTT script in Home Assistant, switch to Edit in YAML, and, in your favorite text editor, find and replace this 001932024f40 and this 00:19:32:02:4f:40 by yours.
Get the ip address your PDU has. Find and replace http://10.10.10.91 with your ip address.
If you use a different device
If your PDU has a different amount of ports, look in my script for
for_each: "{{ range(1,9) | list}}"
and change 9 to the number of ports + 1.
For example: the 8035 has 8 outlets, so 8 + 1 = 9
If your PDU does not have the per port power and current feature, simply disable the script sections Define Sensors - Per outlet (1 through 8): Power measurement and Define Sensors - Per outlet (1 through 8): Current measurement.
Step 3b Install the script in HA
In HA go to Settings > Automations & scenes > Scripts, click on Create script and select Create new script.
Click on the three dots and select Edit in YAML from the submenu.
Copy and paste the altered script code form your editor to HA.
Save the script and your are done.
Check and troubleshoot the script
The script is set up as a script bundle that bundles different actions together. When you click on the three dots right of an action, you can select run action to see if the action runs successfully.
When you go in HA to Settings > Devices & services > Integrations > MQTT, you normally will see your PDU appear. When you click on your PDU, you see the entities that are created so far.
Step 4 - Create an input.boolean variable
You can create input.boolean variables in the GUI, but you can’t set the initial value in the UI, hence I create this in configuration.yaml of HA.
Open the configuration.yaml of HA (I use Studio Code Server) and add the code below
pdu_mqtt_telemetry_received:
name: PDU MQTT telemetry received
initial: false
icon: mdi:email-open-outline
Save the file and check via HA > Developer Tools > Check configuration if your configuration.yaml prevent HA from starting.
While you are there, you can announce this variable to HA by clicking on Input booleans under YAML configuration reloading, or just reboot HA.
Step 5 - Before you can use the automation script
Modifying the automation script goes in the same way as for the script in step 3. Copy and paste my script code (see part 4) in your favorite text or YAML editor. Search and replace for 00:19:32:02:4f:40 and replace it with the mac address of your device.
Step 5b Install the automation in HA
In HA go to Settings > Automations & scenes > Automations and click on Create automation and select Create new automation.
Click on the three dots and select Edit in YAML from the submenu. Copy and paste the altered script code form your editor to HA. Save the script and your are done.
Step 6 - Before you can use the PDU dashboard
For some reason, power measurement sensor for outlet 1 is called sensor.none_pdu_outlet_1_power, while it should be sensor.pdu_8035_3_r2_pdu_outlet_1_power.
Since I don’t have enough experience as a developer, I don’t know what causes this naming artifact. When the power reading for outlet 1 is unknown, you now know what to change.
Step 6b - Add the PDU dashboard to HA
In HA go to Settings > Dashboards click on Add dashboard and select New dashboard from scratch.
As Title, use PDU (or something else)
Select Admin only and Add to sidebar.
Confirm by clicking on Create.
Open dashboard, click on the pencil icon top right and then on the three dots. Select raw configuration editor from the submenu.
Copy and paste my dashboard code (see part 5 here and click on save.
A note in regard to the dashboard code
The complete dashboard code is too large to fit into an article on this forum, hence the code provided is a trimmed version: it is complete, except for outlets 3 through 8. Getting those is simply a matter af duplicating outlet 2 and adapt number of each entry id.
if you use a PDU without per port power and current measurement, you can delete column 3 and 4 altogether of an horizontal stack that I used per outlet.

