python-matter-server icon indicating copy to clipboard operation
python-matter-server copied to clipboard

Feature request: Ability to update node firmware from provided Url

Open olavt opened this issue 1 year ago • 11 comments

I'm looking into the firmware upgrade functionality that was recently added and it looks like it's only possible to update the firmware through the DCL.

It would be nice to have the ability to download the firmware from a provided Url directly for testing.

olavt avatar Jul 23 '24 08:07 olavt

We actually have this already but we didnt yet have time to document it. Stay tuned as it will follow soon

marcelveldt avatar Jul 23 '24 09:07 marcelveldt

Great! I was just looking at the API-commands in the source code and couldn't see how one could trigger the update from a provided Url. Can you give me a hint until the docs gets there?

olavt avatar Jul 23 '24 09:07 olavt

Great! I was just looking at the API-commands in the source code and couldn't see how one could trigger the update from a provided Url. Can you give me a hint until the docs gets there?

Not yet as we need to finish it. Currently the path to store manual update json files is hardcoded.

Ensure that the path /root/updates exists and place the json files in there. Here is one example of such a file. 65521-32769-2-OTA-Requestor-Example-App.json

marcelveldt avatar Jul 23 '24 10:07 marcelveldt

Wouldn't it be better to put the updates directory under the data directory by default?

olavt avatar Aug 02 '24 07:08 olavt

I see that this was released now:

https://github.com/home-assistant-libs/python-matter-server/pull/884

Where can I find any docs on how to use this new feature?

olavt avatar Sep 14 '24 16:09 olavt

I see that this was released now:

#884

Where can I find any docs on how to use this new feature?

I would also be interested in details on how to use the local OTA feature. A dedicated explanation for the usage in combination with Homeassistant OS (where the Matter Python Server runs in a Docker instance) would be an awesome addition. @agners, since you implemented the feature. Could you please help providing a short "how to"?

Btw. I put a .json-file for my device under test in /root/updates/ of the docker container, but when I click "update device" in the Web UI it tells me there is no update available. Log also doesn't really tell me where it searched for updates:

2024-09-18 10:42:19.693 (MainThread) DEBUG [matter_server.server.device_controller] <Node:7> Check for updates.
2024-09-18 10:42:19.852 (MainThread) INFO [matter_server.server.device_controller] <Node:7> There is no update information for this device on the DCL.
2024-09-18 10:42:19.855 (MainThread) INFO [matter_server.server.device_controller] <Node:7> No new update found.

fish12345 avatar Sep 18 '24 08:09 fish12345

@fish12345 you need to have the json file in place when the Matter Server starts (the json files are only parsed on startup). You may need to use --ota-provider-dir to provide a custom directory which you bind mount into the container.

agners avatar Sep 18 '24 10:09 agners

@agners Do you have a sample json file with the correct file::// syntax for the update directory with the corresponding --ota-provider-dir syntax?

olavt avatar Sep 18 '24 10:09 olavt

Thanks @agners, the information that the json files are only parsed on startup was the key for me.

I copied the json file to /root/addon_configs/core_matter_server/updates/ on my Homeassistant. Turns out they already expose the ota path. After that, I started the Matter server addon.

Now the update can be started.

@olavt, I also tried to copy the firmware image next to the .json file and use "otaUrl": "file:///my_file.ota" in the .json file instead of an https URL. Regarding the rest of the content, I adapted the example mentioned in https://github.com/home-assistant-libs/python-matter-server/issues/833#issuecomment-2244826055 It seems to work, but transmission is still ongoing, so I don't know for sure yet.

fish12345 avatar Sep 18 '24 11:09 fish12345

@agners Maybe there should be an API to be able to create the json information without having to upload it to the filesystem and without having to re-start the Python Matter Server?

olavt avatar Sep 18 '24 17:09 olavt

@agners Maybe there should be an API to be able to create the json information without having to upload it to the filesystem and without having to re-start the Python Matter Server?

That is out of scope for now. Feel free to PR that if you like.

marcelveldt avatar Sep 18 '24 21:09 marcelveldt