Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for shelly dimmer #6914

Closed
bloodhound83 opened this issue Nov 12, 2019 · 267 comments · Fixed by #9905
Closed

Support for shelly dimmer #6914

bloodhound83 opened this issue Nov 12, 2019 · 267 comments · Fixed by #9905
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended

Comments

@bloodhound83
Copy link

bloodhound83 commented Nov 12, 2019

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

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

I would like to order the new "Shelly Dimmer" and currently do not see a template. Has anyone ever tested the device or even run it with a different setting from another device?

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

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

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

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

@ascillato
Copy link
Contributor

ascillato commented Nov 12, 2019

Shelly didn't start shipping those devices. No one have them, so we don't know if Tasmota can be flashed or not on them. Anyway, The stock firmware of Shelly supports MQTT, so if Tasmota don't work, you can still use them with your Home Automation Software.

I have pre-ordered those a month ago, so I will test them as soon as they arrive.

@bloodhound83
Copy link
Author

@ascillato thank you for your quick answer.
I received my shipping message yesterday, so I assume that some devices have been shipped. But i guess you are right, i have only to wait a couple of days / weeks to get an answer...

good hint regarding the mqtt support from the stock firmware....

@ascillato2
Copy link
Collaborator

👍

@ascillato2 ascillato2 added the question Type - Asking for Information label Nov 12, 2019
@jj-uk
Copy link

jj-uk commented Nov 25, 2019

My shelly dimmers arrived today. Have you had any time to see if Tasmota can be flashed on to them? Sorry to bother you.

@ascillato
Copy link
Contributor

Hi,

Mine have arrived too. It has an ESP8266, so it might be possible to use Tasmota on it, but will require some more research due to it uses several other chips for controlling the dimming.

So, please be patient ;)

@meingraham
Copy link
Collaborator

Some high res photos provided by @dino on Discord - for future reference:
https://onedrive.live.com/?authkey=%21AEmy6Ok03JXOMbk&id=CA999BBC242363E5%21115610&cid=CA999BBC242363E5

@jj-uk
Copy link

jj-uk commented Nov 25, 2019

Maybe an email to their support dept. Asking for a simple sketch to demo dimming? Can't hurt to ask...
They'll sell more once it's been tasmotafied. :D

@djhk739
Copy link

djhk739 commented Nov 26, 2019

I had two delivered over the weekend along with a Shelly 1PM. Got tasmota successfully flashed on the 1PM, but no joy with the dimmers. I was using the diagram from the Shelly site for the header pin-outs but the programmer could not connect. This evening I wired up both dimmers and set them up with the Shelly software and new firmware was available, so have updated them but not tried to re-flash yet. D

@SwedishChef
Copy link

I successfully flashed the dimmer!
I also had the problem that the programmer could not connect, so I opened the housing and connected again. What I did ' wrong' at this time was that I connected all the wires in mirrored order by accident - and flashing suddenly succeeded. So my guess is that the documentation for the pin-out is wrong (mirrored).
I already requested the GPIO mapping to configure Tasmota but did not get a reply so far...

@djhk739
Copy link

djhk739 commented Nov 26, 2019

Great news SwedishChef, when you say ‘mirrored’ do you mean they’ve got ‘top to bottom’ mixed up? D

@SwedishChef
Copy link

The problem is that after opening the housing and flashing I recognized that the device was turned around 180 degrees compared to the pin-out picture on shell home page.
As I still connected the needed wires as described, it was most probably 'top-to-bottom mixed up'. Give it a try :-)
I already sent a message to Shelly to get this clarified.

@djhk739
Copy link

djhk739 commented Nov 27, 2019

Yup, got mine flashed as well, now moving on to the GPIO assignments.

@SwedishChef
Copy link

@djhk739 please share your results for GPIO assignment here - many thanks.

