In this guide, I’m going to show you how to update the Peanut Plug firmware over the air (OTA) directly through Home Assistant. Without this upgrade, you won’t be able to use any of the energy-monitoring capabilities this smart plug offers. Instead, it will just show 0.0 W.

The biggest motivation for me to get this working was with the release of Home Assistant 2021.8: home energy management. This update offers an awesome Energy Dashboard to view/monitor power consumption around your home with beautiful charts and cards. Energy management in general is a great way to see which devices around your house consume the most power and could eventually save you money each month on your electrical bill.

I also want to credit this Reddit post for the inspiration. I didn’t figure this out myself, I’m just detailing it in a step-by-step guide with the hopes that you don’t have to go down the Google rabbit hole (like I did) to figure this out. Seriously, I had to dig pretty deep to find this solution. My guides tend to rank highly on Google, so I’m hopeful this one makes it to the top and just wanted to make sure I provided credit where credit is due.

For reference, here’s what the Peanut Plug looks like:

We earn a commission if you make a purchase, at no additional cost to you.

I successfully upgraded my 9 Peanut Plug outlets successfully as of 8/23/2021.


Is the Almond Hub needed to update Peanut Plug firmware?

No, the Almond Hub method is not needed to upgrade the Securifi Peanut Plug firmware to fix the power reporting issue.

