zigpy / zigpy

Library implementing a ZigBee stack
GNU General Public License v3.0
799 stars 155 forks source link

[REQUEST] dresden elektronik Zigbee OTA provider for dresden elektronik made/branded Zigbee devices? #992

Open Hedda opened 2 years ago

Hedda commented 2 years ago

@manup Wondering if you would consider contributing "download code" for dresden elektronik Zigbee OTA provider to zigpy?

http://deconz.dresden-elektronik.de/otau/

deCONZ STD OTAU plugin implements a ZigBee Over-the-Air-Upgrade (OTAU) server in their official deCONZ application:

https://github.com/dresden-elektronik/deconz-ota-plugin/

dresden elektronik Manufacturer code: 0x1135

https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/OTA-Image-Types---Firmware-versions#dresden-elektronik

Product Code(s) Image type Product(s) Observed FW Version(s) OTAU via DeCONZ
Phoscon Hive 0x0101 Phoscon Hive 0x0020001B
Phoscon Kobold 0x0100 Phoscon Kobold 0x1000002A
FLS-PP3 0x0000 FLS-PP lp 0x201000F5
FLS-A lp 0x0004 FLS-A lp 0x201000E9
Lighting Switch 0x0005 Lighting Switch 0x0202001C
Scene Switch 0x0005 Scene Switch 0x0202001C

As you may or or may not know, Home Assistant is currently the world's most popular open-source home automation software application and its native ZHA integration is a Zigbee gateway implementation that is one the most popular integrations in Home Assistant as per statistics provided by the few percentages of their users who opt-in to submit usage analytics (as analytics is optional and disabled by default in Home Assistant):

ZHA does have support download code for third-party OTA providers however someone need to code each download source:

https://www.home-assistant.io/integrations/zha#ota-firmware-updates

https://analytics.home-assistant.io/#integrations

Having more Zigbee OTA providers included with Home Assistant's ZHA integration is a common feature request from many users in the Home Assistant community, so would like to request that you yourself as the manufacturer submit the small piece of code needed to allow the zigpy library (script code written in Python programing language) to download Zigbee OTA images (Over-The-Air firmware updates) for your own devices from your public Zigbee OTA provider as the source:

https://github.com/zigpy/zigpy/blob/dev/README.md#zigbee-device-ota-updates

See zigpy OTA provider code (providers.py) in Python which include the URL links as source of Zigbee OTA files for direct download:

https://github.com/zigpy/zigpy/tree/dev/zigpy/ota

https://github.com/zigpy/zigpy/blob/dev/zigpy/ota/providers.py

It will need a "dresden elektronik OTA Firmware provider" to handle image download (see "Skeleton OTA Firmware provider" for reference, as well as note providers.py also already has code to handle download of OTA files from IKEA, INOVELLI, and LEDVANCE as references).

Maybe also consider copying concept of index.json with metadata on all files like Koenkk repository has to make scripting easier:

https://github.com/Koenkk/zigbee-OTA/blob/master/index.json

zigpy does not yet support this json index or other OTA Index files but Zigbee2MQTT allow users to use it locally as descibed here:

https://github.com/Koenkk/zigbee2mqtt.io/blob/develop/docs/guide/usage/ota_updates.md#local-ota-index-and-firmware-files

PS: Please note that other than in the ZHA integration for Home Assistant the same zigpy library is also used as a dependency by the official Zigpy plugin for Jeedom as well as the Zigbee plugin for Domoticz, see:

https://doc.jeedom.com/en_US/plugins/automation%20protocol/zigbee/

and

https://www.domoticz.com/wiki/ZigbeeForDomoticz

PS: By the way, please also see this somewhat related discussion regarding here Koenkk zigbee-OTA repository -> https://github.com/zigpy/zigpy/issues/535

manup commented 2 years ago

Hi @Hedda it would be good to have an unified approach like the index.json, I can provide this on the server for our OTA files. This mimics the Ikea OTA handling I think. In future it might be worth to check the Matter OTA handling which is distributed but a bit over engineered.

For the Python OTA provider perhaps someone else can jump in, I'm currently a bit short on time :/

Hedda commented 2 years ago

it would be good to have an unified approach like the index.json, I can provide this on the server for our OTA files. This mimics the Ikea OTA handling I think.

That would be great! FYI, it also looks like Inovelli's firmware.json file as well taken inspiration from Koenkk's index.json or IKEA(?):

https://files.inovelli.com/firmware/firmware.json

https://github.com/Koenkk/zigbee-OTA/blob/master/index.json

http://fw.ota.homesmart.ikea.net/feed/version_info.json

http://fw.test.ota.homesmart.ikea.net/feed/version_info.json

Hedda commented 2 years ago

For the Python OTA provider perhaps someone else can jump in, I'm currently a bit short on time :/

Perhaps could try motivating existing zigpy developers by asking dresden elektronik's bosses to ship samples of those devices? ;)

