Hello everyone, i hope this is something interesting and someone can help me out.
I have a little apiary in the country and because i live in town i don’t always have time to go there to give a check soi’m trying to automate what is the minimum( other important checks on life status are done in person obviously) so i built a little prototype with what i had.
I built a scale with 4 50Kg load cells and mounted them on a aluminum frame and using an esp-wroom-32 i was able to read the weight, i proceeded attaching an AHT20 sensor to be installed inside the hive and a DHT22 for the outside and everything is working very well.
Searching around i was able to fing a useful code snippet to make a tare for the hive, even empty this weights a lot!
Now i was wondering, because when is time to harvest honey i have to put on top of the hive another box, is there a way to create a sort of switches to select the tare?
I mean, having the weight of the hive and the other box is possible to create switches to select what i need to tare like in winter i select only the hive and when is spring/summer i can select 1 or 2 boxes to tare?
i attache the current code and the UI
esphome:
name: b-traq-dev
friendly_name: b-traq-dev
min_version: 2024.11.0
name_add_mac_suffix: false
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
api:
encryption:
key: !secret api
# Allow Over-The-Air updates
ota:
- platform: esphome
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.210
subnet: 255.255.255.0
gateway: 192.168.1.1
ap:
ssid: "b-traq-dev"
password: ""
# cannot be 0, if no wifi a reset will occur after this timeout
ap_timeout: 60min
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
i2c:
sda: GPIO21
scl: GPIO22
scan: true
id: bus_a
#dichiarazione sensori
sensor:
# potenza segnale wifi
- platform: wifi_signal
name: "segnale wifi"
update_interval: 10s
# sensore peso con celle di carico hx711
- platform: hx711
name: "HX711 Value"
dout_pin: GPIO19
clk_pin: GPIO18
gain: 128
filters:
- calibrate_linear:
- 230234 -> 0
- 283470 -> 2.31
- lambda: |-
id(weigth_no_tare).publish_state(x);
return (x - id(weigth_tare));
unit_of_measurement: kg
accuracy_decimals: 1
update_interval: 10s
#sensore T/H esterna
- platform: dht
pin: GPIO4
temperature:
name: "Temperatura esterna"
humidity:
name: "Umidità esterna"
accuracy_decimals: 1
update_interval: 10s
#sensore T/H interna
- platform: aht10
variant: AHT20
temperature:
name: "Temperatura interna"
humidity:
name: "Umidità interna"
accuracy_decimals: 1
update_interval: 10s
#definizioni per tara sensore peso
- platform: template
id: weigth_no_tare
internal: True
globals:
- id: weigth_tare
type: float
restore_value: False
initial_value: '0.0'
button:
- platform: template
id: weigth_tare_set
name: 'Tare'
on_press:
- lambda: id(weigth_tare) = id(weigth_no_tare).state;