Chances are if you came across this guide, you’ve already read numerous forum/Reddit posts (unless my guide ranks #1 on Google) that state you need the Almost router to update. Years ago that was the case, but with this new method, that is no longer required.


Step 1: Add Peanut Plug to Home Assistant

Since all of my plugs are already added to HA, I won’t show you how to that in this guide. However, I have a How To Setup Peanut Plugs in Home Assistant guide you can follow if needed.


Step 2: Create New Directory

First, you’ll need to create a new folder in Home Assistant. This is where you will be uploading the peanut plug firmware to.

File Editor > click the folder at the top > click New Folder. Then, name it something useful like ‘peanutplugfirmware’. Click OK once the folder has been created.

Then, download the firmware from here: https://staging.smarthomepursuits.com/download/4823/

I uploaded the file to my own site in case it ever gets removed/taken down from the Github link below, but you can get it from either: https://github.com/Koenkk/zigbee-OTA/raw/master/images/Tuya/ZPS_CS5490_039.ota

Save it to your Downloads folder. If downloaded from my site and not Github, right-click > Extract All.


Step 3: Upload Firmware to new folder

While still in File Editor, scroll down until you locate the new folder. Click it to open.

Then, click the up arrow icon to upload the .ota file you just downloaded. Do not upload the zipped copy.


Step 4: Add ZHA & Logger Config to configuration.yaml

It may be a good idea to take a Google Drive backup or Samba Backup before this step, just in case this somehow messes up your Zigbee devices. I didn’t run into any issues at all, but it’s still a good idea.

Add this code to your configuration.yaml. If you created a folder exactly like I did, you can just copy and paste this without needing to make any changes.

This config also adds a ZHA logger: which enables logging for your Zigbee controller (I’m using a Nortek GoControl zwave/zigbee USB dongle). Adding the logger isn’t required, but it will let you see the install percentage and whether or not the install was a success or failure so I recommend it.

zha:
  zigpy_config:
    ota:
      ikea_provider: false
      ledvance_provider: false
      otau_directory: /config/peanutplugfirmware
logger:
  default: info
  logs:
    homeassistant.core: warning
    homeassistant.components.zha: debug
    bellows.zigbee.application: info
    bellows.ezsp: info
    zigpy: debug
    zigpy_cc: info
    zigpy_deconz.zigbee.application: info
    zigpy_deconz.api: info
    zigpy_xbee.zigbee.application: info
    zigpy_xbee.api: info
    zigpy_zigate: info
    zigpy_znp: info
    zhaquirks: info

Then, check your configuration changes and reboot Home Assistant from Configuration > Server Controls > Restart.


Step 5: Find Device IEEE

This setup won’t automatically update all of your peanut plugs, so you will have to upgrade them 1 at a time. To update, located the IEEE address of the plug from Configuration > Devices > search for your plug > and then click on it.

The IEEE: can be found under Device Info:


Step 6: Call Service from Developer Tools

Next, we are going to trigger the over-the-air firmware upgrade through a service call.

Go to Developer Tools > Services. Make sure you are in UI mode so you don’t accidentally format the service call incorrectly.

For the Service, paste this: zha.set_zigbee_cluster_attribute. A box will then pop up. Fill it out like I have in my screenshot, except use your own IEEE.

  • IEEE: You device IEEE
  • Endpoint ID: 1
  • Cluster ID: 5
  • Cluster Type: Check the box, then change the dropdown to out
  • Attribute: 2
  • Value: 49502

Then, click Call Service. It could take upwards of 5-10 minutes for the update to complete. You can view the upgrade status in the next step.


Step 7: Check Upgrade Status

If you don’t like feel like waiting 5-10 minutes and would like to see what percent the install is while it’s being upgraded:

Supervisor > Terminal & SSH. Click Open Web UI. Then type in this command: tail -f /config/home-assistant.log | egrep OTA

This will parse the log files and show you exactly what percent the install is at:

Once complete, you’ll see a SUCCESS message like this:

Within just a few seconds, you will now start to see data flowing into your device!

And if you view the device info again, you might also notice that it displays the firmware version 0x00000027. Before, it didn’t have any info about the current version.


Troubleshooting

I didn’t run into any issues at upgrading mine, and from the comments in various forums posts – no one else has either. One commenter mentioned that even after upgrading he wasn’t able to see anything but 0.0W , but replied back later stating that his small lamp wasn’t pulling enough power and therefore the plug wasn’t detecting the power consumption.

If you run into that issue, just plug in something like a laptop, floor lamp, or your phone and it should draw enough electricity to change the value.


Wrapping Up

Hopefully this tutorial helps you start monitoring some additional things around the house that you weren’t able to before!

There are some additional steps to get this integrated into the new Energy Dashboard with the latest HA update 2021.8, but I haven’t done that yet. I will either update this post or create a new one and link it here once I set that portion up.



My Favorite Home Assistant Devices

Below are some of the Home Assistant-compatible devices I personally use in my home. I highly recommend each of them.

The full list of all Home Assistant compatible & recommended devices I use can be found on my Equipment List page.

Similar Posts

19 Comments

  1. Hello Danny!

    Thank you for your great work, I’ve already followed several of your “how-to” with IKEA devices.

    I don’t have a peanut plug but I’m wondering if we can follow the same steps for updating other devices from Home Assistant?

    Do you think the general idea should work for other devices as well?

    Cheers,

    Pierre

    1. That’s awesome, I’m glad you enjoy my guides!

      This exact method will only work for Peanut plugs, but I’m sure you can update other devices OTA using similar steps. The parameters of the service call will probably be different, though.

    2. Steve Welham says:

      I followed your guide and it worked beautifully. The first time I did it the process appeared to work, but did not log progress and the device even reported the FW version as 0x27 but electrical measurement was still not reporting. I power cycled it and was then able to repeat the update, this time with logs and ultimately successful.

      1. That’s great Steve! I’m glad you got your peanut plugs updated following my guide.

  2. Thank you for your answer, I will try asap!

  3. Wooooo!!! I am so glad I found your site! It is very cool! Currently at 78% on the first Peanut. You should put up a link to buy you a coffee or beer. I totally appreciate the work you put in. I am looking forward to trying out some of your other projects.

    1. You are very welcome, I’m glad you like it! Rather than a direct donation link, just click any item on my Equipment List page before you make an Amazon purchase and I’ll get a small commission at no extra cost to you 🙂

  4. awesome guide. i was desperate to get this plug working and didn’t want to spend on a router.
    your method worked like a charm. thank you !

  5. I followed your steps exactly and for some reason it doesn’t update for me. =( Can’t figure out why…

  6. This is not working for me, and as far as I can tell I am the only one. When I run the service call exactly as described here and in the relevant GitHub issue, after following all preceding steps exactly as written, I get the following error:

    “`
    DEBUG (MainThread) [homeassistant.components.zha.api] Set attribute for: cluster_id: [5] cluster_type: [out] endpoint_id: [1] attribute: [2] value: [49502] manufacturer: [None] response: [Write_Attributes_rsp(status_records=[WriteAttributesStatusRecord(status=, attrid=0x0002)])]
    “`

    Digging into it, it’s clear the plug seems unhappy about trying to write to this attribute, but I honestly don’t know why. Seems to work for everyone else, but it’s happening for me with two of them.

    Any help or ideas anyone has would be appreciated, but I also just wanted to comment in case anyone else ever experiences this.

    1. Joe Loveless says:

      I had issues also. I changed mine from in to out and it started updating. Took a while to figure out that part.

  7. Huh it looks like it stripped out part of the response, let me try again

    DEBUG (MainThread) [homeassistant.components.zha.api] Set attribute for: cluster_id: [5] cluster_type: [out] endpoint_id: [1] attribute: [2] value: [49502] manufacturer: [None] response: [Write_Attributes_rsp(status_records=[WriteAttributesStatusRecord(status=\, attrid=0x0002)])]

  8. Joe Loveless says:

    Hi Danny. Is this still valid? I used this post about a year ago, but I bought two new Peanut plugs, and for the life of me can’t get the firmware to flash. Nothing shows in the logs as even happening. On the latest and greatest Home Assistant.

    1. Seems like with the newest Peanuts it doesn’t work, but if I changed from out to in I was able to get it to run.

      1. Mr. Marcus. You were spot on about changing cluster_type to in. I was going nuts! Thanks.
        And of course, big thanks to the OP for posting this in the first place.

  9. I just did this with the latest HA version. Changed the cluster type from “out” to “in” and it worked perfectly for me.

  10. I’m feeling a bit dumb here, because I can’t for the life of me find where in the Home Assistant UI the File Editor is…so I’m basically stuck at the first step – creating a new folder. I swear I’ve looked through just about every menu and option, but no luck so far.

    Home Assistant 2022.12.6
    Supervisor 2022.11.2
    Operating System 9.4
    Frontend 20221213.0 – latest

    What am I missing?

    Thanks

    1. Nvm – I realized that File Editor is an Add-On that has to be installed before it will show up as an option in the GUI – all good now.

  11. I’m not seeing the service show up, either searching for it or pasting in the name `zha.set_zigbee_cluster_attribute`. Has anyone else seen this issue?

Leave a Reply

Your email address will not be published. Required fields are marked *