ESPHome  2022.8.0
wifi_signal_sensor.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/helpers.h"
7 
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
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition: component.cpp:24
This class simplifies creating components that periodically check a state.
Definition: component.h:266
std::string get_mac_address()
Get the device MAC address as a string, in lowercase hex notation.
Definition: helpers.cpp:399
void publish_state(float state)
Publish a new state to the front-end.
Definition: sensor.cpp:72
WiFiComponent * global_wifi_component
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:48