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

Add automatic trigger to get Peanut Plug OTA check to work #2027

Merged
merged 1 commit into from
Jan 7, 2021

Conversation

airdrummingfool
Copy link
Contributor

Hi Koen,
Here's a crack at fixing Koenkk/zigbee2mqtt#4846.

Note that I did not do what you suggested in that issue (add code to toZigbee.js and then manually trigger with an MQTT message); instead, I am automatically triggering the zigbee message whenever an OTA update is checked.

While I think this is easier for the end user, I did have to export zigbeeOTA.getImageMeta so I could use it. I'm also not very familiar with Zigbee endpoints (or the z2m implementation thereof), so I just kinda guessed at how to write to the genScenes endpoint and it ended up working out.

If you don't like this implementation, please let me know what you want changed. Alternatively, I can switch to your original suggestion if you'd still prefer that.

One more note: I haven't tested actually updating a Peanut Plug yet, as I only have one that needs an update. Once you approve this PR, I'll test the full update process and make sure everything works like we expect it to.

@airdrummingfool airdrummingfool changed the title Add manual trigger to get Peanut Plug OTA check to work Add automatic trigger to get Peanut Plug OTA check to work Jan 5, 2021
@Koenkk
Copy link
Owner

Koenkk commented Jan 5, 2021

Good that you didn't listen, I like this implementation much more 😄

Anything left before I can merge this?

@airdrummingfool
Copy link
Contributor Author

The code is done as far as I know, but if you give me another day I can test the full update process and make sure it all works.

@airdrummingfool
Copy link
Contributor Author

The OTA update went smoothly and all is now good to go!

I did have to make one change: if the Peanut Plug "forgets" that an OTA update is available (e.g. if it loses power) but z2m "remembers", then the trigger data wasn't sent when the actual update process started, so the Peanut Plug wasn't responding. Now the trigger is sent before starting the update process (in addition to being sent before the update check) to make sure the Peanut Plug responds.

@Koenkk
Copy link
Owner

Koenkk commented Jan 7, 2021

Thanks!

@Koenkk Koenkk merged commit 23b8c1c into Koenkk:master Jan 7, 2021
@airdrummingfool airdrummingfool deleted the peanut_plug_ota branch January 14, 2021 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants