Hello,
I get an error message in the ACS712 sensor section that I can’t solve.
I have the following hardware configuration:
ESP8266 NodeMcu.
I connected an analog multiplexer cd74hc4067 to analog port A0.
I use channels 0-3 at the A- Mux and the addressing is in the code below.
As an additional library I use the
In the ACS612 section, I get
-platform: cd74hc4067
an error message that I can not solve.
Can someone please help me?
Best regards
Achim
here is my code snippet
# Analog Strommessungen an ACS712 Sensoren
- platform: adc
id: adc_sensor
pin: A0
update_interval: 120s
- [u]platform: cd74hc4067[/u]
id: led_1_3000K_power
number: 0
lambda: |-
auto acs712_sensor = new ACS712Sensor();
App.register_component(acs712_sensor);
return {acs712_sensor->current_sensor, acs712_sensor->power_sensor};
sensor: adc_sensor
update_interval: 120s
- name: "Amperes"
unit_of_measurement: A
accuracy_decimals: 2
- name: "Watts"
unit_of_measurement: W
accuracy_decimals: 2
and here is all the code
substitutions:
devicename: bigbox-lightcontrol
upper_devicename: ESP8266_KUECHE_BigBox
device_location: Kueche
device_description: BigBox Lichtsteuerung platform using ESPhome firmware
ipaddress: 192.168.2.102
last_update: "2023-05-15 18:54:12"
esphome:
name: $devicename
friendly_name: BigBox_LightControl
libraries:
- https://github.com/RobTillaart/ACS712.git
includes:
- acs712_component.h
esp8266:
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret ESPHOME_API_KEY
ota:
safe_mode: true
password: !secret HA_OTA_PASSWORD
wifi:
power_save_mode: none # none (default for esp8266), light (default for esp32), high
ssid: !secret WLAN_ASUS_SSID
password: !secret WLAN_ASUS_PASSWORD
manual_ip:
static_ip: !secret ESP8266_KUECHE_BigBox_IP
gateway: !secret WLAN_ASUS_GATEWAY_IP
subnet: !secret WLAN_ASUS_SUBNET
dns1: !secret WLAN_ASUS_DNS1
#fast_connect: on
ap: # Enable fallback hotspot (captive portal) in case wifi connection fails
ssid: "Bigbox-Lightcontrol"
password: !secret WIFI_AP_PASSWORD
# Enable fallback hotspot (captive portal) in case wifi connection fails
web_server:
port: 80
auth:
username: admin
password: admin
# Analog cd74hc4067 16 Channel Mux
cd74hc4067:
- id: cd74hc4067_1
pin_s0: GPIO13
pin_s1: GPIO15
pin_s2: GPIO3
pin_s3: GPIO1
# Sensoren am I2C Bus
i2c:
sensor:
# Pimoroni BME60 Sensor
- platform: bme680
temperature:
name: "LedPanel BME680 Temperatur"
oversampling: 16x
filters:
offset: -0.65
pressure:
name: "LedPanel BME680 Pressure"
humidity:
name: "BME680 Humidity"
filters:
offset: -0.065
gas_resistance:
name: "LedPanel BME680 Gas Resistance"
address: 0x76
update_interval: 60s
# BH1750 Lux/Lumen sensor
- platform: bh1750
name: "LedPanel BH1750 Pflanzenspitze Illuminance"
address: 0x23
update_interval: 60s
# Analog Strommessungen an ACS712 Sensoren
- platform: adc
id: adc_sensor
pin: A0
update_interval: 120s
- platform: cd74hc4067
id: led_1_3000K_power
number: 0
lambda: |-
auto acs712_sensor = new ACS712Sensor();
App.register_component(acs712_sensor);
return {acs712_sensor->current_sensor, acs712_sensor->power_sensor};
sensor: adc_sensor
update_interval: 120s
- name: "Amperes"
unit_of_measurement: A
accuracy_decimals: 2
- name: "Watts"
unit_of_measurement: W
accuracy_decimals: 2
- platform: cd74hc4067
id: led_2_3000K_power
number: 1
sensor: adc_sensor
update_interval: 3600s
- platform: cd74hc4067
id: led_1_620nm_power
number: 1
sensor: adc_sensor
update_interval: 3600s
- platform: cd74hc4067
id: led_2_620nm_power
number: 1
sensor: adc_sensor
update_interval: 3600s
# 2 HauptLED schalten nur On/Off
binary_sensor:
- platform: gpio
pin:
number: GPIO14
mode:
input: true
pullup: true
inverted: true
name: "Button LED 1"
- platform: gpio
pin:
number: GPIO12
mode:
input: true
pullup: true
inverted: true
name: "Button LED 2"
switch:
- platform: gpio
name: "2CH Relay 1"
pin: GPIO14
- platform: gpio
name: "2CH Relay 2"
pin: GPIO12
edit:
i think i found a solution… i try to use only the cd74hc4067 lib amd some filters… maybe thatts the right way