You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello im not sure if you can help but im only amateur at best with coding. attached i will show the coding i used
Problem (if i run the blink sketch with the relays on the arduino they work) did this to confirm boards are functioning correctly
when i connect everything up and run it through home assistant (esphome) it shows i2c has been found, and arduino serial logger show pin 2 pulled high, pin 2 pulled low when switch is toggled, however the relay does not do anything.
if i connect a voltage meter whilst all is still plugged in i get 4.83 volts and when the switch is toggled to on i get 0.10 volts
attached is both your code and the esphome code (example i am using to test before changing it)
Edit: i should also mention, if i connect a blue led (all i have) between ground and pin 2 it toggles with everything connected as expected.
power supply is 12v 1amp connected to arduino for testing purposes. As show in diagram at bottom arduino is powering the esp8266 (even separately powered i have the same issue)
esphome:
name: pool-management-system
friendly_name: Pool Management System
includes:
- arduino_port_expander.h
esp8266:
board: nodemcu
# Enable Home Assistant API
api:
encryption:
key: **"REMOVED"**
ota:
password: **"REMOVED"**
wifi:
ssid: **"REMOVED"**
password: **"REMOVED"**
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pool-Management-System"
password: **"REMOVED"**
# define i2c device
# for an ESP8266 SDA is D2 and goes to Arduino's A4
# SCL is D1 and goes to Arduino's A5
i2c:
id: i2c_component
logger:
level: DEBUG
# define the port expander hub, here we define one with id 'expander1',
# but you can define many
custom_component:
- id: expander1
lambda: |-
auto expander = new ArduinoPortExpander(i2c_component, 0x08, true);
return {expander};
# define binary outputs, here we have 4, as the relays are inverse logic
# (a path to ground turns the relay ON), we defined the inverted: true
# option of ESPHome outputs.
output:
- platform: custom
type: binary
lambda: |-
return {ape_binary_output(expander1, 2),
ape_binary_output(expander1, 3),
ape_binary_output(expander1, 4),
ape_binary_output(expander1, 5)};
outputs:
- id: relay_1
inverted: true
- id: relay_2
inverted: true
- id: relay_3
inverted: true
- id: relay_4
inverted: true
# connect lights to the first 2 relays
light:
- platform: binary
id: ceiling_light
name: Ceiling light
output: relay_1
- platform: binary
id: room_light
name: Living room light
output: relay_2
# connect a fan to the third relay
fan:
- platform: binary
id: ceiling_fan
output: relay_3
name: Ceiling fan
# connect a pump to the 4th relay
switch:
- platform: output
name: Tank pump
id: tank_pump
output: relay_4
# define binary sensors, use the Arduino PIN number for digital pins and
# for analog use 14 for A0, 15 for A1 and so on...
binary_sensor:
- platform: custom
lambda: |-
return {ape_binary_sensor(expander1, 7),
ape_binary_sensor(expander1, 8),
ape_binary_sensor(expander1, 9),
ape_binary_sensor(expander1, 10),
ape_binary_sensor(expander1, 14) // 14 = A0
};
binary_sensors:
- id: push_button1
internal: true # don't show on HA
on_press:
- light.toggle: ceiling_light
- id: push_button2
internal: true # don't show on HA
on_press:
- light.toggle: room_light
- id: pir_sensor
name: Living PIR
device_class: motion
- id: window_reed_switch
name: Living Window
device_class: window
- id: garage_door
name: Garage garage
device_class: garage_door
# define analog sensors
sensor:
- platform: custom
lambda: |-
return {ape_analog_input(expander1, 1), // 1 = A1
ape_analog_input(expander1, 2)};
sensors:
- name: LM35 Living room temperature
id: lm35_temp
filters:
# update every 60s
- throttle: 60s
# LM35 outputs 0.01v per ºC, and 1023 means 3.3 volts
- lambda: return x * 330.0 / 1023.0;
- name: Analog A2
id: analog_a2
filters:
- throttle: 2s
Crude sketch of my circuit
The text was updated successfully, but these errors were encountered:
It appears it was a pin 2 issue whether it's with my board or in the coding I'm unsure. Will leave this open in case issues return. Will update after I implement and run it for a few days
I found issue! When ape_analog_input(expander1, 2)}; is listed on esphome, the relay on D2 in not working. Not tested but should be similar on other analog pins.
Also, i try to use ape_analog_input(expander1, 55)}; to read A2 pin but i never receive values. always 41223.00000 in all pins where is readed supperior as 54.
I'm searching the way to make it working. peraps the develloper can help me to do that?
Keshin1988: If you do not use A2 pin, remove it from you esphome and the relay is work fine!
hello im not sure if you can help but im only amateur at best with coding. attached i will show the coding i used
Problem (if i run the blink sketch with the relays on the arduino they work) did this to confirm boards are functioning correctly
when i connect everything up and run it through home assistant (esphome) it shows i2c has been found, and arduino serial logger show pin 2 pulled high, pin 2 pulled low when switch is toggled, however the relay does not do anything.
if i connect a voltage meter whilst all is still plugged in i get 4.83 volts and when the switch is toggled to on i get 0.10 volts
attached is both your code and the esphome code (example i am using to test before changing it)
Edit: i should also mention, if i connect a blue led (all i have) between ground and pin 2 it toggles with everything connected as expected.
power supply is 12v 1amp connected to arduino for testing purposes. As show in diagram at bottom arduino is powering the esp8266 (even separately powered i have the same issue)
Your code
### The Esphome Example Config
Crude sketch of my circuit
The text was updated successfully, but these errors were encountered: