renamed format_attribute to helper.py

This commit is contained in:
Tomaae 2022-02-02 22:13:39 +01:00
parent 1ea1f3a4b7
commit a3e6761c78
6 changed files with 27 additions and 95 deletions

View file

@ -2,7 +2,6 @@
import logging
from typing import Any, Dict, Optional
from homeassistant.helpers.entity import EntityCategory
from homeassistant.components.binary_sensor import (
BinarySensorEntity,
@ -17,7 +16,7 @@ from homeassistant.const import (
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from .helper import format_attribute
from .const import (
DOMAIN,
DATA_CLIENT,
@ -116,22 +115,6 @@ DEVICE_ATTRIBUTES_PPP_SECRET = [
]
# ---------------------------
# format_attribute
# ---------------------------
def format_attribute(attr):
res = attr.replace("-", " ")
res = res.capitalize()
res = res.replace(" ip ", " IP ")
res = res.replace(" mac ", " MAC ")
res = res.replace(" mtu", " MTU")
res = res.replace("Sfp", "SFP")
res = res.replace("Poe", "POE")
res = res.replace(" tx", " TX")
res = res.replace(" rx", " RX")
return res
# ---------------------------
# format_value
# ---------------------------