mongoose-os-apps / shelly-homekit

Apple HomeKit firmware for Shelly's
Other
1.81k stars 130 forks source link

Shelly Plug US support (gen 1 / not Plus) #749

Closed Numbski closed 2 months ago

Numbski commented 3 years ago
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 commented 3 years ago

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.

timoschilling commented 3 years ago

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.

Numbski commented 3 years ago

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.

rojer commented 3 years ago

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

Numbski commented 3 years ago

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

rojer commented 3 years ago

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

ryanshuck commented 3 years ago

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

github-actions[bot] commented 3 years ago

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

timoschilling commented 3 years ago

@Numbski any updates with your testing?

Numbski commented 3 years ago

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

Tony Shadwick

just-inlewis commented 2 years ago

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

just-inlewis commented 2 years ago

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 commented 2 years ago

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}

evanpierre commented 2 years ago

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

Numbski commented 2 years ago

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.

slvr85 commented 2 years ago

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

RaphiePS commented 2 years ago

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
gedeyenite commented 1 year ago

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. :)

timoschilling commented 1 year ago

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

gedeyenite commented 1 year ago

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.

timoschilling commented 1 year ago

curl -F file=@fw.zip http://shelly.local/update, you must replace shelly.local with the hostname or ip of your Shelly

RaphiePS commented 1 year ago

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?

timoschilling commented 1 year ago

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

RaphiePS commented 1 year ago

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?

timoschilling commented 1 year ago

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

RaphiePS commented 1 year ago

@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).

timoschilling commented 1 year ago

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

Numbski commented 1 year ago

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

Tony Shadwick

timoschilling commented 1 year ago

@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 commented 1 year ago

@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".

just-inlewis commented 1 year ago

Hey @timoschilling sorry for the delay! I will keep an eye on this now to speed up your debug cycle! {"ts":1676521342.232, "level":2, "data":"shelly_update.cpp:271 incoming fw signatures: 00\n"} {"ts":1676521342.239, "level":0, "data":"shelly_update.cpp:263 Wrong app name 'shelly-plug-u1'\n"} {"ts":1676521342.247, "level":2, "data":"mgos_ota_core.c:1051 Update finished, result -13 (Aborted by event handler)\n"}

timoschilling commented 1 year ago

@just-inlewis you have a Plus Plug US and not a Plug US, this build is only for the NON Plus version.

timoschilling commented 1 year ago

Still nobody that can test it? @Numbski?

RaphiePS commented 1 year ago

@timoschilling It looks like only the Plug Plus US is available for purchase, both on the Shelly site and Amazon. If I could get my hands on the non-Plus I'd be happy to test it, but I'm having trouble finding one and I figure others are in the same boat.

timoschilling commented 1 year ago

@RaphiePS yes the Gen1 US Plug is out of stock.

mrala commented 1 year ago

@timoschilling I was able to get 2.11.2 installed on two of my Plug US (non-plus) devices. They are both now overheating consistently and the homekit server keeps stopping.

Installed version:

Version: 2.11.2
Build: 20230202-214551/2.11.2-21-gdd9215b-749-shelly-plug-us-support-dirty

Debug logs show:

38287858 shelly_main.cpp:360     == System temperature normal, resuming service
39285945 shelly_main.cpp:255     === Creating accessories
39294866 shelly_switch.cpp:244   Exporting 'Shelly Plug US': type 1, state: 0
39304051 shelly_main.cpp:351     == System temperature too high, stopping service
39308855 shelly_main.cpp:314     === Destroying accessories

The device works properly after reverting back to the stock firmware.

{
    "type":"SHPLG-U1",
    "mac":"<snip>",
    "auth":false,
    "fw":"20230913-113516/v1.14.0-gcb84623",
    "discoverable":true,
    "num_outputs":1,
    "num_meters":1
}
mrala commented 10 months ago

Are there any other logs I can provide that would be helpful?

timoschilling commented 10 months ago

Looks like temperature measuring didn't work. We need to make a build with disabling it.

rajtotherescue commented 8 months ago

Is there any update on firmware support for the Plus Plug US?

waffles0042 commented 8 months ago

Is there any update on firmware support for the Plus Plug US?

humble bump.

I would also be very interested in seeing this plug supported.