ESPHome  2024.10.2
wifi_signal_sensor.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/helpers.h"
7 #ifdef USE_WIFI
8 namespace esphome {
9 namespace 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
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition: component.cpp:26
This class simplifies creating components that periodically check a state.
Definition: component.h:283
std::string get_mac_address()
Get the device MAC address as a string, in lowercase hex notation.
Definition: helpers.cpp:691
void publish_state(float state)
Publish a new state to the front-end.
Definition: sensor.cpp:39
WiFiComponent * global_wifi_component
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57