ESPHome - Configuration JetHub E1-PD76-R5-[AC/DC] (v3)

Controller configuration JetHub E1-PD76-R5-AC (v3) and JetHub E1-PD76-R5-DC (v3) for ESPHome.

Note

To build firmware for the JetHub E1-PD76-R5-[AC/DC] (v3) controllers you need ESPHome 2024.6.0 or newer: 2023.11.0 added support for PCA9535 and similar port expanders, and since 2024.6.0 the new ota section syntax (platform: esphome) used in this configuration is in effect.

Configuration

This configuration implements:
  • Setting up Ethernet with automatic IP address detection.

  • Integration with Home Assistant.

  • Setting the LEDs STAT (red and green).

  • Relay setting.

  • Event detection from the FN button .

  • Detection of events from all discrete inputs.

  • 1-wire bus.

Note

Once the controller is loaded and the IP address is obtained, the controller will automatically be available on the Home Assistant running on the same network.

jethub_e1_pd76_r5_v3.yaml
  1esphome:
  2  name: e1-pd76-r5-v3
  3  name_add_mac_suffix: true # This option adds MAC address to the end of the device name
  4
  5esp32:
  6  board: nodemcu-32s
  7  framework:
  8    type: esp-idf
  9
 10## WARNING: Disable WiFi and captive_portal if Ethernet enabled
 11#wifi:
 12#  ssid: "***"
 13#  password: "***"
 14#
 15#  # Enable fallback hotspot (captive portal) in case wifi connection fails
 16#  ap:
 17#    ssid: "JetHub E1 Fallback Hotspot"
 18#    password: "***"
 19#
 20#captive_portal:
 21
 22# Enable Ethernet
 23ethernet:
 24  type: LAN8720
 25  mdc_pin: GPIO23
 26  mdio_pin: GPIO18
 27  clk_mode: GPIO17_OUT
 28  phy_addr: 1
 29
 30# Enable logging
 31logger:
 32
 33# Enable Home Assistant API
 34api:
 35
 36# Enable OTA firmware update
 37ota:
 38  - platform: esphome
 39
 40# Enable internal WEB server
 41web_server:
 42  port: 80
 43
 44# Enable I2C bus
 45i2c:
 46  sda: 5
 47  scl: 4
 48  frequency: 400kHz
 49  scan: true
 50  id: i2c1
 51
 52# Enable UART1
 53uart:
 54  - tx_pin: 33
 55    rx_pin: 34
 56    baud_rate: 115200
 57    id: uart_1
 58
 59# Enable I2C GPIO expanders
 60pca9554:
 61  - id: cpu_gpio_exp
 62    pin_count: 16
 63    address: 0x20
 64  - id: mb_gpio_exp
 65    pin_count: 16
 66    address: 0x22
 67
 68# Enable digital outputs: LEDs and relays
 69switch:
 70  - platform: gpio
 71    name: "Red LED"
 72    id: red_led
 73    pin:
 74      pca9554: cpu_gpio_exp
 75      number: 0
 76      mode: OUTPUT
 77      inverted: false
 78  - platform: gpio
 79    name: "Green LED"
 80    id: green_led
 81    pin:
 82      pca9554: cpu_gpio_exp
 83      number: 1
 84      mode: OUTPUT
 85      inverted: false
 86  - platform: gpio
 87    name: "Relay 1"
 88    id: relay_1
 89    pin:
 90      pca9554: mb_gpio_exp
 91      number: 8
 92      mode: OUTPUT
 93      inverted: false
 94  - platform: gpio
 95    name: "Relay 2"
 96    id: relay_2
 97    pin:
 98      pca9554: mb_gpio_exp
 99      number: 9
