Dimming lights in line with the sun

I orignally started a thread in Hardware and now that the hardware side is sorted it’s more appropriate here:

My dimmer is defined as below and works from it’s webserver:

  - platform: mqtt
    name: "Koi Quarantine Dimmer"
    state_topic: "stat/koi_dimmer_1/POWER"
    command_topic: "cmnd/koi_dimmer_1/POWER"
    availability_topic: "tele/koi_dimmer_1/LWT"
    brightness_state_topic: "stat/koi_dimmer_1/RESULT"
    brightness_command_topic: "cmnd/koi_dimmer_1/Dimmer"
    brightness_scale: 100
    brightness_value_template: >
      {% if value_json.Dimmer is defined %}
        {{ value_json.Dimmer }}
      {% else %}
        {% if state_attr('light.koi_dimmer_1','brightness') == none %}
        {% else %}
          {{ state_attr('light.koi_dimmer_1','brightness') / 255 * 100 }}
        {% endif %}
      {% endif %}
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

I need to be able to simulate the sun outside to condition my indoor Koi Carp growing tank to the same daily sun cycle as their outdoor counterparts. I’d like it to slowly get to full brightness as the sun rises and then dims as the sun sets.

I already have sensors for sun elevation, day, night, dawn and dusk set up, it’s just the gradual brightness change I need help with.

My current skill level doesn’t extend to this so I’d appreciate a few pointers to get me started.

Additionally, the light shows up as a toggle in HA front end but no slider for brightness. How do I set that up, mimicking what I see on the device webserver?

I have never implemented this myself, but you might want to search the forum for “Circadian rhythm” - I think a lot of people already have various implementations of this.


1 Like

Thank you. That’s a good starting point.