PS: still no answer from shell.org regarding this ;-(

@kovaga
Copy link

kovaga commented Nov 29, 2019

I've sent them an email re. tasmota template support 2 days ago as well, but no replay so far.
Usually they are pretty fast on replying.

@phatina
Copy link

phatina commented Nov 30, 2019

I've sent them an email re. tasmota template support 2 days ago as well, but no replay so far.
Usually they are pretty fast on replying.

Where can I get this template? What's the current status, please?

@ascillato
Copy link
Contributor

ascillato commented Nov 30, 2019

There is no Tasmota template for shelly dimmer at this moment. It requires more code modifications and reverse engineering. It will take some time on being developed.

As soon as it becomes available, it is going to be announced here and in the Tasmota support chat.

By now, you can use Shelly Dimmer with stock firmware. It has mqtt support and there is also an automatic discovery for shelly devices if you use home assistant with hacs component.

@SwedishChef SwedishChef mentioned this issue Dec 2, 2019
@bastian987
Copy link

Thanks a lot for your efforts! Highly appreciated.

@jj-uk
Copy link

jj-uk commented Dec 5, 2019

Anyone heard back from Shelly yet? I had a reply to my request for the source code and/or schematics as the product is sold as "open-source" (written on the box packaging).

Turns out it's not open-source at all and they're not going to give me the code :/

So I've asked for an example sketch to highlight how to perform dimming instead....

@SwedishChef
Copy link

Just for me to understand the problem:
Why configuring function PWMx to the corresponding GPIO pin via tasmota template does not work in case of Shelly dimmer? Do they use some different (non-standard) approach to dim the output?

@ascillato
Copy link
Contributor

As explained in previous comments. Shelly dimmer has other mcu to control dimming. It requires a new driver to be coded and a lot of reverse engineering. Tasmota is not going to work as it is now.

@phatina
Copy link

phatina commented Dec 5, 2019

Anyone heard back from Shelly yet? I had a reply to my request for the source code and/or schematics as the product is sold as "open-source" (written on the box packaging).

Turns out it's not open-source at all and they're not going to give me the code :/

So I've asked for an example sketch to highlight how to perform dimming instead....

Aaah, I asked them the same question but with no answer.

@mgoeller
Copy link

Indeed, the pinout reference on the official Shelly website is wrong. I figured out most of the connections of the second (outer) row of the header on the PCB. The right (inner) row corresponds to the flashing connections of the ESP8266, the outer row for the STM32F031K6.

Did someone figure out the communication between the ESP and the MCU? Serial? Why did Shelly decide to breakout GPIO2 (U1TX) of the ESP on the header?
IMG_1377
Screenshot 2019-12-23 at 13 28 35

@joba-1
Copy link
Contributor

joba-1 commented Dec 23, 2019

an STM32 with all flash/debug pins broken out ... interesting!

@mgerald21
Copy link

I followed the esp8266 rx/tx traces and both are connect via 200R resistors to the stm32 PA9/PA10.
So I'm pretty sure both MCUs use the uart for communication.

Did someone manage to dump the flash of the esp? I'm unable to connect with esptool.py.

@jj-uk
Copy link

jj-uk commented Jan 2, 2020

Snooping the esp gpio whilst sending dim commands would be a good start. My logic analyser is not mains rated so I can't do this.
Anyone have a scope that can record ?

@mgerald21
Copy link

mgerald21 commented Jan 2, 2020

I did make some progress ...
I was able to read the esp dimmer firmware with esptool, but stm32 needs to be held in reset state by keeping NRST on ground.

Digging into firmware shows, that shelly dimmer is based on rBoot with dual image support and 256k spiffs. spiffs holds an stm.bin file which is very likely an stm32 firmware image!? Maybe shelly dimmer also supports OTA update of the stm32 MCU?

@alistercole
Copy link

alistercole commented Nov 16, 2020

@jamesturton,
Many thanks for all your hard work on this firmware.

Once this firmware is merged back into the stable branch of Tasmota, is it going to be necessary to flash the STM32 chip separately to flashing Tasmota onto the dimmer, or is the STM32 firmware somehow going to be embedded in the Tasmota firmware?

And if it is necessary to flash the STM32 in a separate process, can you please point me to a resource to help through that?

@jamesturton
Copy link
Contributor

@alistercole Tasmota will handle updating the STM32. You will not have to flash the STM32 with a ST-Link programmer if that's what you mean.

@ascillato2
Copy link
Collaborator

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

@ascillato2 ascillato2 added enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended and removed Requires more research (devs) Action - Issue requires more research feature request (devs?) Action - awaiting response from developers help needed Action - Asking for help from the community labels Nov 16, 2020
@stefxx
Copy link

stefxx commented Nov 16, 2020

Thanks @jamesturton !!!

@jamesturton
Copy link
Contributor

@rbswift I've tried to reproduce the flickering error you are seeing but I can't seem to do it. If you (or @daxy01) are still having problems then make a new issue and tag me in it and I can try and help you out again. It would be good if you could post a video of the flickering so I can get more of an idea of what the cause might be.

@daxy01
Copy link

daxy01 commented Nov 16, 2020

In my instance the flickering feels like a too-low refresh rate of the lamps. I cannot record is at normal speed (guess the phone refresh rate is of effect as well), but when I record as slow-motion it will be visible. I did check slow mo recording of a regular non-dimmed bulb and there it is constant on.

flickering.mp4.zip

@digitalface
Copy link

@daxy01 thank you for your installation instructions - #6914 (comment) - I used this and flashed my Shelly 1 (UK) with no problems. I'm using 3x GU10 5watt lamps and after adjusting the minimum brightness to 15 they work very well. Can I ask though how you managed to find the download link for v1.3? Just in case I need to update the Tasmota version in future. Or an I just go through the OTA update option on the WebUI now?

FYI anyone who wants to use this with Alexa (I do not use HA), set emulation to Hue and it'll be found.

@digitalface
Copy link

...Also energy monitoring (wattage) and temperature seem off. My Shelly 1 shows 7W constant with the LED's off or on and the temperature stays around 41c regardless. Not sure if these issues are to be listed here of if I need to open a separate ticket?

@digitalface
Copy link

In my instance the flickering feels like a too-low refresh rate of the lamps. I cannot record is at normal speed (guess the phone refresh rate is of effect as well), but when I record as slow-motion it will be visible. I did check slow mo recording of a regular non-dimmed bulb and there it is constant on.

flickering.mp4.zip

I wasn't noticing this before but I definitely notice it now. If I look directly at the bulb then the flickering isn't there, but if I look away I notice it on all 3. It becomes more noticable when the bulbs are brighter but that seems like an obvious thing. This definitely didn't happen on original firmware - I've had the Shelly installed since February this year.

@digitalface
Copy link

digitalface commented Nov 22, 2020

Hi @jamesturton

Do I need to create a new post or am I okay to continue here? My Shelly 'flickering' since updating has gotten to a point where I'm unable to use it now (it hasn't gotten worse, I just notice it more) and have replaced the Shelly with an on/off switch. Unfortunately I didn't take a backup of the original Shelly firmware (not sure if I was ever able to) so cannot revert back.

