Files
esphome-yambms/packages/base/device_base_wifi.yaml
T

93 lines
2.8 KiB
YAML

# Updated : 2026.02.01
# Version : 1.2.4
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
# This YAML is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
substitutions:
# The ID of the LED on your board used for this component
network_status_led_id: "esp_light"
# ID for this component instance for fault registry
network_fault_device_id: "1"
esphome:
on_boot:
- priority: 600.0
then:
- lambda: |-
// Register System
id(global_register_led)(${CAT_NETWORK}, ${network_fault_device_id}, id(${network_status_led_id}));
sensor:
# https://esphome.io/components/sensor/wifi_signal
- platform: wifi_signal
name: WiFi power
id: esp32_wifi_power
device_id: ${board_id}
update_interval: 30s
entity_category: diagnostic
# Reports the WiFi signal strength in %
- platform: template
name: WiFi power percentage
id: esp32_wifi_power_percent
device_id: ${board_id}
update_interval: 30s
unit_of_measurement: '%'
icon: mdi:wifi
entity_category: diagnostic
accuracy_decimals: 0
lambda: |-
float wifi_power_dbm = id(esp32_wifi_power).state;
return min(max(2 * (wifi_power_dbm + 100.0), 0.0), 100.0);
text_sensor:
# https://esphome.io/components/text_sensor/wifi_info
- platform: wifi_info
ip_address:
name: IP address
id: esp32_ip_address
device_id: ${board_id}
ssid:
name: connected SSID
id: esp32_connected_ssid
device_id: ${board_id}
bssid:
name: connected BSSID
id: esp32_connected_bssid
device_id: ${board_id}
mac_address:
name: MAC address
id: esp32_mac_address
device_id: ${board_id}
scan_results:
name: latest scan results
id: esp32_latest_scan_results
device_id: ${board_id}
dns_address:
name: DNS address
id: esp32_dns_address
device_id: ${board_id}
interval:
- interval: 5s
then:
- lambda: |-
// network::is_connected() can be used for wifi or ethernet.
// It returns true if Ethernet or WiFi has a valid Link + IP.
bool x = network::is_connected();
id(global_update_fault)(${CAT_NETWORK}, ${network_fault_device_id}, !x);