-
Notifications
You must be signed in to change notification settings - Fork 193
Hello, this is the OTA code of thirdreality company. Please check it #1089
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
Conversation
Install precommit and run the checks. Please address the tagged lint failures |
Codecov ReportBase: 99.63% // Head: 99.58% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev #1089 +/- ##
==========================================
- Coverage 99.63% 99.58% -0.05%
==========================================
Files 46 46
Lines 7590 7674 +84
==========================================
+ Hits 7562 7642 +80
- Misses 28 32 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@3reality-support @xudo-github @hwzolin I've just tested the latest I've reverse engineered the OTA image format (#1090) of all of the available images. To save you the trouble of having to implement this PR yourself, can you instead add a few more keys to your JSON: {
"modelId": "3RSB22BZ",
"url": "https://tr-zha.s3.amazonaws.com/firmwares/SmartButton_Zigbee_PROD_OTA_V21_1.00.21.ota",
"version": "1.00.21",
+ "imageType": 54184,
+ "manufacturerId": 4659,
+ "fileVersion": 33
} These three fields are contained within the Zigbee OTA file header. You can extract them yourself from the parsed header: $ pip install git+https://github.com/zigpy/zigpy-cli.git
$ pip install --upgrade git+https://github.com/zigpy/zigpy.git # need latest version for OTA format decoder
$ zigpy ota info SmartButton_Zigbee_PROD_OTA_V21_1.00.21.ota
Parsing SmartButton_Zigbee_PROD_OTA_V21_1.00.21.ota
Header: OTAImageHeader(upgrade_file_id=200208670, header_version=256, header_length=56, field_control=<FieldControl.0: 0>, manufacturer_id=4659, image_type=54184, file_version=33, stack_version=2, header_string='Telink OTA Sample Usage', image_size=126738, *device_specific_file=False, *hardware_versions_present=False, *key=ImageKey(manufacturer_id=4659, image_type=54184), *security_credential_version_present=False)
Number of subelements: 1
Validation result: ValidationResult.UNKNOWN Let me know when this is done and I can make a PR to add Third Reality OTA support to zigpy. |
@puddly Hello, your suggestion has been dealt with, please check if it meets the requirements. |
Thank you. There is one problem with the firmware images themselves. When a device asks for a firmware image, it sends the following query: Ota:QueryNextImageCommand(field_control=<FieldControl.0: 0>, manufacturer_code=4659, image_type=54182, current_file_version=268513281) The device's current {
"modelId": "3RSP019BZ",
"url": "https://tr-zha.s3.amazonaws.com/firmwares/SmartPlug_Zigbee_PROD_OTA_V20_v1.00.20.ota",
"version": "1.00.20",
"imageType": 54182,
"manufacturerId": 4659,
"fileVersion": 32
} However, the new OTA file's Can you make the OTA image file versions (not just what is in the JSON) increasing? |
@puddly Can you please tell me how you got the current device version 268513281 (0x10013001)? |
This is what the device is sending when it begins an OTA upgrade. You send it an OTA "image notify" command, it sends back a "query next image" command, which contains this version number. Your devices do not support reading this attribute, the only way it can be queried is when the device itself sends it during an OTA transaction: |
Closing in favor of #1096. |
Add URL for Third Reality (3reality) OTA provider to OTA_URLs.md https://tr-zha.s3.amazonaws.com/firmware.json FYI; Third Reality (3reality) OTA provider support and custom image format parser was recently added to zigpy library: zigpy/zigpy#1096 zigpy/zigpy#1090 zigpy/zigpy#1089 Official website and Facebook group for reference: https://www.3reality.com/ https://www.facebook.com/ThirdReality.offical/
Add URL for Third Reality (3reality) OTA provider to OTA_URLs.md https://tr-zha.s3.amazonaws.com/firmware.json FYI; Third Reality (3reality) OTA provider support and custom image format parser was recently added to zigpy library: zigpy/zigpy#1096 zigpy/zigpy#1090 zigpy/zigpy#1089 Official website and Facebook group for reference: https://www.3reality.com/ https://www.facebook.com/ThirdReality.offical/
@puddly Excuse me, can I update the third reality device on ZHA now? |
home-assistant/core#82509 did not make it in time for 2022.11.4. Once 2022.11.5 comes out, you can by enabling the OTA provider: zha:
zigpy_config:
ota_config:
thirdreality_provider: true And then notify a device of the new image. Progress will be in the debug log. |
@puddly Ok, I see, thanks. |
Not sure if it's important now, since 2022.12.0b0 is just around the corner, but home-assistant/core#82509 is not in the 2022.11.5 milestone. (but the ThirdReality OTA changes will definitely be available when 2022.12b0 drops) |
@TheJulianJES Thanks! I've added it to the 2022.11.5 milestone. |
@puddly Hi, I have upgraded HA to version 11.5, but when I was on an OTA device, I still prompted that no OTA image is available. Am I misconfiguring? The following pictures are my configuration content, please take a look: |
The format of the OTA JSON changed and thus the parser for it in 2022.11.5 is not working. You should see an error initializing the OTA provider. I fixed it a few hours ago #1119 and it is in the current beta https://github.com/home-assistant/core/releases/tag/2022.12.0b0 |
@puddly |
Ah, my mistake! The zha:
zigpy_config:
ota:
thirdreality_provider: true Here is a log of the temperature sensor updating: 2022-12-07 21:42:52.736 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA query_next_image handler for 'Third Reality, Inc 3RTHS24BZ': field_control=FieldControl.0, manufacturer_id=4659, image_type=54185, current_file_version=21, hardware_version=None, model='3RTHS24BZ'
2022-12-07 21:42:52.744 DEBUG (MainThread) [zigpy.ota.provider] Downloading https://tr-zha.s3.amazonaws.com/firmwares/TRTL_ThermalSensor_PROD_OTA_V21_1.00.21.ota for ImageKey(manufacturer_id=4659, image_type=54185)
2022-12-07 21:42:53.093 DEBUG (MainThread) [zigpy.ota.provider] Finished downloading from https://tr-zha.s3.amazonaws.com/firmwares/TRTL_ThermalSensor_PROD_OTA_V21_1.00.21.ota for ImageKey(manufacturer_id=4659, image_type=54185) ver 1.00.21
2022-12-07 21:42:53.095 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA image version: 33, size: 124946. Update needed: True
2022-12-07 21:43:07.778 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA query_next_image handler for 'Third Reality, Inc 3RTHS24BZ': field_control=FieldControl.0, manufacturer_id=4659, image_type=54185, current_file_version=21, hardware_version=None, model='3RTHS24BZ'
...
2022-12-07 21:43:42.310 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA upgrade progress: 0.0
2022-12-07 21:43:42.529 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA upgrade progress: 0.1
2022-12-07 21:43:42.780 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA upgrade progress: 0.1
2022-12-07 21:43:43.032 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA upgrade progress: 0.1
2022-12-07 21:43:43.273 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA upgrade progress: 0.2
2022-12-07 21:43:43.531 DEBUG (MainThread) [zigpy.zcl] [0x9253:1:0x0019] OTA upgrade progress: 0.2 |
@puddly Thank you for your help. Yesterday I tried many times and was able to OTA devices. |
@puddly Hello, excuse me, I still have a question I would like to consult you. |
…nkk#4927) Add URL for Third Reality (3reality) OTA provider to OTA_URLs.md https://tr-zha.s3.amazonaws.com/firmware.json FYI; Third Reality (3reality) OTA provider support and custom image format parser was recently added to zigpy library: zigpy/zigpy#1096 zigpy/zigpy#1090 zigpy/zigpy#1089 Official website and Facebook group for reference: https://www.3reality.com/ https://www.facebook.com/ThirdReality.offical/
@puddly Hello, I have the following brands of dongle around me now: nortek, conbe, nxp 5169 (zigate firmware), sonoff. I can't use SONOFF's dongle to OTA Third Reality devices. Do you know how to solve this problem? |
@hwzolin I've been testing using a Silicon Labs radio like the Sonoff and have had no issues. You really need to provide more context here. |
@puddly Hello, this is the OTA code of thirdreality company. Please check it