arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.12k stars 4.79k forks source link

Support for Shelly Dimmer 2 #9412

Closed jamesturton closed 3 years ago

jamesturton commented 4 years ago

Have you looked for this feature in other issues and in the docs?

Yes, there is curently no support for the Shelly Dimmer 2

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.

There is currently no support for the Shelly Dimmer 2. It would be nice for Tasmota to support the Shelly Dimmer 2.

Describe the solution you'd like
A clear and concise description of what you want to happen.

I would Tasmota to support the Shelly Dimmer 2 hardware.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Myself and others have worked hard to add support for the original Shelly Dimmer. The Shelly Dimmer 2, however, has some hardware changes thus needs its own support.

Additional context
Add any other context or screenshots about the feature request here.

This issue will be used to track mine, and others, work on making support for Shelly Dimmer 2 to happen.

(Please, remember to close the issue when the problem has been addressed)

jamesturton commented 3 years ago

@ChristusM yes, I am hoping to submit a merge request for these changes very soon. Once I have had some feedback from a few more people and I have done a bit more testing and I am confident that the driver works well I shall submit the PR.

ChristusM commented 3 years ago

@jamesturton thank you.

Scoobler commented 3 years ago

@jamesturton great work on the power monitoring 👍 I’ll do some testing with loads.

craggyh commented 3 years ago

@jamesturton i notice my power calculation is off. With no load the device is currently showing 741.104 kWH energy used today. :-)

daxy01 commented 3 years ago

@jamesturton I'd love to try and test to give more confidence, but as my Dimmer (1) is in the kitchen and not very easily reachable, I need to have some level of confidence before I can flash. I've got a couple of Shelly 1 & 2.5's running Tasmota already.

Can I just flash this image, configure it like the Shelly 1/2.5's, add it to HomeAssistant and it will just work (incl dimming)?

jamesturton commented 3 years ago

@daxy01 This issue is for the Shelly dimmer 2. You should ask your question in issue #6914 for the Shelly dimmer 1.

@craigueh Maybe you can try EnergyReset1? Does the current power look correct?

daxy01 commented 3 years ago

I thought it was the same firmware file isn't it? https://github.com/arendst/Tasmota/issues/6914 only has v1.0 and not v1.3. I'll ask there as well ;)

craggyh commented 3 years ago

@jamesturton I tried EnergyReset1 but it didn’t seem to make any difference. Current power usage looks about right, 28w for 6 gu10 spots. It’s just the totals that are way off. It’s not a big deal for me but others might be more keen to have the totals working.

stefxx commented 3 years ago

I had kWh usage for today and total (not yesterday) after initial installation. EnergyReset1 and EnergyReset3 solved this for me.

craggyh commented 3 years ago

I tried both of those but doesn’t seem to have changed anything. Energy totals still show as 24291.527 kWh

craggyh commented 3 years ago

Never mind, I disconnected power for a moment and reconnected. After that the resetenergy1 and 3 commands cleared the totals. Let’s see how they recalculate over the next day or so.

@jamesturton how can I set dimmer_hw_min? When my dimmer goes below 42% the lights go out and has to be turned back up past 60 for the lights to come back on.

jamesturton commented 3 years ago

@craigueh Have you read this comment? https://github.com/arendst/Tasmota/issues/9412#issuecomment-719025214

The first thing I would recommend you trying is to turn off the Gamma Correction with LedTable 0. I don't know who decided it should be on by default, but it is. There are a couple more commands from the Commands Page in the docs that might help you:

DimmerRange: Change dimming range. < dimmerMin >,< dimmerMax > = set the internal dimming range from minimum to maximum value (0..100, 0..100)

Fade: 0 = do not use fade (default), 1 = use fade See also SetOption91

Might be worth taking a read through that page as there is lots to learn!

Take away message: turn off gamma-correction with LedTable 0 first!

craggyh commented 3 years ago

Thanks for that. I was trying DinmerStepRange but I missed where that changed to DimmerRange.

stefxx commented 3 years ago

Hi @jamesturton , there is something wrong with the latest versions. Both 1.3 and the "tasmota-shelly-dimmer-frequency-1" firmware do not work on any of my Dimmer 2. The log is full serial errors:

16:19:08 SHD serial send timeout 16:19:08 SHD serial send timeout 16:19:08 SHD serial send timeout 16:19:08 SHD serial send timeout 16:19:09 SHD serial send timeout 16:19:09 SHD serial send timeout 16:19:09 SHD serial send timeout 16:19:09 SHD serial send timeout 16:19:10 SHD serial send timeout 16:19:10 SHD serial send timeout 16:19:10 SHD serial send timeout 16:19:10 SHD serial send timeout 16:19:10 SHD serial send timeout 16:19:11 SHD serial send timeout 16:19:11 SHD serial send timeout