100      mode: OUTPUT
101      inverted: false
102  - platform: gpio
103    name: "Relay 3"
104    id: relay_3
105    pin:
106      pca9554: mb_gpio_exp
107      number: 10
108      mode: OUTPUT
109      inverted: false
110  - platform: gpio
111    name: "Relay 4"
112    id: relay_4
113    pin:
114      pca9554: mb_gpio_exp
115      number: 11
116      mode: OUTPUT
117      inverted: false
118  - platform: gpio
119    name: "Relay 5"
120    id: relay_5
121    pin:
122      pca9554: mb_gpio_exp
123      number: 12
124      mode: OUTPUT
125      inverted: false
126
127# Enable inputs: button and discrete inputs
128binary_sensor:
129  - platform: gpio
130    name: "FN button"
131    pin:
132      number: 0
133      inverted: true
134  - platform: gpio
135    name: "Input 1"
136    pin:
137      pca9554: mb_gpio_exp
138      number: 0
139      inverted: false
140  - platform: gpio
141    name: "Input 2"
142    pin:
143      pca9554: mb_gpio_exp
144      number: 1
145      inverted: false
146  - platform: gpio
147    name: "Input 3"
148    pin:
149      pca9554: mb_gpio_exp
150      number: 2
151      inverted: false
152  - platform: gpio
153    name: "Input 4"
154    pin:
155      pca9554: mb_gpio_exp
156      number: 3
157      inverted: false
158  - platform: gpio
159    name: "Input 5"
160    pin:
161      pca9554: mb_gpio_exp
162      number: 4
163      inverted: false
164  - platform: gpio
165    name: "Input 6"
166    pin:
167      pca9554: mb_gpio_exp
168      number: 5
169      inverted: false
170
171# Enable 1-Wire bus on external connector
172one_wire:
173  - platform: gpio
174    pin: GPIO16
175
176## Configure individual sensors
177#sensor:
178#  - platform: dallas_temp
179#    address: 0x1c0000031edd2a28
180#    name: "Livingroom Temperature"

Explanations

Note

This section describes explanations only for options that differ from the standard for the E1-CPU processor module.

Port expander

The JetHub E1-PD76-R5-[AC/DC] (v3) controller uses PCA9535 port expander chips. You can use the driver pca9554:

# Enable I2C GPIO expanders
pca9554:
  - id: cpu_gpio_exp
    pin_count: 16
    address: 0x20
  - id: mb_gpio_exp
    pin_count: 16
    address: 0x22

Relay

The relays are connected to the port expander on the peripheral board.

Direct logic is used to control the relay:

# Enable digital outputs: LEDs and relays
switch:
  - platform: gpio
    name: "Relay 1"
    id: relay_1
    pin:
      pca9554: mb_gpio_exp
      number: 8
      mode: OUTPUT
      inverted: false
  - platform: gpio
    name: "Relay 2"
    id: relay_2
    pin:
      pca9554: mb_gpio_exp
      number: 9
      mode: OUTPUT
      inverted: false
  - platform: gpio
    name: "Relay 3"
    id: relay_3
    pin:
      pca9554: mb_gpio_exp
      number: 10
      mode: OUTPUT
      inverted: false
  - platform: gpio
    name: "Relay 4"
    id: relay_4
    pin:
      pca9554: mb_gpio_exp
      number: 11
      mode: OUTPUT
      inverted: false
  - platform: gpio
    name: "Relay 5"
    id: relay_5
    pin:
      pca9554: mb_gpio_exp
      number: 12
      mode: OUTPUT
      inverted: false

Note

When you change the state of the outputs, after some time (~40 sec) ESPHome automatically saves their state by default and after reboot restores the state of the outputs to the previously saved.

If this functionality is not needed, you must change this function by setting the output state at startup with the option restore_mode, for example:

switch:
  - platform: gpio
    ...
    restore_mode: ALWAYS_OFF
    ...

Discrete inputs

The digital inputs are connected to the port expander on the peripheral board.

Example of a digital input configuration:

# Enable inputs: button and discrete inputs
binary_sensor:
  - platform: gpio
    name: "Input 1"
    pin:
      pca9554: mb_gpio_exp
      number: 0
      inverted: false
  - platform: gpio
    name: "Input 2"
    pin:
      pca9554: mb_gpio_exp
      number: 1
      inverted: false
  - platform: gpio
    name: "Input 3"
    pin:
      pca9554: mb_gpio_exp
      number: 2
      inverted: false
  - platform: gpio
    name: "Input 4"
    pin:
      pca9554: mb_gpio_exp
      number: 3
      inverted: false
  - platform: gpio
    name: "Input 5"
    pin:
      pca9554: mb_gpio_exp
      number: 4
      inverted: false
  - platform: gpio
    name: "Input 6"
    pin:
      pca9554: mb_gpio_exp
      number: 5
      inverted: false

1-Wire

The 1-Wire bus is connected to pin GPIO16 of the microcontroller.

Enable 1-Wire bus in the configuration file:

# Enable 1-Wire bus on external connector
one_wire:
  - platform: gpio
    pin: GPIO16

Note

For each temperature sensor connected to the bus, you must add to the configuration file:

sensor:
  - platform: onewire
    address: 0x28XXXXXXXXXXXXXX
    name: "Livingroom Temperature"

where 0x28XXXXXXXXXXXXXX is the address of the temperature sensor.