Skip to content

Commit

Permalink
Final tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
megakid committed Jun 12, 2022
1 parent 04e9a5e commit 9e75883
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
4 changes: 2 additions & 2 deletions custom_components/hildebrand_glow_ihd_mqtt/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

from homeassistant import config_entries
from homeassistant.const import (
CONF_DEVICE_ID,
CONF_DEVICE_ID
)

from .const import (
DOMAIN,
DOMAIN
)

_LOGGER = logging.getLogger(__name__)
Expand Down
13 changes: 1 addition & 12 deletions custom_components/hildebrand_glow_ihd_mqtt/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from itertools import cycle, islice
from typing import Final

DOMAIN: Final = "hildebrand_glow_ihd_mqtt"
DOMAIN: Final = "hildebrand_glow_ihd"

ATTR_NAME = "name"
ATTR_ACTIVITY = "activity"
Expand All @@ -14,14 +14,3 @@
ATTR_ERROR = "error"
ATTR_STATE = "state"

CONF_OFFPEAK_START: Final = "offpeak_start"
CONF_OFFPEAK_END: Final = "offpeak_end"

CONF_OFFPEAK_START_DEFAULT: Final = "23:30"
CONF_OFFPEAK_END_DEFAULT: Final = "05:30"

# a hardcoded array of time strings in HH:mm every 30 mins for 24 hours
INTELLIGENT_MINS_PAST_HOURS: Final = [0, 30]
INTELLIGENT_24HR_TIMES: Final = [f"{hour:02}:{mins:02}" for hour in range(24) for mins in INTELLIGENT_MINS_PAST_HOURS]
INTELLIGENT_CHARGE_TIMES: Final = [f"{hour:02}:{mins:02}" for hour in range(4, 12) for mins in INTELLIGENT_MINS_PAST_HOURS][:-1]
INTELLIGENT_SOC_OPTIONS: Final = list(range(10, 105, 5))
7 changes: 4 additions & 3 deletions custom_components/hildebrand_glow_ihd_mqtt/manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"domain": "hildebrand_glow_ihd_mqtt",
"name": "Hildebrand Hlow IHD MQTT",
"domain": "hildebrand_glow_ihd",
"name": "Hildebrand Glow IHD MQTT",
"documentation": "https://github.com/megakid/ha_hildebrand_glow_ihd_mqtt",
"issue_tracker": "https://github.com/megakid/ha_hildebrand_glow_ihd_mqtt/issues",
"codeowners": ["@megakid"],
"dependencies": ["mqtt"],
"iot_class": "local_push",
"config_flow": true,
"version": "1.0.0"
"version": "1.1.0"
}
13 changes: 4 additions & 9 deletions custom_components/hildebrand_glow_ihd_mqtt/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
import re
import logging
from typing import Iterable
import voluptuous as vol

from homeassistant.components import mqtt
from homeassistant.components.mqtt.models import ReceiveMessage
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorEntity,
SensorDeviceClass,
SensorStateClass,
Expand All @@ -24,12 +22,8 @@
ENERGY_KILO_WATT_HOUR,
POWER_KILO_WATT
)
from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.core import callback
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.util import slugify

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -248,15 +242,16 @@ def __init__(self, device_id, name, icon, device_class, unit_of_measurement, sta
self._ignore_zero_values = ignore_zero_values
self._attr_name = name
self._attr_unique_id = slugify(device_id + "_" + name)
#self._attr_icon = icon
self._attr_icon = icon
self._attr_device_class = device_class
self._attr_native_unit_of_measurement = unit_of_measurement
self._attr_state_class = state_class
self._func = func
self._attr_device_info = DeviceInfo(
identifiers={("subscription_mode", device_id)},
manufacturer="Hildebrand Technology Limited",
model="Glow Smart Meter IHD"
model="Glow Smart Meter IHD",
name="Glow Smart Meter IHD"
)
self._attr_native_value = None

Expand Down

0 comments on commit 9e75883

Please sign in to comment.