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 2 and Shelly 1 ? #2789

Closed
h-tro opened this issue May 20, 2018 · 112 comments
Closed

Support for Shelly 2 and Shelly 1 ? #2789

h-tro opened this issue May 20, 2018 · 112 comments
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended

Comments

@h-tro
Copy link

h-tro commented May 20, 2018

Hi Theo,

can tasmota get support for Shelly 2?
https://shelly.cloud/shelly2/
Shelly 2 is very small wifi device with 2 relays, power meter and should also use ESP8266.
In most cases, it fits in a German flush mount box (60 mm Ø and 40 mm depth), including the previous switch and is therefore invisible.
I think there are many users who would like to use shelly 2 with tasmota.

@curzon01
Copy link
Contributor

Interesting device (not such low priced as Sonoff devices)
but might be not as simple as it looks because

Has an integrated precise power meter

@reloxx13
Copy link
Contributor

reloxx13 commented May 23, 2018

i think the power meter would not work anymore.

i have read about other devices which power meter and it did not work anymore after flashing tasmota.

@h-tro
Copy link
Author

h-tro commented Jun 20, 2018

I have opened a shelly2 (https://shelly.cloud/shelly2)

It contains an ESP8266EX with 2 MB flash memory (WINBOND 25Q16BVFIG)
and a power monitoring IC MCP39F501 (https://www.microchip.com/wwwproducts/en/MCP39F501)

@senfkorn
Copy link

Hi,

There are 5 pins on the backside of the board. I've traced them out, there are all you need. From top to bottom (3 pin group is top)
RX
TX
VCC

(Groupe of 2)
Gpio 0
GND

@senfkorn
Copy link

Next step,

The two current shunts for the both relais outputs are coupled together to the MCP39F501. So it is not easily possible to measure each output individually.

@h-tro
Copy link
Author

h-tro commented Jun 30, 2018

Hi senfkorn,

yes, I can confirm the assignment of the pins on the backside of the board.
I have the same result.

@tmarquespt
Copy link

Hi, anyone successfully installed tasmota on Shelley? Even without the power meter feature?

@NCC1701G
Copy link

NCC1701G commented Aug 7, 2018

Hi, I bought the Shelly 1.
Link
He has none power meter feature but he ist very cheap and fits also in a German flush mount box.

Is it possible to support this?

@h-tro
Copy link
Author

h-tro commented Aug 8, 2018

Hi,

Shelly 1 is new. I will order one.
I think you can flash tasmota and use the module type "Generic" over the web interface and set up the GPIO config for shelly1
(GPIO's see https://shelly.cloud/shelly1-open-source/)

@cko-skverlag
Copy link

Where is the need of flashing the shelly (1)? Doesn't it work without cloud connection as the sonoff do? Thanks

@curzon01
Copy link
Contributor

If you do not like having your home devices in a foreign cloud system, Tasmota is a one of the best alternative firmware.

And to get it work you need to flash.

@cko-skverlag
Copy link

cko-skverlag commented Aug 19, 2018 via email

@JPe2
Copy link

JPe2 commented Aug 20, 2018

#2789 (comment)
@h-tro Did you manage to flash the Shelly-1 with Tasmota firmware already?

@cko-skverlag
Copy link

cko-skverlag commented Aug 20, 2018 via email

@kuzba
Copy link

kuzba commented Aug 22, 2018

Here is nice video, showing tasmota on shelly1 with ready to flash binary. https://www.youtube.com/watch?v=J20hxfUTP9I

@tmarquespt
Copy link

I have succefully flashed tasmota on the shelly1 with the .bin from link that kuzba posted.
The wifi manager mode didn't started (or at least I couldn't use it) so I had to manualy set it up with serial commands using Termite.
That .bin file already has options for the shelly1 and shelly2 so I believe the guy from TheHookUp had them both working. I'm going to flash shelly2 and let you know.

@kuzba
Copy link

kuzba commented Aug 23, 2018

Are you able to run shelly again from mains (eg 230V)? I somehow destroyed the device (shelly1), it runs only from 3.3V pin header. But I probably swapped L and N wire, not sure if this can cause the trouble. So I am without toy now.

@benzino77
Copy link

@tmarquespt let us know how to solder wires to flush shelly 2

@tmarquespt
Copy link

@benzino77 senfkorn already exaplined the pinout on the 5th post of this page. I'm still thinking on how to do it as I would avoid soldering such small pins. I'll probably make a connector with some needles and flash it without soldering.
@kuzba Mine is working. Changing L with N should make no difference as this is AC I have mine with a plug to the wall socket so I have no ideia which is the L or the N. Why do you say it's not working? It has no light. Try to connect with Termite (Mains OFF, gpio out) and send an AP command in order to see if it responds. Beaware that the connection scheme is different from the sonoff as the current does not go trough the relay by default and you have to inject it (as explained in the picture of the shelly manual included in the box)

@kuzba
Copy link

kuzba commented Aug 23, 2018

@tmarquespt when running from mains, device gets really hot and does not connect to AP. When running from 3.3V thru pin header, connects to AP and responds to commands. I guess power supply is KO. PCB schematics will help.

@tmarquespt
Copy link

@kuzba That is strange indeed. I can feel some temperature on mine but nothing out of the ordinary. It just might be an issue with the unit, you should try to return it and get a new one.

FYI: Theo just made Tasmota compatible with Shelly "Only INPUT available in v6.1.1.9 as Button1n option. See changelog."

@arendst
Copy link
Owner

arendst commented Aug 23, 2018

In the video GPIO05 is selected as Switch1.

I prefer to use Button1 as it will allow using the webpage for toggling the relay.

  { "Shelly1",         // Shelly 1 (ESP8266 - 2MB)
     GPIO_SWT1,        // GPIO00 Switch
     GPIO_USER,        // GPIO01 Serial RXD and Optional sensor
     0,
     GPIO_USER,        // GPIO03 Serial TXD and Optional sensor
     GPIO_REL1,        // GPIO04 Relay (0 = Off, 1 = On)
     GPIO_KEY1_NP,     // GPIO05 Button
     0, 0, 0, 0, 0, 0, // Flash connection
     0, 0, 0, 0, 0, 0
  }

Can anyone confirm that the above config works as expected?

@h-tro
Copy link
Author

h-tro commented Aug 23, 2018

Compiling error 6.1.1.9

@benzino77
Copy link

...senfkorn already exaplined the pinout on the 5th post of this page...

That's true, but one or two pictures will be just great.

@papaloewe
Copy link

Here is the Webpage where the video comes from:
http://www.thesmarthomehookup.com/the-shelly-1-smart-relay-is-it-better-than-the-sonoff-basic/

@ethan4
Copy link

ethan4 commented Aug 23, 2018

In this video he says the pull-up resistors have to be disabled, can that be done as part of the module preset? https://youtu.be/J20hxfUTP9I?t=416

@tmarquespt
Copy link

@benzino77 Sure :)
@senfkorn / @h-tro Can you confirm that this is correct?

shelly2_pinout

@tmarquespt
Copy link

@ethan4 It should be working on the last version of Tasmota v6.1.1.9. If you want to make that change it has to be on the source before compile. You cannot change that after flashing. You might just flash the .bin file that is on the description of that video. Then you just select Shelly1 Module from configuration.

@valerie16901
Copy link

valerie16901 commented Sep 10, 2018

Hello everyone!
I just bought a shelly 2 to use on my rollershutter and I plan to connect the switches output (SW) to my physical switch that looks like this one, so only one relay will be active each time by the rollershutter switch (hardware interlocking), I am still going to set the software interlocking using SetOption14 1 / on. Now, if I send the MQTT/http command to activate the 1st relay while the psychical button has the 2nd relay active, will I burn my shelly or the motor? or will the hardware switch be ignored giving priority to the 1st relay? Thank you guys :)

@papaloewe
Copy link

papaloewe commented Sep 12, 2018

Should Shelly 4 pro work with Tasmota too?
https://shelly.cloud/shelly-4-pro/
Except for the power metering function, that's clear.

@TD-er
Copy link

TD-er commented Sep 14, 2018

@papaloewe Nope, that one doesn't have an ESP8266

@arendst
Copy link
Owner

arendst commented Sep 16, 2018

Let's continue....

img_20180916_125058

@eazuka
Copy link

eazuka commented Sep 17, 2018

awesome

@arendst
Copy link
Owner

arendst commented Sep 17, 2018

We have vision:

image

On to calibration as the voltage is 5% off, Current is 40% off, Power is 30% off and frequency ?%. The energy monitoring chip has a lot to give.

@thecode
Copy link

thecode commented Sep 17, 2018

Very good work.
Multiplying Voltage*Current gives almost the same power as in your screenshot.
I assume one is calculated from another, so maybe only the current is way off, the device has some internal calibration routines. Frequency is probably correct.
Can you share the code for the MCP39F501? I can try to compare to the datasheet.

arendst added a commit that referenced this issue Sep 17, 2018
Add uncalibrated energy monitoring to Shelly2 (#2789)
@arendst
Copy link
Owner

arendst commented Sep 17, 2018

Have a look in the file xnrg_04_mcp39f501.ino for more background information like datasheet and original olimex code used by Shelly2.

To use it add define

#define USE_MCP39F501      // Add support for MCP39F501 Energy monitor as used in Shelly 2

to either user_config.h or user_config_override.h to compile.

Then select module Shelly2.

@meingraham
Copy link
Collaborator

@arendst Congrats. And no smoke this time ;-)

re: Shelly 1 - is support for that module to configure it as a Basic and use switch setting for its switch input? Or does Shelly 1 have its own module type selection?

Thanks.

Mike

@arendst
Copy link
Owner

arendst commented Sep 17, 2018

To keep the smoke inside:

img_20180917_205606

Both Shelly 1 and Shelly2 are available as module selection in the development branch.

This also to make sure no-one gets the idea of attaching sensors to it as every metal part of the tiny box contains hazardous voltages.

@meingraham
Copy link
Collaborator

@arendst

Thanks for the dedicated module type.

re: sensors - understood. The only external input I plan on using these for are for light switches. In addition to the Shelly 1 "built in" flashing pins, I think it'll be ideal for placement in US circuit boxes due to its "sealed" shell and compact size.

For other non closed-in use cases, I still intend to use the Sonoff devices.

Mike

@digiblur
Copy link
Contributor

I don't know anyone who would hook up sensors. Ha. You could also power with your own certified DC power supply if needed to make it even safer than throwing it in a box. That's what I did on one of my installs since I had a long lead coming off of it.

arendst added a commit that referenced this issue Sep 21, 2018
Add energy monitoring to Shelly2 (#2789)
@arendst
Copy link
Owner

arendst commented Sep 21, 2018

Just released Shelly2 energy monitoring.

To calibrate mount a resistive load with known voltage, current and power and execute commands VoltageSet 234.5 for volts, and/or CurrentSet 123.4 for milliamps, and/or PowerSet 25.6 for watts.

If you know your line frequency you may execute command FrequencySet 50.34 for Hz.

Expect problems when executing all commands ad once using Backlog as all changes are being send to the Energy Monitoring chip via 4800 bps serial.

Shouldn't be a problem as you are supposed to this only once.

@arendst arendst added the fixed Result - The work on the issue has ended label Sep 23, 2018
@plckr
Copy link

plckr commented Sep 24, 2018

I have two shelly 2 flashed with version 6.2.1 and still got the issue below. Anyone has found a workaround to this?

@h-tro h-tro

Hi, I've successfully flopped your file, the switching also works, but the Shelly always goes on and off, always after about 1 minute without me doing anything

do you have an idea what it can be?

  1. `07:58:19 RSL: STATE = {"Time":"2018-08-26T07:58:19","Uptime":"0T00:05:13","Vcc":3.201,"POWER":"OFF","Wifi":{"AP":2,"SSId":"Kabe","RSSI":78,"APMac":"xx:xx:xx:CC:10:16"}}
  2. 07:58:19 RSL: SENSOR = {"Time":"2018-08-26T07:58:19","Switch1":"ON"}
  3. 07:59:14 RSL: RESULT = {"POWER":"ON"}
  4. 07:59:14 RSL: POWER = ON
  5. 08:01:08 RSL: RESULT = {"POWER":"OFF"}
  6. 08:01:08 RSL: POWER = OFF
  7. 08:02:00 RSL: UPTIME = {"Time":"2018-08-26T08:02:00","Uptime":"0T00:08:54"}
  8. 08:03:01 RSL: RESULT = {"POWER":"ON"}
  9. 08:03:01 RSL: POWER = ON
  10. 08:03:07 APP: Serielles Logging deaktiviert
  11. 08:03:19 RSL: STATE = {"Time":"2018-08-26T08:03:19","Uptime":"0T00:10:13","Vcc":3.192,"POWER":"ON","Wifi":{"AP":2,"SSId":"Kabe","RSSI":96,"APMac":"xx:xx:xx:CC:10:16"}}
  12. 08:03:19 RSL: SENSOR = {"Time":"2018-08-26T08:03:19","Switch1":"ON"}
  13. 08:03:25 RSL: RESULT = {"POWER":"OFF"}
  14. 08:03:25 RSL: POWER = OFF
  15. 08:04:02 RSL: RESULT = {"POWER":"ON"}
  16. 08:04:02 RSL: POWER = ON
  17. 08:04:54 RSL: RESULT = {"POWER":"OFF"}
  18. 08:04:54 RSL: POWER = OFF
  19. 08:05:04 RSL: RESULT = {"POWER":"ON"}
  20. 08:05:04 RSL: POWER = ON
  21. 08:06:25 RSL: RESULT = {"POWER":"OFF"}
  22. 08:06:25 RSL: POWER = OFF
  23. 08:08:19 RSL: STATE = {"Time":"2018-08-26T08:08:19","Uptime":"0T00:15:13","Vcc":3.211,"POWER":"OFF","Wifi":{"AP":2,"SSId":"Kabe","RSSI":92,"APMac":"xx:xx:xx:CC:10:16"}}
  24. 08:08:19 RSL: SENSOR = {"Time":"2018-08-26T08:08:19","Switch1":"ON"}
  25. 08:09:14 RSL: RESULT = {"POWER":"ON"}
  26. 08:09:14 RSL: POWER = ON
  27. 08:09:29 RSL: RESULT = {"POWER":"OFF"}
  28. 08:09:29 RSL: POWER = OFF`

@ascillato
Copy link
Contributor

Shelly is supported only in the development version (now it is 6.2.1.6)

download it from http://thehackbox.org/tasmota/

@arendst
Copy link
Owner

arendst commented Sep 25, 2018

Wiki entry released. Feel free to update.

https://github.com/arendst/Sonoff-Tasmota/wiki/Shelly-1-and-2

@plckr
Copy link

plckr commented Sep 25, 2018

Thanks for the wiki. I'm testing shelly 2 with latest version 6.2.1.6 and I think the issue of turning on and off automatically is still present. This only occurs if it's connected a switch. I'll keep you updated

@arendst
Copy link
Owner

arendst commented Sep 25, 2018

@ricreis394 pls open a new issue for your problem.

Overall shelly does not do what you experience.

@h-tro
Copy link
Author

h-tro commented Sep 25, 2018

@ricreis394
I have only tested Shelly 1 with external switch.
The problem does not occur with Shelly1 (Tasmota version 6.2.1.6)

I will test Shelly2 with external switches in the next few days.

@kiwijunglist
Copy link

I flashed my first shelly2 ok.

The 2nd one isn't working well.
In the terminal i see "00][00][00][00][00][00][00]"... repeating...
Have tried repeat flashings.

@oremic
Copy link

oremic commented Nov 16, 2018

Hi gpio Shelly 2 ?

@ascillato2
Copy link
Collaborator

@oremic Shelly2 is already implemented in Tasmota. You need just to select shelly 2 in module config to make it work.

If you want to see the module template, see the file sonoff-template.h

@oremic
Copy link

oremic commented Nov 16, 2018

@oremic Shelly2 is already implemented in Tasmota. You need just to select shelly 2 in module config to make it work.

If you want to see the module template, see the file sonoff-template.h

thanks

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
Development

No branches or pull requests