https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/OTA-Image-Types---Firmware-versions#dresden-elektronik Product Code(s) Image type Product(s) Observed FW Version(s) OTAU via DeCONZ
FLS-PP3 0x0000 FLS-PP3, FLS-PP-IP 0x201000F5
Lighting Switch 0x0005 Lighting Switch 0x0202001C
Scene Switch 0x0005 Scene Switch 0x0202001C
Hedda commented 1 year ago

Hi @Hedda it would be good to have an unified approach like the index.json, I can provide this on the server for our OTA files. This mimics the Ikea OTA handling I think. In future it might be worth to check the Matter OTA handling which is distributed but a bit over engineered.

For the Python OTA provider perhaps someone else can jump in, I'm currently a bit short on time :/

@manup Have you given any more thought to providing some kind of index file(s) dresden elektronik server for Zigbee OTA files?

FYI, in related news Home Assistant's Z-Wave (Z-Wave JS) developers exposed OTA updates for Z-Wave devices in UI from Home Assistant 2022.7 release, and they also created a new Firmware Update Service (web service with an API) to power semi-automatic firmware updates in Z-Wave JS,

https://github.com/zwave-js/firmware-updates

https://github.com/zwave-js/firmware-updates/blob/main/README.md

The firmware update service for Z-Wave JS

https://firmware.zwave-js.io

They talk more about it in this video and blog post:

https://youtu.be/HnA_pZQyZAs?t=2908

https://www.home-assistant.io/blog/2022/07/06/release-20227/#update-z-wave-devices-directly-from-home-assistant

Z-Wave JS Firmware Update Service

This is the web service powering semi-automatic firmware updates in Z-Wave JS.

How it works

Firmware upgrades are defined in the files in the firmware directory. This information is parsed by the web service and used to respond to requests.

Z-Wave JS will query the web service on demand, providing the device identification of the device to be updated. If an update is available, the web service will respond with the necessary information to display to the user.

When desired, Z-Wave JS will download the update(s) from the provided URL, verify their integrity and install them

Update Z-Wave devices directly from Home Assistant

All software has bugs, including the software on your Z-Wave devices. But how to update those? Have no fear! As of today, we have a solution for this!

Thanks to the hard work and collaboration between @AlCalzone from Z-Wave JS and @raman325 from Home Assistant, you can now install updates on your Z-Wave devices directly from the Home Assistant interface!

Screenshot showing the new upload firmware item on the device page of a Z-Wave device page

image

On the device page of your Z-Wave device, there is now a menu item allowing you to install Z-Wave firmware updates onto your device manually.

Get a software update for your Z-Wave device from the manufacturer, and start an update in Home Assistant, which allows you to upload the update file you got from the manufacturer. The rest is pure magic!

Screenshot showing the a Z-Wave device that has firmware installation in progress

image

During update installation, you’ll be presented with the update’s progress.

It is that easy 💪

PS: They also made a tool is meant to help generate the integrity hash for that Z-Wave JS firmware update service:

https://github.com/zwave-js/firmware-integrity

Hedda commented 1 year ago

@manup noticed that Dresden Elektronik have now released a new "Phoscon Kobold" Zigbee 3.0 dimmer switch module device:

https://phoscon.de/en/kobold

Any chance you consider donating a few of those if there are perhaps one or more Python developer(s) contributing to zigpy and/or zha that might be willing to look at dresden elektronik Zigbee OTA provider for dresden elektronik made/branded Zigbee devices?

https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/OTA-Image-Types---Firmware-versions#dresden-elektronik

dresden elektronik

Manufacturer code: 0x1135

Product Code(s) | Image type | Product(s) | Observed FW Version(s) | OTAU via DeCONZ -- | -- | -- | -- | -- Phoscon Kobold | 0x0100 | Phoscon Kobold | 0xF0900029 | ✅

https://deconz.dresden-elektronik.de/otau/1135-0100-F0900029-Kobold.zigbee

image

PS: Looks like it is so far only sold in Europe(?) but its hardware specification lits AC 100-240V at 50/60Hz so should work globally?

manup commented 1 year ago

Any chance you consider donating a few of those if there are perhaps one or more Python developer(s) contributing to zigpy and/or zha that might be willing to look at dresden elektronik Zigbee OTA provider for dresden elektronik made/branded Zigbee devices?

Yes I think that should be possible, I'll ask the team.

Side note it looks similar to other products and is in fact based on the same hardware from Sunricher, but we've developed a own firmware for it. Main difference is that Kobold has a switch endpoint (EP: 2) so bindings for on/off and brightness control can be created for groups. With that the unit can control other lights also when the gateway is switched off.

Here is the related device description file (DDF) for the deCONZ integration:

https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/dresden_elektronik/kobold.json

Hedda commented 1 year ago

