Integration of two entities from an original value (start and end of a time program)

Hi,

with a Tecalor/Stiebel Eltron heat pump, the program start and end times are received from one protocol in hexadecimal code.
This value can be split, and one entity can be created for the start time and another for the end time (each representing a clock time).
When the value of one entity changes, the other entity needs to be located and transmitted to the system via a protocol.
As far as I understand, all entities are stored in an entity list.
How can I search for the entity using Python code, e.g., by name or unique ID, and access its value?
Does anyone have any ideas?

Thanks in advance.

Regards, NaCkHaYeD

Rather than having to find an entity, i would use the dispatcher.

In each entities async_added_to_hass you can add a dispatcher listener like this.

    self.async_on_remove(
        async_dispatcher_connect(
            self.hass,
            f"{DOMAIN}_{my_device_id}",
            self.status_update,
        )
    )

With an update function like…

    @callback
    def status_update(self, data: str) -> None:
        """Update entity."""

        [calculate value from hex]

        self._attr_native_value = value
        self.async_write_ha_state()

When you then receive the data from your device call the dispatcher with your id, passing the hex value. Each entity can then work out its value from that, set the native value.

        async_dispatcher_send(
            self.hass,
            f"{DOMAIN}_{my_device_id}",
            my_device_hex_data,
        )