I’ve got an old scale project I’m trying to get going again, and I’m getting a warning that the api is taking too long.
[15:04:30][W][component:237]: Component api took a long time for an operation (576 ms).
Is there anything standing out that might be causing the issue, or is this an issue with the HX711 and I just have to live with it?
esphome:
name: bed-hx711b
on_boot:
- delay: 5s
- logger.log:
format: "test is %0f"
args: [ '666']
includes:
- "custom_hx711.h"
libraries:
- "https://github.com/bogde/HX711"
ota:
- platform: esphome
id: my_ota
password: !secret ota_password
esp8266:
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
reboot_timeout: 0s
fast_connect: true
manual_ip:
static_ip: 172.16.68.72
gateway: 172.16.68.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Bed-Hx711B Fallback Hotspot"
password: "3IexvKFhv5qd"
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
captive_portal:
sensor:
- platform: hx711
name: "HX711 Value"
dout_pin: D2
clk_pin: D3
# ... Other HX711 options
gain: 128
update_interval: 2s
unit_of_measurement: lbs
filters:
- calibrate_linear:
- -4516200 -> 0
- -4579200 -> 10
- lambda: |-
id(weight_no_tare).publish_state(x);
return (x - id(weight_tare));
- platform: template
id: weight_no_tare
internal: True
globals:
- id: weight_tare
type: float
restore_value: False
initial_value: '0.0'
button:
- platform: template
id: weight_tare_set
name: 'Tare'
on_press:
- lambda: id(weight_tare) = id(weight_no_tare).state;
- logger.log: "Hello World Tare"
- platform: restart
id: scale_restart
name: "Restart Button"
on_press:
- logger.log: "Restart Button Hello World"
switch:
- platform: restart
id: scale_switch
name: "Restart Switch"
on_turn_on:
- logger.log: "Restart Switch Hello World"