ESPHome - configuration JetHub E1-PD76-R5 (v1)
Controller configuration JetHub E1-PD76-R5 (v1) for ESPHome.
Contents
Configuration
- This configuration implements:
Setting up Ethernet with automatic IP address detection.
Integration with Home Assistant.
Setting the LEDs
STAT
(red and green).Control of all relays.
Event detection from the
FN
button .Detection of events from all discrete inputs.
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.
Hint
:download:` Download jethub_e1_pd76_r5_v1.yaml <jethub_e1_pd76_r5_v1.yaml>`
1esphome:
2 name: e1-pd76-r5
3 platform: ESP32
4 board: nodemcu-32s
5 name_add_mac_suffix: true # This option adds MAC address to the end of the device name
6
7## WARNING: Disable WiFi and captive_portal if Ethernet enabled
8#wifi:
9# ssid: "***"
10# password: "***"
11#
12# # Enable fallback hotspot (captive portal) in case wifi connection fails
13# ap:
14# ssid: "JetHub E1 Fallback Hotspot"
15# password: "***"
16#
17#captive_portal:
18
19# Enable Ethernet
20ethernet:
21 type: LAN8720
22 mdc_pin: GPIO23
23 mdio_pin: GPIO18
24 clk_mode: GPIO17_OUT
25 phy_addr: 1
26
27# Enable logging
28logger:
29
30# Enable Home Assistant API
31api:
32
33# Enable OTA firmware update
34ota:
35
36# Enable I2C bus
37i2c:
38 sda: 5
39 scl: 4
40 frequency: 400kHz
41 scan: true
42 id: i2c1
43
44# Enable UART1
45uart:
46 - tx_pin: 33
47 rx_pin: 34
48 baud_rate: 115200
49 id: uart_1
50
51# Enable I2C GPIO expanders
52pcf8574:
53 - id: cpu_gpio_exp
54 address: 0x20
55 pcf8575: true
56 - id: mb_gpio_exp
57 address: 0x22
58 pcf8575: true
59
60# Enable digital outputs: LEDs and relays
61switch:
62 - platform: gpio
63 name: "Red LED"
64 id: red_led
65 pin:
66 pcf8574: cpu_gpio_exp
67 number: 0
68 mode: OUTPUT
69 inverted: true
70 - platform: gpio
71 name: "Green LED"
72 id: green_led
73 pin:
74 pcf8574: cpu_gpio_exp
75 number: 1
76 mode: OUTPUT
77 inverted: true
78 - platform: gpio
79 name: "Relay 1"
80 id: relay_1
81 pin:
82 pcf8574: mb_gpio_exp
83 number: 8
84 mode: OUTPUT
85 inverted: true
86 - platform: gpio
87 name: "Relay 2"
88 id: relay_2
89 pin:
90 pcf8574: mb_gpio_exp
91 number: 9
92 mode: OUTPUT
93 inverted: true
94 - platform: gpio
95 name: "Relay 3"
96 id: relay_3
97 pin:
98 pcf8574: mb_gpio_exp
99 number: 10
100 mode: OUTPUT
101 inverted: true
102 - platform: gpio
103 name: "Relay 4"
104 id: relay_4
105 pin:
106 pcf8574: mb_gpio_exp
107 number: 11
108 mode: OUTPUT
109 inverted: true
110 - platform: gpio
111 name: "Relay 5"
112 id: relay_5
113 pin:
114 pcf8574: mb_gpio_exp
115 number: 12
116 mode: OUTPUT
117 inverted: true
118
119# Enable inputs: button and discrete inputs
120binary_sensor:
121 - platform: gpio
122 name: "FN button"
123 pin:
124 number: 0
125 inverted: true
126 - platform: gpio
127 name: "Input 1"
128 pin:
129 pcf8574: mb_gpio_exp
130 number: 0
131 inverted: false
132 - platform: gpio
133 name: "Input 2"
134 pin:
135 pcf8574: mb_gpio_exp
136 number: 1
137 inverted: false
138 - platform: gpio
139 name: "Input 3"
140 pin:
141 pcf8574: mb_gpio_exp
142 number: 2
143 inverted: false
144 - platform: gpio
145 name: "Input 4"
146 pin:
147 pcf8574: mb_gpio_exp
148 number: 3
149 inverted: false
150 - platform: gpio
151 name: "Input 5"
152 pin:
153 pcf8574: mb_gpio_exp
154 number: 4
155 inverted: false
156 - platform: gpio
157 name: "Input 6"
158 pin:
159 pcf8574: mb_gpio_exp
160 number: 5
161 inverted: false
Explanations
Note
This section describes explanations only for options that differ from the standard for the E1-CPU processor module.
Relay
The relays are connected to the port expander on the peripheral board.
Inverse logic is used to control the relays:
# Enable digital outputs: LEDs and relays
switch:
- platform: gpio
name: "Relay 1"
id: relay_1
pin:
pcf8574: mb_gpio_exp
number: 8
mode: OUTPUT
inverted: true
- platform: gpio
name: "Relay 2"
id: relay_2
pin:
pcf8574: mb_gpio_exp
number: 9
mode: OUTPUT
inverted: true
- platform: gpio
name: "Relay 3"
id: relay_3
pin:
pcf8574: mb_gpio_exp
number: 10
mode: OUTPUT
inverted: true
- platform: gpio
name: "Relay 4"
id: relay_4
pin:
pcf8574: mb_gpio_exp
number: 11
mode: OUTPUT
inverted: true
- platform: gpio
name: "Relay 5"
id: relay_5
pin:
pcf8574: mb_gpio_exp
number: 12
mode: OUTPUT
inverted: true
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:
pcf8574: mb_gpio_exp
number: 0
inverted: false
- platform: gpio
name: "Input 2"
pin:
pcf8574: mb_gpio_exp
number: 1
inverted: false
- platform: gpio
name: "Input 3"
pin:
pcf8574: mb_gpio_exp
number: 2
inverted: false
- platform: gpio
name: "Input 4"
pin:
pcf8574: mb_gpio_exp
number: 3
inverted: false
- platform: gpio
name: "Input 5"
pin:
pcf8574: mb_gpio_exp
number: 4
inverted: false
- platform: gpio
name: "Input 6"
pin:
pcf8574: mb_gpio_exp
number: 5
inverted: false