Hi @Jammyb
Absolutely you could use the same approach to control audio volume or any other parameter driven change.
The things you’d need to change are:
the automation- to control a media player entity volume instead of a lights brightness
the value template for the brightness mqtt value as I would think that volume is in % rather than 8 bit decimal number (but check this)
the espeasy config that sends the brightness - this is 0-64 value that gets scaled by x4 - you could send 0-100 direct from the sonoff if that works for you
Also I saw another project posted a few days ago to control volume with a rotary encoder… have s search as that should give you inputs for automation. That project used a pi zero rather than esp8266
After a month or so of “soak testing” I’m satisfied with the safety and performance of this solution.
I’ve now finally installed the sonoff in the switch back box and the new faceplate has replaced the old analogue dimmer.
So far its all working great!
Please excuse the electrical noob question: as the lighting circuit is permanently closed (because the hue bulb is doing its own switching internally) why is neutral required at the switch to power the Sonoff?
The lighting circuit is not permanently closed - it’s controlled by relay in the sonoff.
Any mains electrical device requires a L & N to operate.
Where there is only a L at the switch means that the N is supplied to the bulb fitting via another route, but for sure the bulb will have L + N.
You cannot connect a device between L and Earth - it will trip your consumer unit due to earth leakage.
There are other people who posted on the forums who have positioned a sonoff switch by the bulb fitting where there are both L&N supplies.
Is this a feature you’re using in your design or just a side effect of the components you’ve used? If wired a different way could the circuit stay permanently closed with MQTT signals being used to tell Hue to switch the bulb off?
The sonoff inherently uses a relay to close the circuit for the connected load.
I guess it may be possible to hard bypass the relay, but I personally dont want to mess with the 240v side of the device.
Nothing to stop you wiring the sonoff in parallel with no load though…
(Although I like to be able to turn off power to the hue bulb with the relay in case I even need to change the bulb etc)
I really liked this concept. When I worked with studios we used solid state relays to digitally control all the set lighting effects. The modules had zero crossing switching built in. Banggood sell modules like this plus a lot of arduino compatible switch modules but I doubt those have zero crossing detection. Take a look if interested.
80A SSR-80DA Solid State Relay Module DC To AC 24V-380V Output Not sure how good it would be but it has 50M ohms isolation.
Well done for such a great explanation of your project. I am trying to figure out a way of wiring 4 regular non-smart LEDs like these into a spotlight array:
I want to be able to dim them via Home Assistant and Alexa only, not from some app.
The thing is, to the best of my understanding, if I place a Sonoff basic in my wall where the switch is, the Sonoff by itself won’t be able to vary the resistance and hence dim the bulb right? If that is true, then how could I go about solving this? Ideally I don’t want to swap out the current 4 bulbs.
Sorry for delay - busy w work atm
You are correct - there is no dimming capability in Sonoff switches.
All the dimming in my project is done in the smart bulb.
I have seen some dimmers that can be controlled by microcontrollers, but not in general availability.