@manup @Haerteleric a related question to you working for dresden elektronik is if dresden elektronik as a company and their marketing department is aware of Home Assistant's "Works with Home Assistant" partner program with its matching "Works via Zigbee with Home Assistant" compatibility badges and if dresden elektronik as a company will consider joining that program?

https://www.home-assistant.io/blog/2022/07/12/partner-program/

There it says "Works with Home Assistant partners are expected to provide firmware updates via user-friendly services provided by Home Assistant" under Responsibilities in a section there called "Provide easy firmware updates".

https://partner.home-assistant.io/

"There are manufacturers that are creating products that integrate into Home Assistant using standards like Z-Wave, Zigbee, or Matter (soon). In these cases, the integration is maintained by the Home Assistant community and Nabu Casa. These companies can still become a member of the Works with Home Assistant program but are relieved from integration maintenance."

"With Home Assistant we are always working on educating our users about preferring local control and open standards when acquiring new products. This is also reflected in the “Works with Home Assistant” badges."

Update! New badges:

image

Old badges:

image

FYI, just a few days ago they announced that another company that makes Zigbee devices has joined their partner program,

https://www.home-assistant.io/blog/2022/10/13/third-reality-partner/

This relates to zigpy as it may imply some commitment from companies to help with both OTA updates and ZHA Device Handlers.

https://www.home-assistant.io/integrations/zha#ota-firmware-updates

https://github.com/zigpy/zigpy/blob/dev/README.md#zigbee-device-ota-updates

https://www.home-assistant.io/integrations/zha#zha-exception-and-deviation-handling

https://github.com/zigpy/zha-device-handlers

https://github.com/zigpy/zha-device-handlers/blob/dev/README.md

Hedda commented 1 year ago

@manup FYI, puddly has just now added a new feature to the "zigpy-cli" tool that manufacturers can use to produce a skeleton JSON index from a given set of OTA files, and that way make sure manufacturers OTA files are correctly-structured so that they will be compatible with zigpy out-of-the-box. See the README.md for that "zigpy-cli" tool. See:

https://github.com/zigpy/zigpy-cli/blob/dev/README.md#ota

and

https://github.com/zigpy/zigpy-cli/blob/dev/README.md#generate-ota-index-files

PS: puddly mentioned when adding that feature for generating OTA index files via zigpy-cli was done in preparation for some OTA rewrites in the main zippy library that he is planning to do.

Hedda commented 1 year ago

FYI, puddly is now working on supporting "Generic OTA providers" for zigpy via this new JSON format schema:

https://github.com/zigpy/zigpy/wiki/OTA-Information-for-Manufacturers

"This allows for new providers to be added to zigpy without extra code. This also allows for manufacturers to distribute test feed URLs to customers without deploying them globally."

This feature will be introduced via this new pull request that is still a work-in-progress -> https://github.com/zigpy/zigpy/pull/1165

Hedda commented 10 months ago

FYI, “Manufacturer OTA Firmware Update Support” (also referred to as “Generic OTA providers”) should now be available for use in ZHA as that was added with zigpy 0.56.3 release and that was very recently bumped in Home Assistant core version 2023.8.1(?)

https://github.com/zigpy/zigpy/pull/1165

This new feature in zigpy (and ZHA) should allow for new OTA providers to be added to zigpy (and ZHA) without extra code, which in turn also allows both manufacturers (and end-users) to distribute test feed URLs to customers without deploying them globally.

https://github.com/zigpy/zigpy/wiki/OTA-Information-for-Manufacturers

PS: Again, puddly also added a new feature to the "zigpy-cli" tool that manufacturers can use to produce/generate a skeleton index from a given set of OTA files, and that way makes sure manufacturers OTA files are correctly-structured so that they will be compatible with this new JSON format for zigpy OTA providers out-of-the-box. Check out the README.md for the "zigpy-cli" (zigpy CLI tool) -> https://github.com/zigpy/zigpy-cli/blob/dev/README.md#generate-ota-index-files

Hedda commented 7 months ago

FYI, dresden elektronik now also provide OTAU images for their new Phoscon Hive, Phoscon Kobold, and FLS-A lp wireless ballast:

https://www.dresden-elektronik.com/product/Hive.html

https://www.dresden-elektronik.com/product/kobold.html

https://www.dresden-elektronik.com/product/fls-a-lp-wireless-ballast.html

Product Code(s) Image type Product(s) Observed FW Version(s) OTAU via DeCONZ
Phoscon Hive 0x0101 Phoscon Hive 0x0020001B
Phoscon Kobold 0x0100 Phoscon Kobold 0x1000002A
FLS-PP3 0x0000 FLS-PP lp 0x201000F5
FLS-A lp 0x0004 FLS-A lp 0x201000E9
Lighting Switch 0x0005 Lighting Switch 0x0202001C
Scene Switch 0x0005 Scene Switch 0x0202001C