shelly-homekit icon indicating copy to clipboard operation
shelly-homekit copied to clipboard

Shelly Plug US support (gen 1 / not Plus)

Open Numbski opened this issue 3 years ago • 40 comments

103016521 shelly_update.c:168     Starting ota from http://rojer.me/files/shelly/shelly-homekit-ShellyPlug.zip
103521936 mgos_ota_http_clien:270 Update URL: http://rojer.me/files/shelly/shelly-homekit-ShellyPlug.zip
104063910 mgos_ota_core.c:253     Starting, timeout 240, commit timeout 0, mem 36244
104075316 mgos_ota_core.c:487     FW: shelly-plug2 esp8266 2.9.3 20210714-210002/2.9.3-g2f89855-master
104080117 shelly_update.c:90      BEGIN: shelly-plug2
104085763 shelly_update.c:98      will not update shelly-plug-u1 with shelly-plug2

I could override this manually and force it to go, as I seriously doubt the esp8266 inside is wired differently, and I do have the ability to hot-air it off and manually flash it back to something usable, but I thought I'd ask about it prior to attempting that!

Numbski avatar Jul 29 '21 22:07 Numbski

As it turns out, it's a good thing I didn't! I was completely wrong - the GPIOs are used differently between the plug and the plug US.

https://templates.blakadder.com/shelly_plug_US.html and https://templates.blakadder.com/shelly_plug.html

Shelly Plug US (shelly-plug-u1)

GPIO # Component
GPIO00 Led1
GPIO01 None
GPIO02 Led2i
GPIO03 None
GPIO04 Relay1
GPIO05 BL0937 CF
GPIO09 None
GPIO10 None
GPIO12 HLWBL SELi
GPIO13 Button1
GPIO14 HLWBL CF1
GPIO15 LedLink
GPIO16 None
FLAG None

Shelly Plug (shelly-plug-2)

GPIO # Component
GPIO00 None
GPIO01 None
GPIO02 None
GPIO03 None
GPIO04 Relay 1
GPIO05 HLW8012 CF
GPIO09 None
GPIO10 None
GPIO12 Button_i 1
GPIO13 Led 1
GPIO14 Led 2
GPIO15 None
GPIO16 Led 3
GPIO17 None

Looks like some GPIO wrangling needs to be done.

Numbski avatar Jul 29 '21 22:07 Numbski

The reason why it doesn't flash is that the US plug has a different name then the (EU) plug2, shelly-plug-u1 vs shelly-plug2. During the update the name of the current and the new firmware is compared and the flash will be aboard if not match.

I think you mixed some things: There are 3 Shelly plugs out there

  1. Shelly Plug
  2. Shelly Plug 2
  3. Shelly Plug US

The pinout you listed as "Shelly Plug (shelly-plug-2)" is that one of the "Shelly Plug", but the "Shelly Plug US" is more like the "Shelly Plug2".

I can give you a test build for the Plug US, but I have no test hardware at hand so I need to trust the Tasmota template, so it can happen that it brick your device.

timoschilling avatar Jul 30 '21 09:07 timoschilling

I have 4 sitting here and the ability to pop it open and manually re-flash, so let’s do it. :)

Also, I did paste froM the tasmota template for us, but I was initially confused.

Numbski avatar Aug 01 '21 14:08 Numbski

@Numbski ok, try this one - http://rojer.me/files/shelly/shplgu1.zip built from the commit above, i think it might work. if it does, please report if power consumption figures look ok (a good way to test is pluggin a heater, or a a fan, or iron and comparing power consumption numbers). also, let me know if system temperature in web ui looks reasonable (should be 45-60C or thereabouts). also please test reverting back to stock.

rojer avatar Aug 02 '21 00:08 rojer

Thank you for that. My mother-in-law is critically ill, and we had to leave on a moments’ notice to get to her, and my return timeline is unknown. I will get to this when I can. I am so sorry for you to go to that effort then make you wait. I may be able to do it remotely, but that may not be feasible.

Tony Shadwick

Numbski avatar Aug 03 '21 13:08 Numbski

@Numbski oh, sorry to hear that! don't worry, there's absolutely no rush with this.

