mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-01 02:28:28 +02:00
add mac address to wifi info (#1030)
* add mac address to wifi info * add test * lint
This commit is contained in:
committed by
GitHub
parent
8040e3cf95
commit
6123cb7c69
@@ -1,7 +1,7 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import text_sensor
|
||||
from esphome.const import CONF_BSSID, CONF_ID, CONF_IP_ADDRESS, CONF_SSID
|
||||
from esphome.const import CONF_BSSID, CONF_ID, CONF_IP_ADDRESS, CONF_SSID, CONF_MAC_ADDRESS
|
||||
from esphome.core import coroutine
|
||||
|
||||
DEPENDENCIES = ['wifi']
|
||||
@@ -10,6 +10,7 @@ wifi_info_ns = cg.esphome_ns.namespace('wifi_info')
|
||||
IPAddressWiFiInfo = wifi_info_ns.class_('IPAddressWiFiInfo', text_sensor.TextSensor, cg.Component)
|
||||
SSIDWiFiInfo = wifi_info_ns.class_('SSIDWiFiInfo', text_sensor.TextSensor, cg.Component)
|
||||
BSSIDWiFiInfo = wifi_info_ns.class_('BSSIDWiFiInfo', text_sensor.TextSensor, cg.Component)
|
||||
MacAddressWifiInfo = wifi_info_ns.class_('MacAddressWifiInfo', text_sensor.TextSensor, cg.Component)
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema({
|
||||
cv.Optional(CONF_IP_ADDRESS): text_sensor.TEXT_SENSOR_SCHEMA.extend({
|
||||
@@ -21,6 +22,9 @@ CONFIG_SCHEMA = cv.Schema({
|
||||
cv.Optional(CONF_BSSID): text_sensor.TEXT_SENSOR_SCHEMA.extend({
|
||||
cv.GenerateID(): cv.declare_id(BSSIDWiFiInfo),
|
||||
}),
|
||||
cv.Optional(CONF_MAC_ADDRESS): text_sensor.TEXT_SENSOR_SCHEMA.extend({
|
||||
cv.GenerateID(): cv.declare_id(MacAddressWifiInfo),
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -37,3 +41,4 @@ def to_code(config):
|
||||
yield setup_conf(config, CONF_IP_ADDRESS)
|
||||
yield setup_conf(config, CONF_SSID)
|
||||
yield setup_conf(config, CONF_BSSID)
|
||||
yield setup_conf(config, CONF_MAC_ADDRESS)
|
||||
|
||||
Reference in New Issue
Block a user