[Configuration] Pakedge/Control4 P20 and P20E Integration

Hi All,

Thought I would post this in case anyone else sets their eyes on a cheap P20 or P20E on eBay (or already has one) and wants to integrate it with Home Assistant.

With the assistance of Emzi there is now support for monitoring and controlling all 20 outlets, the two current reading groups, the system uptime, the temperature and the optional humidity sensor if installed.

Demo: https://youtube.com/shorts/jkQ3FH9xix8

switch:
  - platform: snmp
    name: PDU Outlet 1
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.1.0
    payload_on: 1
    payload_off: 0
  
  - platform: snmp
    name: PDU Outlet 2
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.2.0
    payload_on: 1
    payload_off: 0
  
  - platform: snmp
    name: PDU Outlet 3
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.3.0
    payload_on: 1
    payload_off: 0  
    
  - platform: snmp
    name: PDU Outlet 4
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.4.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 5
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.5.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 6
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.6.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 7
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.7.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 8
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.8.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 9
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.9.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 10
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.10.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 11
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.11.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 12
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.12.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 13
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.13.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 14
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.14.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 15
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.15.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 16
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.16.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 17
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.17.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 18
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.18.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 19
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.19.0
    payload_on: 1
    payload_off: 0
    
  - platform: snmp
    name: PDU Outlet 20
    host: <YOUR PDU'S IP ADDRESS>
    community: private
    baseoid: 1.3.6.1.4.1.39221.3.2.1.20.0
    payload_on: 1
    payload_off: 0

sensor:
  - platform: snmp
    name: PDU Uptime
    host: <YOUR PDU'S IP ADDRESS>
    baseoid: 1.3.6.1.2.1.1.3.0
    value_template: >-
        {% set total_secs = (value | int) / 100 %}
        {% set days = total_secs / 60 / 60 / 24 %}
        {% set hours = (days - (days | int)) * 24 %}
        {% set mins = (hours - (hours | int)) * 60 %}
        {% set secs = ((mins - (mins | int)) * 60) %}
        {{ days | int }}d {{ hours | int }}h {{ mins | int }}m {{ secs | int }}s
    
  - platform: snmp
    name: PDU Group A Current
    host: <YOUR PDU'S IP ADDRESS>
    baseoid: 1.3.6.1.4.1.39221.3.1.3.0
    device_class: current
    unit_of_measurement: A
    value_template: "{{ value | float / 1000 }}"
    
  - platform: snmp
    name: PDU Group B Current
    host: <YOUR PDU'S IP ADDRESS>
    baseoid: 1.3.6.1.4.1.39221.3.1.4.0
    device_class: current
    unit_of_measurement: A
    value_template: "{{ value | float / 1000 }}"

  - platform: snmp
    name: PDU System Temperature
    host: <YOUR PDU'S IP ADDRESS>
    baseoid: 1.3.6.1.4.1.39221.3.1.5.0
    device_class: temperature
    unit_of_measurement: "°C"
    value_template: "{{ value | float / 100 }}"

  # This requires an external RH sensor to be installed
  #- platform: snmp
  #  name: PDU System Relative Humidity
  #  host: <YOUR PDU'S IP ADDRESS>
  #  baseoid: 1.3.6.1.4.1.39221.3.1.7.0
  #  device_class: humidity
  #  unit_of_measurement: "%"

You’ll need to ensure SNMP is enabled on your PDU and that the two communities are set to public and private (unless you wish to change those in the YAML)

Hope this helps someone!

That is a massive help!
I am trying to move from a commercial control system and was beginning to muck around with Telnet to control my P20 but was having trouble trying to do it without a log in.

I am not that familiar with snmb or home assistant.
Could you give me a few pointers to how I actually get this to work. Not sure what to do with the pakedge mib file.

Thanks

Rozza1

Hey, sorry I did not see your reply sooner!

The MIB file can be loaded into an MIB browser with support for SNMP and is purely used to describe what each of the SNMP endpoints are for. The endpoints shown in my configuration above are all you really need to know and can be used straight away. All you need to do is point it at the IP address of your unit.

The MIB is not required for the configuration to work as the MIB would just be used to find which endpoints are for what. The configuration has already labelled what each endpoint is so that’s already been dealt with.

Best of luck!

Thanks so much.
Have it up and running now. Your code makes it almost too easy.
Thanks again was about to scrap my Packedge as the Telnet interface is so unreliable. This has been up and working flawlessly.

Thanks again