MQTT Light control over the day

Hi All!

What I would like to do is the following (sounds pretty easy):

I have an aquarium, for which I control the lights over mqtt - intensity and color of the lights can be adjusted, both range from 0-100% (that’s what the MQTT receives).

For this (intensity for example) I have created the following input slider, which is working perfectly over the UI:

config.yaml:

input_slider:
kessil_intensity:
name: Intensity
min: 0
max: 100
step: 1
unit_of_measurement: “%”

automations.yaml:

  • alias: Kessil Intensity Slider Moved
    trigger:
    platform: state
    entity_id: input_slider.kessil_intensity
    action:
    • service: mqtt.publish
      data_template:
      topic: “Kessil/Intensity”
      payload: ‘{{ states.input_slider.kessil_intensity.state | int }}’

So my question is that is there a way to create an automation for this the following way:

I would like the intensity to ramp up from 8:00 -> 12:00 from 0-30 evenly. Then I’d like it to be @ 30 between 12:00 and 17:00, and then ramp down to 0 by 21:00. I know I could do it by setting up (60) manual timers, but it would be great if the max intensity and the durations could be easily adjusted in the future.

TIA, and also sorry for my bad english:slight_smile:
Cheers

You can probably bend this to your scenario…

Hi!

Thanks, so what does this do exactly?:slight_smile: Can’t really understand it…

Thanks!

Errrrm, it does what it says at the top “Creates an alarm clock”, if you scroll down a bit you can see where some of us change it a bit to use sliders to set the start and stop times for the alarm. My thought was that you could do the same sort of thing.

Sorry, my bad, didn’t realize you’ve linked a whole topic:)) Will look into it, but right now I can’t see how it evenly distributes 0-100 integers between for ex. 06:00 - 12:00…

Thinking about it some more I think you may be better off using appdemon, since although you could probably do it in yaml it would be complicated.

Okay, so I’ve tried to use a time trigger. But I am amazed that it’s not possible to set like “Every 135 seconds” ?! You can only set "every 0-60 seconds " / minutes… Like really?! I must be missing something.

From the trigger docs…

automation:
trigger:
platform: time
# Matches every hour at 5 minutes past whole
minutes: 5
seconds: 00

automation 2:
trigger:
platform: time
# When ‘at’ is used, you can also match on hour, minute, seconds.
# Military time format.
at: ‘15:32:00’

This would do what you want I think…
automation 3:
trigger:
platform: time
# You can also match on interval. This will match every 2 minutes 15secs
minutes: ‘/2’
seconds: 15

That’s what I thought… But in reality (and this is why I think it’s not doable) this will match the following:
[m:ss]
2:15
4:15
6:15

So for example [hh:mm:ss]:
10:00:15
10:02:15
10:04:15

And so on… So the trigger is executed every 2 minutes, it’s just that it’s not executed at a round minute, but at 15 seconds past every second minute.

Hmmm OK, I see what you are saying in that case trigger every sec or perhaps 5s and increment a slider then have a 2nd automation matching on the slider at 135s and reset it then and do any other things that need doing :slight_smile: Perhaps a bit convoluted but it should work or use appdeamon :slight_smile:

Or look here Custom component to declare/set variables
:smiley:

Whats on the link is a great idea! Thank you very much!:slight_smile: