esphome:
name: hankerila-ea8
esp32:
variant: esp32
framework:
type: esp-idf
logger:
api:
ota:
- platform: esphome
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk:
pin: GPIO17
mode: CLK_OUT
phy_addr: 0
output:
- platform: mcp4725
address: 0x60
min_power: 0
max_power: 1
id: dac_output
i2c_id: bus_a
ads1115:
- address: 0x48
i2c_id: bus_a
one_wire:
- platform: gpio
pin: GPIO14
remote_receiver:
pin: GPIO33
remote_transmitter:
pin: GPIO32
carrier_duty_percent: 50%
pcf8574:
- id: "pcf8574_hub_out_1"
address: 0x24
- id: "pcf8574_hub_in_1"
address: 0x26
switch:
- platform: gpio
name: "a8-relay1"
id: relay1
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "a8-relay2"
id: relay2
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "a8-relay3"
id: relay3
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "a8-relay4"
id: relay4
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "a8-relay5"
id: relay5
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "a8-relay6"
id: relay6
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "a8-relay7"
id: relay7
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "a8-relay8"
id: relay8
pin:
pcf8574: pcf8574_hub_out_1
number: 7
mode: OUTPUT
inverted: true
binary_sensor:
- platform: gpio
name: "a8-input1"
id: input1
on_press:
then:
- switch.toggle: relay1
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input2"
id: input2
on_press:
then:
- switch.toggle: relay2
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input3"
id: input3
on_press:
then:
- switch.toggle: relay3
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input4"
id: input4
on_press:
then:
- switch.toggle: relay4
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input5"
id: input5
on_press:
then:
- switch.toggle: relay5
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input6"
id: input6
on_press:
then:
- switch.toggle: relay6
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input7"
id: input7
on_press:
then:
- switch.toggle: relay7
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "a8-input8"
id: input8
on_press:
then:
- switch.toggle: relay8
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
sensor:
- platform: ads1115
multiplexer: 'A0_A1'
gain: 6.144
name: "SCT013-30A-1V"
update_interval: 5s
- platform: ads1115
id: ads1115_02
multiplexer: 'A2_GND'
gain: 6.144
name: "0-5V"
update_interval: 2s
- platform: ads1115
id: ads1115_03_raw
multiplexer: 'A3_GND'
gain: 6.144
update_interval: 2s
internal: true
on_value:
then:
- lambda: |-
// Sampling resistor value in ohms
const float sampling_resistor = 200.0;
// Convert voltage to current in milliamperes
float current = (id(ads1115_03_raw).state / sampling_resistor) * 1000;
// Publish the converted current value to the custom sensor
id(ads1115_03_current).publish_state(current);
- platform: template
id: ads1115_03_current
name: "0-20mA"
unit_of_measurement: "mA"
accuracy_decimals: 2
state_class: measurement
- platform: dallas_temp
address: 0x1c00000123456789
name: "ds18b20-1"