When upgrading while the light is off, there is no way of turning it on again, nor set the dimming level. When upgrading while the light is already on it gets ever more weird. Dimming works in the opposite direction and turning on/off only adjusts the brightness level.

I had to revert to 1.2 for my test dimmer. For my dimmers that I (and the family) use frequently, I reverted to the version of Scoobler since that contains the DimmerStep functionality.

Thanks!

craggyh commented 3 years ago

I didn’t see any of the serial errors but I did have the weird reverse dimming etc. A full power cycle of the device solved that.

stefxx commented 3 years ago

Thanks @craigueh. I tried a full power cycle once during my testing with 1.3 but it didn't resolve the issue for me.

stefxx commented 3 years ago

Forget about the serial errors. Turns out to be an error in the device template I was using. I have now upgraded all 6 dimmers, two of them I had to power cycle to fix the reverse dimming and faulty power toggle.

ascillato2 commented 3 years ago

Closing as this support has been added. Thanks a lot for the huge hard work done here 👍

stefxx commented 3 years ago

Thanks again @jamesturton .

If I flash the latest dev build, should it still work? Should I update the STM32 manually? Thanks!

daxy01 commented 3 years ago

Quick heads-up: The Template has changed between James's test version and the version included in Tasmota dev build. After upgrading from the test image to the Tasmota dev build you'll need to change it, else you can't use the toggle. Here is the correct template: https://templates.blakadder.com/shelly_Dimmer_2.html

tayhall commented 3 years ago

Does anyone have the overheating issue with the Shelly Dimmer 2? I am running Tasmota 9.2. and it seems to overheat and turn off. You can watch the temprature rise until it hits 90 degrees. However its not all the time. It seems to get into a state where any power on will create the issue especially on middle dimmer vaules. However at other times on the same dim settings no issue....I'll keep trying different settings to see if I can pinpoint what causes the problem. Any suggestions welcome for my testing.

stefxx commented 3 years ago

I have 6 of them with Tasmota 9.2. They stay just below 80 degrees, which I still think is quite hot...

thomasgermain commented 3 years ago

Same here, I have 2 of them, ~45°C when off, it goes instant to ~70°C when on and up to 100°C after 1h or so, but it goes down very quickly when switching off.

EDIT: just check my history deeper (with home assistant) and it seems it heats a lot when the light is not 100%

tayhall commented 3 years ago

Same here, I have 2 of them, ~45°C when off, it goes instant to ~70°C when on and up to 100°C after 1h or so, but it goes down very quickly when switching off.

EDIT: just check my history deeper (with home assistant) and it seems it heats a lot when the light is not 100%

Oh Im pretty sure the temprature reading is false. As I said I did have it working where the temprature stayed stable but I wasnt sure what I did or what had changed or if its a random fault with the shelly's giving a duff reading. I'm trying to change one thing at a time now and see.

craggyh commented 3 years ago

Any chance the dimmer2 is using an ade9753 to monitor power?

I have some Shelly 2.5s and the GPIO16 pin has to be set as an input to keep temps around 50c to 60c. By default the pin is floating causing temps in excess of 85c.

Edit: I’m using them with esphome.

stefxx commented 3 years ago

GPIO16 is being set to Led_i (1) by the default template.

Dilergore commented 3 years ago

Hello,

I flashed my Dimmer 2 with Tasmota (read everything, using the proper template, etc). My problem is if I start to dim the lights the bulbs are giving a flickering noise and the temp of the shelly is starting to increase around 2degrees/sec... It is working properly after calibration with the stock firmware. Any idea what could be the problem? I am using ledtable 0 and leaving the ShdLeadingEdge on 0.

For now I'm back on the original FW which I'm not particularly happy with since it is very slowly turning on with the momentary switch which is pretty fast with Tasmota.

If there are any suggestions I'm happy to reflash and test.

Bulbs: https://cpc.farnell.com/v-tac/199-vt-247d/lamp-led-6-5w-gu10-4000k-110-d/dp/LP11363

Thanks!

Dilergore commented 3 years ago

Might be I'm having the same issue: https://github.com/jamesturton/shelly-dimmer-stm32/issues/6

I'll check the mentioned beta FW later

FotoFieber commented 3 years ago

Flashed 3 new Dimmer 2.

