renamed format_value to helper.py

This commit is contained in:
Tomaae 2022-02-02 22:18:05 +01:00
parent a3e6761c78
commit 1503cd79d1
3 changed files with 14 additions and 25 deletions

View file

@ -2,6 +2,7 @@
import logging import logging
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
BinarySensorEntity, BinarySensorEntity,
@ -115,18 +116,6 @@ DEVICE_ATTRIBUTES_PPP_SECRET = [
] ]
# ---------------------------
# format_value
# ---------------------------
def format_value(res):
res = res.replace("dhcp", "DHCP")
res = res.replace("dns", "DNS")
res = res.replace("capsman", "CAPsMAN")
res = res.replace("wireless", "Wireless")
res = res.replace("restored", "Restored")
return res
# --------------------------- # ---------------------------
# async_setup_entry # async_setup_entry
# --------------------------- # ---------------------------

View file

@ -15,7 +15,7 @@ from homeassistant.core import callback
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util.dt import get_age, utcnow from homeassistant.util.dt import get_age, utcnow
from .helper import format_attribute from .helper import format_attribute, format_value
from .const import ( from .const import (
DOMAIN, DOMAIN,
DATA_CLIENT, DATA_CLIENT,
@ -38,18 +38,6 @@ DEVICE_ATTRIBUTES_HOST = [
] ]
# ---------------------------
# format_value
# ---------------------------
def format_value(res):
res = res.replace("dhcp", "DHCP")
res = res.replace("dns", "DNS")
res = res.replace("capsman", "CAPsMAN")
res = res.replace("wireless", "Wireless")
res = res.replace("restored", "Restored")
return res
# --------------------------- # ---------------------------
# async_setup_entry # async_setup_entry
# --------------------------- # ---------------------------

View file

@ -15,3 +15,15 @@ def format_attribute(attr):
res = res.replace(" tx", " TX") res = res.replace(" tx", " TX")
res = res.replace(" rx", " RX") res = res.replace(" rx", " RX")
return res return res
# ---------------------------
# format_value
# ---------------------------
def format_value(res):
res = res.replace("dhcp", "DHCP")
res = res.replace("dns", "DNS")
res = res.replace("capsman", "CAPsMAN")
res = res.replace("wireless", "Wireless")
res = res.replace("restored", "Restored")
return res