Skip to content

Commit

Permalink
fix message delay parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Jul 8, 2024
1 parent 432bb24 commit dd51de2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions custom_components/eltako/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,15 @@ def identifier(self) -> str:
"""Return the identifier of the gateway."""
return self._attr_identifier

@property
def message_delay(self) -> str:
"""Return the message delay of single telegrams to be sent."""
return str(self._message_delay)

@property
def is_auto_reconnect_enabled(self) -> str:
"""Return if auto connected is enabled."""
return str(self._auto_reconnect)


def detect() -> list[str]:
Expand Down
4 changes: 3 additions & 1 deletion custom_components/eltako/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
from typing import ClassVar
import voluptuous as vol

from numbers import Number, Real
import homeassistant.helpers.config_validation as cv


from eltakobus.eep import *

from .const import *
Expand Down Expand Up @@ -265,7 +267,7 @@ class GatewaySchema(EltakoPlatformSchema):
vol.Optional(CONF_SERIAL_PATH): cv.string,
vol.Optional(CONF_GATEWAY_AUTO_RECONNECT, default=True): cv.boolean,
vol.Optional(CONF_GATEWAY_ADDRESS): cv.string,
vol.Optional(CONF_GATEWAY_MESSAGE_DELAY, default=0.01): cv.Number,
vol.Optional(CONF_GATEWAY_MESSAGE_DELAY, default=0.01): Real,
vol.Optional(CONF_GATEWAY_PORT, default=5100): cv.Number,
vol.Optional(CONF_DEVICES): vol.All(vol.Schema({
**BinarySensorSchema.platform_node(),
Expand Down
3 changes: 2 additions & 1 deletion custom_components/eltako/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ async def async_setup_entry(
if dev_name == "":
dev_name = DEFAULT_DEVICE_NAME_ELECTRICITY_METER

LOGGER.debug(f"test {dev_conf.get(CONF_METER_TARIFFS, [])}")
for tariff in dev_conf.get(CONF_METER_TARIFFS, []):
entities.append(EltakoMeterSensor(platform, gateway, dev_conf.id, dev_name, dev_conf.eep, SENSOR_DESC_ELECTRICITY_CUMULATIVE, tariff=(tariff - 1)))
_tariff_in_name = dev_conf.get(CONF_METER_TARIFFS, []) != []
Expand Down Expand Up @@ -420,6 +419,8 @@ def convert_event(event):
entities.append(GatewayInfoField(platform, gateway, "Base Id", b2s(gateway.base_id[0]), "mdi:identifier"))
entities.append(GatewayInfoField(platform, gateway, "Serial Path", gateway.serial_path, "mdi:usb"))
entities.append(GatewayInfoField(platform, gateway, "USB Protocol", gateway.native_protocol, "mdi:usb"))
entities.append(GatewayInfoField(platform, gateway, "Message Delay", gateway.message_delay, "mdi:usb"))
entities.append(GatewayInfoField(platform, gateway, "Auto Connect Enabled", gateway.is_auto_reconnect_enabled, "mdi:usb"))
entities.append(GatewayLastReceivedMessage(platform, gateway))
entities.append(GatewayReceivedMessagesInActiveSession(platform, gateway))

Expand Down

0 comments on commit dd51de2

Please sign in to comment.