mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-24 09:48:53 +02:00
renamed format_value to helper.py
This commit is contained in:
parent
a3e6761c78
commit
1503cd79d1
3 changed files with 14 additions and 25 deletions
|
@ -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
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
|
|
@ -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
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue