SMART BULB + LIGHT SWITCH - brightness controll

Hello everyone, I have “Wiz smart bulbs” that I would like to control with a wall button and at the same time adjust their brightness.
The approach I wanted to take is the following:

  • keep the bulbs powered
  • mount a “smart dimmer module” in the switch (Moes dimmer switch)
  • make an automation that when the button is pressed turns off / on the lights and, by keeping the button pressed, raises and lowers the brightness.

Regarding activation / deactivation, no problem.
As far as brightness adjustment is concerned, the question is more complex.
I was looking for an automation that, as the brightness value of the “smart dimmer module” increases at the same time, commands the “smart bulb” to increase (or decrease) by the same value.
Thanks for your help.

It looks like the Moes dimmer switch is a traditional dimmer with a smart interface.
You can not use a traditional dimmer with a smart bulbs, because the dimmer will lower the power provided to the bulb and then the bulb will not function.

You can make it work with a little trick, but its kind of dumb to do.
The trick is to connect the light bulbs direct to the mains with no switch in between and then connect the switch to the mains with no light bulbs to control.
Then HA can read the switch and control the bulbs.

It is my idea. Connect both devices (smart dimmer and smart bulb) to the main, and manage the action by the HA.
But i want to pilot the brightness of bulb by the smart dimmer, with (i think) automation to set in HA.

I want increase/decrease the smart dimmer in HA, and this input have to be matched with the dimmer oh smart bulb.

In this way I can manage the smart bulb with the wall switch.

Just to be clear.
The light bulb and the dimmer will not have a direct connection.
Your bulb and dimmer will have to be integrated into HA
The dimmer will update HA and HA will update the bulb.
Everything will go over HA.

You can do everything with HA if you can get the devices integrated there in. There is very few limitiations.

It might be a bit of waste with the dimmer switch, since you will actually not use the dimmer feature.
You will send commands to HA, which will send it to the bulb and the dimmer feature in bulb will then dim the light.

Yes, both the decives are integrated in HA.
Below the image where I show the integration.

Meanwhile the turn on/off the light is simple to manage with an automation, my goal is to manage the brightness with the smart dimmer.
This is difficult for me (or easy for others)

1 Like

Great, it’s possible to do then.
Could you post the output from the developer tools too, so we can see the entity named and data fields?

Thanks for you help.

smart dimmer (integrated with Local Tuya platform):
light.luce_tavolo

Output:

effect_list: []
supported_color_modes:
  - brightness
color_mode: brightness
brightness: 107
friendly_name: Luce_tavolo
supported_features: 5

smart bulb (integrated with Wiz light platform):
light.cucina

Output:

min_mireds: 200
max_mireds: 500
effect_list:
  - Cozy
  - Wake up
  - Bedtime
  - Warm White
  - Daylight
  - Cool white
  - Night light
  - Focus
  - Relax
  - TV time
  - Candlelight
  - Golden white
  - Pulse
  - Steampunk
supported_color_modes:
  - color_temp
friendly_name: Cucina
supported_features: 7

I have to admit I am quite rusty in the script/automations in HA, since I quite early switched to NodeRed, but here goes an attempt.

automation:
  trigger:
    - platform: state
      entity_id: light.luce_tavolo
      attribute: brightness
  action:
    - service: light.turn_on
      target:
        entity_id:
          - light.cucina
      data:
        brightness: {{ state_attr('light.luce_tavolo','brightness') }}

You might want a script that goes the other way too, so when you handle the brightness directly at light.cucina then light.luce_tavolo will be updated too, but I think there might be a feedback loop that have to be handled then.
Someone else will have to help you with that. Its probably a condition, so if brightness at light.cucina is different than light.luce_tavolo then run the automation.

Very Great, now i’m able to control the light with the switch.
Now the new challenge is to set the pushing of the button. At the moment for increase or decrease the light I have make a long push until the 100% or 0% the brightness for reverse the regulation.
My goal is:
increase - > long push
decrease - > doble click + long push

I don’t know where find the behaviur of switch.

Do you have any idea?

Try to see what you can get from the logs, like logs in the configuration section, but also logbook, Longview and history. Some of these might be add-ons that needs to be installed.
Also look at developer tools, which might actually require you to hold a long press when you update the entity to see the actually state.

Hi sorry but I have changed the HA installation and now I’m not able to make this automation.

Now I have this advise
image

Do you have some idea?
The syntax is this now:

automation:
  trigger:
    - platform: state
      entity_id: light.dimmer_a_2_vie_light
      attribute: brightness
  action:
    - service: light.turn_on
      target:
        entity_id:
          - light.luci_cucina
      data:
        brightness: {{ state_attr('light.dimmer_a_2_vie_light','brightness') }}

thanks

The error you have can be both before and after that text. The interpreter just first discover something is wrong in that place.