Do you require any logs etc from me to try and diagnose/fix the issue?

@jamesturton
Copy link
Contributor

@digitalface Can you make a new issue on the shelly-dimmer-stm32 firmware repo?

@daxy01
Copy link

daxy01 commented Nov 25, 2020

I've created a new issue. Thanks!
See: jamesturton/shelly-dimmer-stm32#2

@daxy01
Copy link

daxy01 commented Nov 28, 2020

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.html

@fretzy99
Copy link

https://onedrive.live.com/?authkey=%21AEmy6Ok03JXOMbk&id=CA999BBC242363E5%21115610&cid=CA999BBC242363E5

Do you happen to know where the wifi antenna/connector is? Trying to add a small external antenna to this in an effort to boost wifi connectivity reliability.

@jamesturton
Copy link
Contributor

@fretzy99 The antenna is the stiff copper wire sticking out of the board. It looks like it might be possible to solder a U.FL connector between the antenna pad (after removing the internal antenna first) and then using a U.FL to SMA cable out of the housing.
image
Let us know how it goes!

Bascht74 added a commit to Bascht74/templates that referenced this issue May 2, 2021
@AndreKR
Copy link

AndreKR commented Jul 16, 2021

I'm curious, is there a particular reason why we flash a custom firmware into the STM32? From Tasmota's point of view isn't the STM32 just like any other custom peripheral like a CSE7766 or the MCU in Tuya devices?

@jamesturton
Copy link
Contributor

I'm curious, is there a particular reason why we flash a custom firmware into the STM32? From Tasmota's point of view isn't the STM32 just like any other custom peripheral like a CSE7766 or the MCU in Tuya devices?

@AndreKR There is no strict requirement for flashing the custom firmware to the STM. The custom STM firmware was designed to use the same communication protocol as the stock firmware. But I believe Shelly has now made changes to the protocol which make it incompatible, and since Shelly have always ignored or rejected our requests for them to publish the protocol they use, we have had to reverse engineer it which takes time...

The other main reason is that the alternative firmware is open-source so others have contributed fixes to 'flickering' problems which have been seen with the stock firmware and earlier versions of the open-source firmware.

@oliv3r
Copy link

oliv3r commented Jan 10, 2025

Just to put this here for google with regards tot he Shelly Dimmer 2.

I couldn't find anywhere what ESP_DBG_TX was used for, and after a quick probe, it seems to go to GPIO02, which would be UART1_TX (second UART) according to some sources for the ESP8266EX.

I saw that https://templates.blakadder.com/shelly_Dimmer_2.html puts it as 'None' which I think is probably wrong, but clicking the 'edit' button didn't yield anything that I could decipher :)

Further more, the button on the rear is tied to GPIO13, with pullup and is inverted.

Finally, GPIO09 and GPIO10 are certainly routed (via via's but those end up underneath the flash chip, so it's reasonable fair to assume that these are IO2 and IO3 making it a quad IO serial flash device. Finally, just for completeness sake, we have a XT24F16F 16M (2 mb) quad I/O capable SPI nor flash chip. I've tested it insofar that I used D1-wroom-02 for the 2M flash size, but before used esp01-1m, which in essence test the 2M and qio capabilities.

I've opened a merge request with platform.io platformio/platform-espressif8266#323

@jamesturton anybody that could update the blackadder site with the correct info or help me decipher how the pinouts are defined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended
Projects
None yet