Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,4 @@ custom_components/opendisplay/*.jpg
custom_components/opendisplay/lastapinteraction.txt

tests/drawcustom/test_images/rename_me.png
.worktrees/
30 changes: 4 additions & 26 deletions custom_components/opendisplay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from homeassistant.helpers import entity_registry as er, device_registry as dr, storage
from homeassistant.const import __version__ as HA_VERSION
from homeassistant.helpers.typing import ConfigType
from .ble import BLEDeviceMetadata
from .metadata import BLEDeviceMetadata
from .const import DOMAIN
from .coordinator import Hub
from .runtime_data import OpenDisplayConfigEntry, OpenDisplayBLERuntimeData
Expand Down Expand Up @@ -114,7 +114,7 @@ async def async_remove_invalid_ble_entities(
mac_address = entry.data.get("mac_address", "")

# Check power mode - remove battery sensors if not battery/solar powered
from .ble import BLEDeviceMetadata
from .metadata import BLEDeviceMetadata
metadata = BLEDeviceMetadata(device_metadata)
if metadata.power_mode not in (1, 3): # Not battery (1) or solar (3)
for entity in er.async_entries_for_config_entry(entity_registry, entry.entry_id):
Expand Down Expand Up @@ -308,7 +308,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: OpenDisplayConfigEntry)
mac_address = entry.data.get("mac_address")
name = entry.data.get("name")
device_metadata = entry.data.get("device_metadata", {})
protocol_type = entry.data.get("protocol_type", "atc") # Default to ATC for backward compatibility
protocol_type = "open_display"

# Get protocol handler for this device
protocol = get_protocol_by_name(protocol_type)
Expand Down Expand Up @@ -378,24 +378,7 @@ def _ble_device_found(
_LOGGER.debug("Failed to parse advertising data for %s: %s", mac_address, err, exc_info=True)
return

# Dynamically update device attributes (skip OpenDisplay fw to avoid incorrect value)
if advertising_data.fw_version and protocol_type != "open_display":
device_registry = dr.async_get(hass)
device_entry = device_registry.async_get_device(
identifiers={(DOMAIN, f"ble_{mac_address}")}
)
new_fw_string = str(advertising_data.fw_version)
if device_entry and device_entry.sw_version != new_fw_string:
_LOGGER.debug(
"Device %s firmware updated from %s to %s",
mac_address,
device_entry.sw_version,
new_fw_string,
)
device_registry.async_update_device(
device_entry.id,
sw_version=new_fw_string
)


# Build sensor data
sensor_data = {
Expand All @@ -410,11 +393,6 @@ def _ble_device_found(
for sensor in ble_data.sensors.values():
sensor.update_from_advertising_data(sensor_data)

# Remove deprecated clock mode button entities
removed_clock_buttons = await async_remove_clock_mode_buttons(hass, entry)
if removed_clock_buttons:
_LOGGER.info("Removed deprecated clock mode buttons: %s", removed_clock_buttons)

# Remove invalid entities based on the current device config
removed_invalid = await async_remove_invalid_ble_entities(hass, entry, device_metadata)
if removed_invalid:
Expand Down
53 changes: 0 additions & 53 deletions custom_components/opendisplay/ble/__init__.py

This file was deleted.

112 changes: 0 additions & 112 deletions custom_components/opendisplay/ble/color_scheme.py

This file was deleted.

Loading