Two of them I attached to a 50W LED load. They turned on well but couldn't turn off again (dimmed to about 50%). I then reflashed the original firmware to all of them. The two I used with the load didn't work either with the original firmware.

The one I didn't use with the load under tasmota worked fine with the same load and the original firmware.

As the two non working were off when I attached them and couldn't be turned off again after turning them on, I think there may be some mosfet problems in the device that maybe caused by tasmota.

andreasfrosig commented 3 years ago

Has anyone found a fix for the heating issue? Mine currently overheats if is set the dimming between 50-90, so I have made a rule that forces the dimming away from this but that is far from ideal. I have 50W led spots connected. Shelly says that trailing edge should solve the issue, so I tried toggling ShdLeadingEdge back and forth to no avail.

tayhall commented 3 years ago

The issue is still on 9.3 release as I tested yesterday as I did see a reference to shelly in one of the 9.2.x chamgelogs.

On Mon, 22 Feb 2021, 14:36 Andreas Frøsig, notifications@github.com wrote:

Has anyone found a fix for the heating issue? Mine currently overheats if is set the dimming between 50-90, so I have made a rule that forces the dimming away from this but that is far from ideal. I have 50W led spots connected. Shelly says that trailing edge should solve the issue, so I tried toggling ShdLeadingEdge back and forth to no avail.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/arendst/Tasmota/issues/9412#issuecomment-783418867, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMKOMXHEVDHU6FABG545LLDTAJTXHANCNFSM4R3W442A .

andreasfrosig commented 3 years ago

Regarding the heating issue it, and this might be obvious for people knowing more about dimmers but: My issue could be fixed by not mixing light bulbs under 1 dimmer. 10 spots and 1 normal bulb made the dimmer overheat, when I unscrewed that 1 build the temperatur is constant at 35 °C. 3 of the same bulb has no problem on an other Shelly dimmer 2. I do not know if it helps anyone else 👍

JeffJefferson commented 3 years ago

Hey guys. setting ShdLeadingEdge to 0 is working for me. seems the default value is not working. I executed the command while power was off. Maybe this is needed, dont know... Didnt need to set value to 1 before. Now temp is constant < 42

jamesturton commented 3 years ago

@JeffJefferson Well spotted! I have just flashed a fresh version of Tasmota onto my device. Querying the current value with ShdLeadingEdge reports as ShdLeadingEdge 0 but then sending the command ShdLeadingEdge 0 does indeed seem to change the dimming mode! Will see if I can find the bug... :)

euro2 commented 3 years ago

i applied ShdLeadingEdge 0 and temp instantly fell! nice find

jovo71 commented 3 years ago

@jamesturton Hi, i am having some issues with the push buttons in Shelly Dimmer 2 running Tasmota 9.5.0 and Dimmer Co-processor Version v51.6. I have configured switchmode1 and switchmode2 to 11. The current behaviour is that with both push buttons i can switch the lamp on/off, but i am not able to dim the light. Is it required to do any additional rule configuration for the dim function to work with the push buttons?

jamesturton commented 3 years ago

Hi @jovo71, please see the Tasmota wiki and this comment

jeroenst commented 3 years ago

@jamesturton Hi, i am having some issues with the push buttons in Shelly Dimmer 2 running Tasmota 9.5.0 and Dimmer Co-processor Version v51.6. I have configured switchmode1 and switchmode2 to 11. The current behaviour is that with both push buttons i can switch the lamp on/off, but i am not able to dim the light. Is it required to do any additional rule configuration for the dim function to work with the push buttons?

Yes:

Backlog SwitchMode 11; SetOption32 10;

Rule1
on system#boot var1 + ENDON
ON switch1#state=2 DO power TOGGLE ENDON
ON switch1#state=4 DO dimmer %var1% ENDON
ON switch1#state=5 DO var1 - ENDON
ON switch1#state=6 DO var1 + ENDON

Rule1 1

Or (untested yet):

Backlog SwitchMode 11; SetOption32 10;

Rule1 
on system#boot do var1 + ENDON
on switch1#state=2 do POWER TOGGLE ENDON
on switch1#state=4 do DIMMER %var1% ENDON
on switch1#state=6 do event upordown=%var1% ENDON
on event#upordown=+ do var1 - ENDON
on event#upordown=- do var1 + ENDON

Rule1 1
heffneil commented 2 years ago

Hey guys I have tasmota running on a shelly dimmer 2. I applied the template, and then uploaded the secondary MCU bin. I only have neutral and hot running to the dimmer on my bench test. When I use my multimeter on N and O - I get 120 volts constant. No matter the status of the web interface on or off button. I am only trying to use this a remote dimmer with no switch (device group control). Any recommendations or suggestions to debug the issue? Running:

Program Version | 11.0.0(tasmota) 2022-02-12T14:13:50 2_7_4_9/2.2.2-dev(38a443e)

Using the secondary MCU bin found here: https://github.com/jamesturton/shelly-dimmer-stm32/releases

not sure if there is a way to confirm it is loaded properly?

JeffJefferson commented 2 years ago

Hey what image did you installed before applying the template? Try this: http://dl.dasker.eu/firmware/mg2tasmota-ShellyDimmer2.zip

And did you follow These instructions:

https://templates.blakadder.com/shelly_Dimmer_2.html

heffneil commented 2 years ago

I had tasmota 11 on there. I had minimal and then I think it updated to full?

I did the switchmode and setoption if that's what you mean?

JeffJefferson commented 2 years ago

Just mean thats how i always do it. Flashing with the mgos to tasmota image for dimmer2, applying the template from the blakadder URL (ensure you check the box for using the template), flashing the mcu linked in the blakadder URL and configuring the dimmer buttons.

ascillato commented 2 years ago

When I use my multimeter on N and O - I get 120 volts constant.

You should try with a dimmable light, not with a multimeter.

heffneil commented 2 years ago

Another time I just tried it and got 16 volts. Does not change with on or off. I should be able to get some voltage that shows when ON and 0 when Off. I don't get that. On and Off (From Tasmota) do not seem to function properly. Reset 5? You guys are successfully able to control your shell dimmer 2s from the tasmota interface? Anyone running 11?

heffneil commented 2 years ago

well good news I think I got it working - thanks all! A Reset 5 and then a restart and playing with some of the trailing vs leading edges. setting the dimming range explicit from 0,255 seems good. I measure 16 volts when off and 125 at the top. The stepping isn't the best on the meter - but I think it will be perfect with lights and a load!

heffneil commented 2 years ago

Maybe spoke too soon. I will try with light - but after some time - I tested it again and still have 120 v when off. Doesn't make sense.

Scoobler commented 2 years ago

@heffneil that is probably caused due to no load on N and O, as @ascillato suggests, put a bulb on and measure the voltage again. Open circuit (Off) can often have floating volts which a meter can measure - as soon as a load is applied this will likely collapse to 0v.

olanwe commented 1 year ago

@jamesturton Hi, i am having some issues with the push buttons in Shelly Dimmer 2 running Tasmota 9.5.0 and Dimmer Co-processor Version v51.6. I have configured switchmode1 and switchmode2 to 11. The current behaviour is that with both push buttons i can switch the lamp on/off, but i am not able to dim the light. Is it required to do any additional rule configuration for the dim function to work with the push buttons? (...) Or (untested yet):

Backlog SwitchMode 11; SetOption32 10;

Rule1 
on system#boot do var1 + ENDON
on switch1#state=2 do POWER TOGGLE ENDON
on switch1#state=4 do DIMMER %var1% ENDON
on switch1#state=6 do event upordown=%var1% ENDON
on event#upordown=+ do var1 - ENDON
on event#upordown=- do var1 + ENDON

Rule1 1

I just stumbled across this thread and thought I might add an additional possibility for pushbutton dimming. If you are using fading mode on your dimmer (fade 1), you may use this technique to get really smooth dimming sweeps without noticable luminance steps by altering the second solution as follows:

RULE1
ON system#boot DO var1 > ENDON 
ON switch1#state=2 DO POWER TOGGLE ENDON 
ON switch1#state=4 DO BACKLOG0 SPEED2 4; DIMMER %var1% ENDON 
ON switch1#state=7 DO BACKLOG0 DIMMER !; EVENT upordown=%var1%; SPEED2 ! ENDON 
ON event#upordown$<> DO var1 < ENDON 
ON event#upordown$<< DO var1 > ENDON

When pressing and holding the button, the fading speed is temporarily modified to speed 4 (command speed2 4) and the dimmer is ordered to sweep up or down (dimmer combined with > or <). As soon as the button is released, the dimmer is ordered to stop at the selected level, reverse dimming direction and the modified fading speed is reset to its original value.

In fact the state=4 trigger would not have to be called periodically here as the sweeping is handled by the dimmer command alone. So this solution should be easily adaptable to a setup with two separate increase/decrease-buttons as well (e.g. just using ON/OFF triggers).

jeroenst commented 1 year ago

Thank you for your feedback! I'm going to give it a try asap