ESPHome 2025.5.0
Loading...
Searching...
No Matches
wifi_signal_sensor.h
Go to the documentation of this file.
1#pragma once
2
7#ifdef USE_WIFI
8namespace esphome {
9namespace wifi_signal {
10
12 public:
13 void update() override { this->publish_state(wifi::global_wifi_component->wifi_rssi()); }
14 void dump_config() override;
15
16 std::string unique_id() override { return get_mac_address() + "-wifisignal"; }
17 float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
18};
19
20} // namespace wifi_signal
21} // namespace esphome
22#endif
This class simplifies creating components that periodically check a state.
Definition component.h:301
Base-class for all sensors.
Definition sensor.h:57
void publish_state(float state)
Publish a new state to the front-end.
Definition sensor.cpp:39
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition component.cpp:26
WiFiComponent * global_wifi_component
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string get_mac_address()
Get the device MAC address as a string, in lowercase hex notation.
Definition helpers.cpp:726