basbruss / adaptive-cover

An Adaptive Cover component for HomeAsisstant to control covers based on the sun's position
MIT License
90 stars 11 forks source link

Ability to define a switch as lux device #233

Closed mathiasbl closed 3 months ago

mathiasbl commented 3 months ago

Checklist

Is your feature request related to a problem? Please describe.

I've been using this amazing integration to control my covers but I want to go the next step to control them based on the lux value instead of weather predictions. However, I have a light sensor that doesn't output the lux measurement as a value but I must configure the treshholds in the device itself which just outputs on/off based on that.

It would be nice to also have to possibility to configure switches next to sensors as lux device in the integration.

Describe the solution you'd like

-

Describe alternatives you've considered

-

Additional context

-

basbruss commented 3 months ago

That seems like a very niche application. One approach is to use a template sensor to convert that on/off state into actual values.

template:
  - sensor:
      - name: Lux Value
        state: >
          {{ iif(is_state('switch.lux','on'),2000,150) }}
        device_class: illumination
        unit_of_measurement: "lx"

with the assumption that the high threshold is 2000lx and 150lx is considered as low