116 lines
2.2 KiB
YAML
116 lines
2.2 KiB
YAML
esphome:
|
|
name: seeed-studio
|
|
friendly_name: seeed studio
|
|
on_boot:
|
|
then:
|
|
- output.turn_on: DE_RE
|
|
|
|
esp32:
|
|
board: esp32-s3-devkitc-1
|
|
framework:
|
|
type: arduino
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: "1tRYVfsGzt8mFr+ay9hE24pdPd8IACedduh9tLWg4xs="
|
|
|
|
ota:
|
|
- platform: esphome
|
|
password: "d68060a1d18b9d61354434595717070c"
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: "Seeed-Studio Fallback Hotspot"
|
|
password: "FrTglhXBIVqi"
|
|
|
|
captive_portal:
|
|
|
|
output:
|
|
- platform: gpio
|
|
pin: GPIO21 # Led de la carte
|
|
id: led_output
|
|
- platform: gpio
|
|
pin: GPIO3 # le pin connecté à DE/RE
|
|
id: DE_RE
|
|
|
|
switch:
|
|
- platform: output
|
|
name: "LED"
|
|
output: led_output
|
|
id: led_switch
|
|
restore_mode: ALWAYS_OFF
|
|
|
|
interval:
|
|
- interval: 5s
|
|
then:
|
|
- switch.toggle: led_switch
|
|
- logger.log: "rbo2"
|
|
|
|
uart:
|
|
id: mod_bus_id
|
|
tx_pin: GPIO44 # Il faut les inverser !!!!
|
|
rx_pin: GPIO43
|
|
baud_rate: 4800
|
|
debug:
|
|
direction: BOTH
|
|
dummy_receiver: false
|
|
after:
|
|
delimiter: "\n"
|
|
sequence:
|
|
- lambda: UARTDebug::log_string(direction, bytes);
|
|
|
|
modbus:
|
|
id: modbus1
|
|
uart_id: mod_bus_id
|
|
|
|
modbus_controller:
|
|
- id: modbus_controller1
|
|
address: 1
|
|
modbus_id: modbus1
|
|
setup_priority: -10
|
|
command_throttle: 2s
|
|
update_interval: 4s
|
|
|
|
sensor:
|
|
- platform: modbus_controller
|
|
id: sensor1
|
|
modbus_controller_id: modbus_controller1
|
|
name: "Wind speed"
|
|
device_class: wind_speed
|
|
register_type: holding
|
|
address: 0
|
|
unit_of_measurement: "m/s"
|
|
value_type: U_WORD
|
|
accuracy_decimals: 1
|
|
filters:
|
|
- multiply: 0.1
|
|
- max:
|
|
window_size: 1
|
|
send_every: 1
|
|
- min:
|
|
window_size: 1
|
|
send_every: 1
|
|
# - exponential_moving_average:
|
|
# alpha: 0.1
|
|
# send_every: 12
|
|
on_value:
|
|
then:
|
|
- mqtt.publish:
|
|
topic: "rbo2"
|
|
payload: !lambda 'return to_string(x);'
|
|
|
|
mqtt:
|
|
broker: "pc-raymond.home"
|
|
id: mqtt1
|
|
log_topic: rbo
|
|
birth_message:
|
|
topic: rbo2
|
|
payload: 'send_every: 1 !' |