Open geiseri opened 3 years ago
@geiseri , I tried using your AXP integration but I am always running into an error that 'Component sensor.axp192 requires component axp192.'
This is using the axp192
component copied into the custom_components folder, and using the provided m5stick.yaml
INFO Reading configuration m5stickc.yaml...
WARNING ESP32: Pin 10 (9-10) might already be used by the flash interface in QUAD IO flash mode.
WARNING ESP32: Pin 10 (9-10) might already be used by the flash interface in QUAD IO flash mode.
WARNING ESP32: Pin 9 (9-10) might already be used by the flash interface in QUAD IO flash mode.
INFO Detected timezone 'CET' with UTC offset 1 and daylight savings time from 28 March 02:00:00 to 31 October 03:00:00
INFO Detected timezone 'CET' with UTC offset 1 and daylight savings time from 28 March 02:00:00 to 31 October 03:00:00
Failed config
sensor.axp192: [source m5stickc.yaml:53]
Component sensor.axp192 requires component axp192.
platform: axp192
address: 52
i2c_id: bus_a
update_interval: 30s
battery_level:
name: M5Stick Battery Level
id: m5stick_batterylevel
any suggestions as to what could be the cause ?
Would love to be able to turn off the display! Thanks for all of your work!
[FYI]Works fine by this yaml:
substitutions:
devicename: m5stickc
upper_devicename: M5Stick-C
esphome:
name: $devicename
platform: ESP32
board: m5stick-c
platformio_options:
upload_speed: 115200
.......
axp192:
- address: 0x34
brightness: 1.0
battery_capacity: 80
binary_sensor:
- platform: gpio
pin:
number: GPIO37
inverted: true
name: ${upper_devicename} Button A
on_press:
then:
- light.turn_on: led1
on_release:
then:
- light.turn_off: led1
- platform: gpio
pin:
number: GPIO39
inverted: true
name: ${upper_devicename} Button B
on_press:
then:
- light.turn_on: led1
on_release:
then:
- light.turn_off: led1
- platform: axp192
axp192_id:
type: PLUGGED
id: axp192_binary_sensor_plugged
name: ${upper_devicename} plugged in
- platform: axp192
axp192_id:
type: CHARGING
id: axp192_binary_sensor_charging
name: ${upper_devicename} charging
- platform: axp192
axp192_id:
type: OVERTEMP
id: axp192_binary_sensor_overtemp
name: ${upper_devicename} overtemp
- platform: axp192
axp192_id:
type: LOW_BATTERY
id: axp192_binary_sensor_low_battery
name: ${upper_devicename} low battery
- platform: axp192
axp192_id:
type: CRITICAL_BATTERY
id: axp192_binary_sensor_critical_battery
name: ${upper_devicename} critical battery
- platform: axp192
axp192_id:
type: CHARGED
id: axp192_binary_sensor_charged
name: ${upper_devicename} charged
sensor:
- platform: axp192
axp192_id:
id: axp192_sensor
name: ${upper_devicename} Battery
- platform: wifi_signal
name: ${upper_devicename} WiFi Signal
id: wifi_dbm
- platform: uptime
name: ${upper_devicename} Uptime
# internal LED
light:
- platform: monochromatic
output: builtin_led
name: ${upper_devicename} Led
id: led1
- platform: axp192
axp192_id:
id: axp192_light
name: ${upper_devicename} Backlight
output:
- platform: ledc
pin: 10
inverted: true
id: builtin_led
remote_transmitter:
- pin:
number: GPIO9
carrier_duty_percent: 50%
id: internal
spi:
clk_pin: GPIO13
mosi_pin: GPIO15
i2c:
- id: bus_a
sda: GPIO21
scl: GPIO22
scan: True
And you have to update this class axp192component.cpp
to :
light::LightTraits AXP192Backlight::get_traits()
{
auto traits = light::LightTraits();
traits.set_supported_color_modes({
light::ColorMode::BRIGHTNESS
});
// traits.set_supports_brightness(true);
return traits;
}
I have moved this development to: https://gitlab.com/geiseri/esphome_extras with various other fixes.
First I apologize for the tons of changes here, and will break it up if you need me to. I just went buckwild last night and wanted a bit of feedback before it got much further out of control:
Todo: