Compound Sensor

I’ve implemented a controller for my motorised roof windows which:

  • closes them when rain is detected
  • opens them when the room gets too hot
  • closes them when the room gets too cold

I’m now wanting to wrap this up in an integration. To do this a need to create a device with the following attributes:

CONF_WINDOW_OPEN_SWITCH_ENTITY = "window_open_switch_entity"
CONF_WINDOW_CLOSE_SWITCH_ENTITY = "window_close_switch_entity"
CONF_RAIN_SENSOR_ENTITY = "rain_sensor_entity"
CONF_ROOM_TEMPERATURE_SENSOR_ENTITY = "room_temperature_sensor_entity"

The Sun integration configures its attributes as follows:

  SunSensorEntityDescription(
        key="next_dawn",
        device_class=SensorDeviceClass.TIMESTAMP,
        translation_key="next_dawn",
        value_fn=lambda data: data.next_dawn,
        signal=SIGNAL_EVENTS_CHANGED,
    ),

How can I configure this to store an entity id (e.g. window_open_switch_entity)?

Cheers
Paul

I’ve realised the error in my reasoning. The window switches, rain and temperature sensors are configuration settings and shouldn’t we set up as entities by my integration.

I do need to set up 3 entities for the target and actual window positions and the auto mode. But this should be relatively straightforward.