SOLVED...Bathroom Lights dim automatically. Great...but what if I need them to be full brightness right now?!?!

Tags: #<Tag:0x00007f3f1a5711c8>

Okay. So I have an insteon dimmer module on my bathroom light switch. In case you aren’t familiar, it is installed behind the light switch so the dimming can only occur via Home Assistant or my isy994i (no insteon hub here). I have a couple automations to dim the lights if they turn on during certain times. In the evening, they’re at 50% and in the middle of the night they’re at 15%. This works great so we’re not blinded at night. However, in the evenings during the bedtime routine, occasionally my wife or I need the lights on brighter (read: pop a pimple or blackhead…haha…or just to see our beautiful faces better).

I’d like to set it so that if we switch the lights off and then on again quickly at the switch, the dimming automations will be killed temporarily and the lights will be full brightness until the switch is turned off. At this point the dimming automations will be re-engaged.

With the ISY integration, home assistant can listen for direct isy events so I know I can differentiate the manual changes at the light switch.

What I’m not sure about is how to go about this.
My original thought was to set up an input boolean so if it’s true/on, the dimming automations will occur as per usual but if the isy event DOF (light turned off at the switch) is followed quickly by DON (light turned on at the swtich) lets say within 1/2 a second, then the input boolean would become false/off which would set the lights to 100% and turn off the dimming automations. When the lights turn back off, the input boolean would go back to true/on.
Wow, what a run-on sentence…

I’m just not sure how to do this.

There may also be a better way to accomplish my overall need.

Any help is greatly appreciated.

I was going to ask if the Insteon module can detect a double-press (double-click) but then I realized this a module that is physically separate from the actual switch. All it can detect is if the switch is turned on or off.

Given that you are using an isy994i can it detect the switch’s rapid off-on sequence and then set the light to maximum brightness? In other words, have it do what you’re trying to make Home Assistant do?

Motion detector and timer (dim after 15min no motion)

I have a similar concept in my lighting control. The bathroom light is dimmed (and colour corrected) based on the Circadian Lighting custom_component, however if we want the light to be at full brightness for whatever reason we can press a Xiaomi wireless button which tells HA to override the Circadian Lighting settings and turn the light up. Obviously this involves more hardware for you but if you can figure out the hardware side using your insteon / ISY (I have no experience with either) then perhaps my code for the automation side could help. Let me know if you want it, otherwise I won’t flood the thread with it.

I also have a floor lamp that has similar dimming automations that I’d like to accomplish this same type of thing but it’s a zigbee bulb that lives only in home assistant. So if anyone else has more suggestions I’m all ears.
In the meantime, I will look into this. It’s a good suggestion. It would be nice if all my automations were living in home assistant but I’ll check on this tomorrow.

Thank you.

This would work well but I’d really like a software solution for this. I really feel like there’s a way to make this work.
Thank you for the suggestion though. That may be the route I end up taking.

If you can work out a way to trigger an automation using a quick on/off action of the switch then you could use my code/idea, just without needing the additional button.

I would imagine it would need to be case of creating a trigger based on the light switch turning on and a condition that it was on a couple of seconds ago.

trigger…

trigger:
  - platform: state
    entity_id: light.your_bathroom_light
    to: 'on'

A condition along these lines…

condition:
  - condition: template
    value_template: '{{as_timestamp(now()) - as_timestamp(states.light.your_bathroom_light.last_changed) < 2 }}'

That’s brilliant! That’s exactly the kind of out-of-the-box thinking I was looking for!

I’ll give that a shot. I’ve not used a timestamp in a template yet but your code looks very promising.

Thanks sparkydave!
I’ll let you know if it works

I tried the suggestion to check if last_changed is within 2 seconds of now().

I used this:

- alias: 'toggle test'
  trigger:
    platform: state
    entity_id: light.family
    to: 'on'
  condition:
    condition: template
    value_template: '{{as_timestamp(now()) - as_timestamp(states.light.family.last_changed) < 2 }}'
  action:
    service: system_log.write
    data_template:
      message: "Last: {{states.light.family.last_changed}}, Now: {{utcnow()}}"
      level: warning

the action is executed even if you simply turn on the light (i.e. you don’t even have to do a quick toggle of on/off/on).

My automation prints last_changed and utcnow() and they are virtually identical. It would appear last_changed is updated the moment the light’s state changes to on.

Screenshot%20from%202019-07-14%2008-40-37

Building on this train of thought: on ‘turn on’, you could start a 2 second timer. In the condition, you check for timer state = active. If active, then brightness to 100%.

Shoot. But also… Wow! Thanks for doing that testing.

Can one use an event rather than a state change? Would this make any difference? I suspect not, but you never know.

I’m solo with my kiddos for a bit today but can do some experimenting during nap time :slight_smile:

I feel like we’re headed in the right direction but wouldn’t that just turn on full brightness for 2 seconds everytime? Or are you saying in the condition of 123Taras toggle test? (say that 5 times fast)

This reminds me of another person who wanted to toggle one switch in order to activate another switch. The goal was to press on/off/on, all within 3 seconds, on switch A and have that serve as a trigger for activating switch B. Here’s the solution I offered and, yes, it involves the use of a timer:

It’s not a perfect fit for what you want because it requires the switch to be initially off before performing the on/off/on sequence. In other words, off -> on/off/on. In your case, the switch is already on, at some dim level. So the sequence to detect would be on -> off/on. It may be possible to adapt the solution to meet your needs but I can’t say for sure because I haven’t explored it in depth yet.

Yea I like that.
I’ve got some serious fun ahead of me…

You could also replace the light switch with a momentary one and just do double taps after setting your micro module for momentary rather than latching.
Requires hardware change, but not an additional switch.

I mean like this:

In configuration.yaml:

timer:
  brightness_timer:
    duration: '00:00:03'

In automations.yaml:

- alias: 'Bathroom light brightness'
  trigger:
  - platform: state
    entity_id: light.your_bathroom_light
    to: 'on'
  action:
  - service: light.turn_on
    entity_id: light.your_bathroom_light
    data_template:
      brightness_pct: >
        {% if is_state('timer.brightness_timer','active') %}
          100
        {% elif now().hour > 20 or now().hour < 7 %}
          15
        {% else %}
          50
        {% endif %}
  - service: timer.start
    entity_id: timer.brightness_timer

I think the success will depend on the responsiveness of your switch; how fast does Home Assistant pick up the changes.

Edit: just read 123’s comment; when your light is already on, this automation needs off-on-off-on to work. Let me think about that some more :slight_smile:

Edit2: I think this is better; when your light is on, tapping off-on should suffice. You’ll just need to start the timer when the light is turned off instead of on. So remove the timer.start from the automation above (the last 2 lines) and instead add this automation:

- alias: 'Timer start at switch-off'
  trigger:
  - platform: state
    entity_id: light.your_bathroom_light
    to: 'off'
  action:
  - service: timer.start
    entity_id: timer.brightness_timer

I have to say that, from the point of view of an end-user, anything that requires rapidly toggling a switch feels contrived (and inconvenient). You want maximum brightness? First turn the switch off (counter-intuitive) and then quickly turn it back on.

The experience isn’t improved if there’s a need to toggle it twice (off/on/off/on) because then it feels like some sort of secret handshake. It may be fine for activating some rarely-used automation but its onerous for simply turning on a light to full brightness.

You’re right of course. The same argument could be made for double or triple tapping; that’s not very intuitive either. No guest in my house would assume to try that by himself; but for those who know the secret handshake it’s a convenient way to trigger the secret pimple mode :blush:

Double, or even triple, tapping is a different operation and, owing to widespread familiarity with ‘double-clicking’ and ‘double-tapping’, not an unusual experience for most end-users.

In contrast, toggling a two-state switch is an unfamiliar operation for most people. You want to brew stronger coffee? Just turn the coffee machine off and then quickly turn it back on. ?:thinking:?

Here’s an example from my own home. We have UPB light switches (dimmers). They can be configured to turn on at their previous light level. So if the light was at 50% the last time it was on, when you turn on the switch, the light level will be re-established to 50%.

What if you want to override that behavior and set the light to maximum brightness? Well, they are dimmer switches so you can press and hold the top of the rocker-switch and the light will brighten to whatever level you want. However, as a convenience, you can simply double-tap the top of the rocker-switch and the light will instantly increase to maximum brightness. This ‘double-tapping’ operation feels natural and intuitive for maximizing brightness.

You can even program the switch to respond to double-tapping the bottom of the rocker-switch. However, I haven’t found an application for that.

Okay… A lot has happened since this morning… However I haven’t been able to do any HA programming.

So to begin, Emphyrio, I like that 3 second timer idea from when the switch is turned off. I think I’ll try that first when I get a chance. The switches are quite responsive in HA so I’m confident.

The idea is not that it would require the double toggle, just off and then back on. But as you said this actually is for activating a rarely used automation… Most of the time these lights come on at full brightness. Only in the evenings while getting ready for bed do they come on at a lower dim level. And only occasionally during that time do we need full brightness… I do see your point and if one of these solutions doesn’t work pretty much flawlessly, it will only cause frustrations.

Insteon does make a toggle switch like the UPB switches you described. I actually have one in each of my kids rooms. I’ve never really liked them. They just don’t “feel” right. I’m not sure why.
I should mention these are all the old toggle switch style not decora. Perhaps the decora dimmer switches from Insteon would “feel” better.

All in all I’ve got some options to try and I really appreciate you guys helping me out. I will post here with whatever solution works for us.
Pimple-Mode… Engage!