MrChristian
(Christian Karl)
September 15, 2020, 1:25pm
1
It is hard to be a newbie and get stuck.
I try to operate a custom i2c device at an esp8266.
Trust me. I have read the docs I found. I googled the whole web. But no success!
If you interested in, I can show all my tries in yaml and headers. It would not help. At the moment I am confused with components and devices, output and outputs, inheritance, float and custom float.
Maybe your working ESP Home custom i2c device config helps me out.
Thank you in advance
Christian
HBK1
(Hbk1)
September 15, 2020, 1:42pm
2
Here is a working example with i2c and dallas:
EDIT: Sorry I did not read “custom” before answer so this is probably not what you asked for…
esphome:
name: rp1
platform: ESP8266
board: esp01_1m
wifi:
ssid: "xxxx"
password: "00000"
output_power: 17.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# i2c sensors
i2c:
sda: 4
scl: 5
scan: True
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "RP1-Button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
name: "RP1-Relay"
pin: GPIO12
id: relay
status_led:
pin:
number: GPIO13
inverted: yes
ads1115:
- address: 0x48
dallas:
- pin: GPIO14
sensor:
- platform: dallas
address: 0xE00517A04E52FF28
name: "RP1-OutTemp"
# Temp and Hum
- platform: bme280
temperature:
name: "RP1-InTemp"
oversampling: 16x
pressure:
name: "RP1-In-Pressure"
humidity:
name: "RP1-In-Humidity"
address: 0x76
update_interval: 60s
- platform: ina219
address: 0x40
shunt_resistance: 0.001 ohm
current:
name: "RP1-SolarAmp"
unit_of_measurement: A
filters:
- multiply: 20
accuracy_decimals: 2
power:
name: "RP1-SolarWatt"
unit_of_measurement: W
filters:
- multiply: 20
accuracy_decimals: 2
bus_voltage:
name: "RP1-SolarVolt"
filters:
- multiply: 1.0
accuracy_decimals: 2
shunt_voltage:
name: "RP1-SolarShunt-mV"
unit_of_measurement: mV
filters:
- multiply: 1000
max_voltage: 32.0V
max_current: 3.2A
update_interval: 5s
# Alog VCC
- platform: adc
pin: VCC
name: "RP1-Vcc-A0"
update_interval: 30s
accuracy_decimals: 2
# Alog in
- platform: ads1115
multiplexer: 'A0_GND'
gain: 6.144
name: "RP1-HouseBatt-Volt"
update_interval: 5s
accuracy_decimals: 2
unit_of_measurement: V
filters:
- multiply: 5.688
- platform: ads1115
multiplexer: 'A1_GND'
gain: 6.144
name: "RP1-CarBatt-Volt"
update_interval: 10s
accuracy_decimals: 2
unit_of_measurement: V
filters:
- multiply: 5.709
- platform: ads1115
multiplexer: 'A2_A3'
gain: 0.256
name: "RP1-Charge-Amp"
update_interval: 1s
accuracy_decimals: 2
unit_of_measurement: A
filters:
- multiply: 2000
- sliding_window_moving_average:
window_size: 5
send_every: 5
CeeCee
(Christian)
September 15, 2020, 5:22pm
3
You probably already checked here? https://esphome.io/custom/i2c.html
MrChristian
(Christian Karl)
September 16, 2020, 11:20am
4
Thank you for your answers.
I can not get the example to work.
My yaml:
esphome:
name: ac_dimmer
platform: ESP8266
board: nodemcuv2
includes: my_custom_component.h # example from the docs
wifi:
ssid: "SSID"
password: "WIFIPASS"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
i2c:
sda: D2
scl: D1
scan: True
light:
- platform: monochromatic
name: "Kitchen Lights"
output: output_component1
output:
- platform: custom
type: float
id: output_component1
lambda: |-
return nullptr;
outputs:
id: custom_float
The compiler keeps claiming:
“ID ‘output_component1’ of type custom::CustomFloatOutputConstructor doesn’t inherit from output::FloatOutput”
I googled this phrase the whole web. Do not know where to read to fix this.
davefi
(Dave)
September 16, 2020, 11:51am
5
I haven’t tried any custom components yet, but from my previous Googling, these are some examples I had book marked:
opened 12:42PM - 03 Jun 19 UTC
Type: I2C
Type: Illuminance
<!-- READ THIS FIRST:
- This is for feature requests only, for issues please g… o to the issues repository.
- Please be as descriptive as possible, especially use-cases that can otherwise not be solved boost the problem's priority.
DO NOT DELETE ANY TEXT from this template! Otherwise the issue may be closed without a comment.
-->
**Describe the problem you have/What new integration you would like**
The TSL2561 is currently supported, however it is discontinued (by adafruit at least) and replaced by the TSL2591.
**Please describe your use case for this integration and alternatives you've tried:**
LUX measurements
**Additional context**
thanks
https://www.reddit.com/r/Esphome/comments/h0d8ly/custom_i2c_sensor_example/
I really like being able to build stuff with ESPHome and esp8266 devices. Now that DarkSky was bought by Apple, I need to look at building a weather station so I can collect my own data. However, one of the most valuable pieces of data that DarkSky gives me is a visibility value, the number of miles you can see or how clear the day is. It varies a lot in my area because of fog. I’m wondering if there’s some way to use sensors with an esp8266 to gather this data automatically.
Anyone know?
Hopefully one of them can help you out!
Here are three examples of custom I2C components I have implemented/collected: https://github.com/exxamalte/esphome-customisations
jayjay
(JJ)
March 4, 2023, 5:52pm
7
Did you not switch the SDA and SCL line to your sensor?