rojer avatar Aug 03 '21 13:08 rojer

@Numbski ok, try this one - http://rojer.me/files/shelly/shplgu1.zip built from the commit above, i think it might work. if it does, please report if power consumption figures look ok (a good way to test is pluggin a heater, or a a fan, or iron and comparing power consumption numbers). also, let me know if system temperature in web ui looks reasonable (should be 45-60C or thereabouts). also please test reverting back to stock.

I was able to try the OTA update with this build, but it doesn't take for me.

ryanshuck avatar Aug 04 '21 02:08 ryanshuck

This issue is stale because it has been open 30 days with no activity. Comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 04 '21 02:09 github-actions[bot]

@Numbski any updates with your testing?

timoschilling avatar Sep 04 '21 07:09 timoschilling

Not yet. I am back in town though, will try tomorrow.

Tony Shadwick

Numbski avatar Sep 05 '21 22:09 Numbski

I'd be willing to test a new firmware on my plug if needed. It appears the previous iteration didn't work?

just-inlewis avatar Jul 19 '22 20:07 just-inlewis

I tried compiling @rojer 's commit after rebasing master but the firmware doesn't apply for me either.

{"ts":1658371765.180, "level":2, "data":"mgos_ota_core.c:656     FW: shelly-plug-us1 esp8266 2.11.1 20220721-022206/2.11.1-3-g1f555d8-dirty sig 0x00\n"}
{"ts":1658371765.191, "level":2, "data":"shelly_update.cpp:242   Signature check: 00\n"}
{"ts":1658371765.198, "level":0, "data":"shelly_update.cpp:234   Wrong app name 'shelly-plug-us1'\n"}
{"ts":1658371765.206, "level":2, "data":"mgos_ota_core.c:1051    Update finished, result -13 (Aborted by event handler)\n"}```

just-inlewis avatar Jul 21 '22 02:07 just-inlewis

Has the name changed for my plug? {"name":null,"id":"shellyplugus-XXXXXXXX","mac":"XXXXXXXX","model":"SNPL-00116US","gen":2,"fw_id":"20220211-132652/plugusprod2_app-gcb4621f","ver":"plugusprod2","app":"PlugUS","auth_en":false,"auth_domain":null}

just-inlewis avatar Jul 21 '22 03:07 just-inlewis

What is the state of Shelly Plug US support? yay or nay?

Attempted to install shelly-homekit today (after updating to latest stock firmware) and I get stuck with this message: "Trying to update from http://shelly.rojer.cloud/update."

Cheers and Thanks

evanpierre avatar Aug 31 '22 00:08 evanpierre

I had a death in my family last year about the time a test build was made available, and I never got around to testing it. I have five of them here, so I really should get on that.

Numbski avatar Sep 02 '22 19:09 Numbski

There is no support for "Shelly Plus Plug US"?

slvr85 avatar Sep 07 '22 18:09 slvr85

First off @Numbski, so sorry for your loss. Hope you and your family have been doing well.

I've tried to compile @rojer's commit linked above, but am getting some build errors. I can wade in and try to work around them myself, but maybe this is the wrong path entirely. Anyone have suggestions?

/Users/raphael/Downloads/shelly-homekit/src/shelly_main.cpp: In function 'void shelly::InitApp()':
/Users/raphael/Downloads/shelly-homekit/src/shelly_main.cpp:955:58: error: too few arguments to function 'void mgos_hap_add_rpc_service_cb(HAPAccessoryServerRef*, void (*)(HAPAccessoryServerRef*), void (*)(HAPAccessoryServerRef*))'
  955 |   mgos_hap_add_rpc_service_cb(&s_server, StartHAPServerCB);
      |                                                          ^
In file included from /Users/raphael/Downloads/shelly-homekit/src/shelly_main.cpp:24:
/Users/raphael/Downloads/shelly-homekit/deps/homekit-adk/include/mgos_hap.h:126:6: note: declared here
  126 | void mgos_hap_add_rpc_service_cb(
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [/Users/raphael/Downloads/shelly-homekit/build_ShellyPlugUS1/objs/shelly_main.cpp.o] Error 1

RaphiePS avatar Oct 22 '22 17:10 RaphiePS

There is no support for "Shelly Plus Plug US"?

I too would like support for the Shelly Plus Plug US please. Then I can flash all my shelly stuff, hopefully, and stop using the Shelly Bridge via HOOBS. :)

gedeyenite avatar Dec 02 '22 23:12 gedeyenite

here is a new build of @rojer commit, please test it, it it works the next release will support PlugUS. ~PlugUS.zip~ Edit: out dated files removed, for newer version see 4 comments later

timoschilling avatar Feb 01 '23 12:02 timoschilling

here is a new build of @rojer commit, please test it, it it works the next release will support PlugUS.

Sir- I am unsure how to install the plugin from a ZIP file in HOOBS, if that is even possible. Can it be installed through the HOOBS interface? I would love to test it out.

gedeyenite avatar Feb 01 '23 15:02 gedeyenite

curl -F [email protected] http://shelly.local/update, you must replace shelly.local with the hostname or ip of your Shelly

timoschilling avatar Feb 01 '23 18:02 timoschilling

Hi @timoschilling, thanks so much for your work on this. I tried the above command with your new PlugUS.zip and got a -13 Aborted by event handler response. Is there something else I should try?

RaphiePS avatar Feb 02 '23 19:02 RaphiePS

here is a new build http://rojer.me/files/shelly/misc/shelly-homekit-ShellyPlugUS.zip, now it can be flash like every other shelly too. http://a.b.c.d/ota?url=http://rojer.me/files/shelly/misc/shelly-homekit-ShellyPlugUS.zip

timoschilling avatar Feb 02 '23 22:02 timoschilling

Doesn't seem to be working for me, no specific error given. I'm on the Shelly 0.12 firmware, do you think that might be an issue?

RaphiePS avatar Feb 04 '23 20:02 RaphiePS

@RaphiePS do you have a Plug US or a Plus Plug US? If you say you have version 0.12 it sounds like a Plus Plug US, the firmware from this PR is for the old Plus US without Plus. Support for the Plus version will follow in the future.

timoschilling avatar Feb 05 '23 12:02 timoschilling

@timoschilling Here are the results of GET /shelly, I think this implies a non- Plus plug, but I could be wrong.

{
   "name": null,
   "id": "shellyplugus-c049ef892e60",
   "mac": "C049EF892E60",
   "model": "SNPL-00116US",
   "gen": 2,
   "fw_id": "20221206-140846/0.12.0-gafc2404",
   "ver": "0.12.0",
   "app": "PlugUS",
   "auth_en": false,
   "auth_domain": null
}

Note that it didn't come with v0.12 firmware, that was a relatively recent upgrade suggested by the Shelly Web GUI. Do you have a suggested firmware version I should downgrade to before attempting the HomeKit flash? (And if so, where I could find these older firmware files? http://archive.shelly-tools.de doesn't seem to have files for the US Plug).

RaphiePS avatar Feb 05 '23 15:02 RaphiePS

@RaphiePS There three reasons why yours must be a Plus:

  1. the output you posted shows gen: 2
  2. The current version of non Plus US Plug is 1.x
  3. The model of the gen 1 is SHPLG-U1

Take a look in the web Ui of your Shelly in the left top corner is a logo, I expect it contains a Plus.

timoschilling avatar Feb 05 '23 16:02 timoschilling

I suppose I should get on trying this today, as all of mine are plug US.

Tony Shadwick

Numbski avatar Feb 05 '23 16:02 Numbski

@gedeyenite If you like to test it, you could simply do it by open this url in your browser http://a.b.c.d/ota?url=http://rojer.me/files/shelly/misc/shelly-homekit-ShellyPlugUS.zip (replace a.b.c.d with the ip of your shelly)

timoschilling avatar Feb 13 '23 09:02 timoschilling

@Numbski @just-inlewis @evanpierre @ryanshuck was someone of you able to test that build? Reminder it's only for the "Plug US" not for the "Plus Plug US".

timoschilling avatar Feb 15 '23 21:02 timoschilling