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 Lixee ZLinky_TIC manufacturer specific cluster #1165

Merged
merged 7 commits into from
Oct 16, 2022

Conversation

pdecat
Copy link
Contributor

@pdecat pdecat commented Nov 20, 2021

This PR adds support for the manufacturer specific cluster 0xFF66 of the Lixee ZLinky_TIC device.

Reference available at:

Submitted as draft as there's only one of many attribute for now.

Resolves #1146

@codecov-commenter
Copy link

codecov-commenter commented Nov 20, 2021

Codecov Report

Base: 80.00% // Head: 80.02% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (d718950) compared to base (2292c4e).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1165      +/-   ##
==========================================
+ Coverage   80.00%   80.02%   +0.02%     
==========================================
  Files         239      239              
  Lines        7430     7438       +8     
==========================================
+ Hits         5944     5952       +8     
  Misses       1486     1486              
Impacted Files Coverage Δ
zhaquirks/lixee/__init__.py 100.00% <100.00%> (ø)
zhaquirks/lixee/zlinky.py 100.00% <100.00%> (ø)

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@coveralls
Copy link

coveralls commented Nov 20, 2021

Pull Request Test Coverage Report for Build 3219067147

  • 9 of 9 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 80.022%

Totals Coverage Status
Change from base Build 3212112661: 0.02%
Covered Lines: 5952
Relevant Lines: 7438

💛 - Coveralls

@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch from db467d0 to 2367488 Compare November 20, 2021 12:13
name = "ZLinky_TIC Manufacturer specific"
ep_attribute = "zlinky_cluster"
manufacturer_attributes = {
0x0000: ("optarif_or_ngtf", t.LimitedCharString(16)),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the attribute name be translated from French to English? Doing so would be harder to maintain.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, @Adminiuga what do you think? My initial thought is yes and we could have a comment with the French translation on each line to help with the maintenance… the entire code base is in English so having just this in French would be a bit odd IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, I'll proceed with the translation.

zhaquirks/lixee/zlinky.py Outdated Show resolved Hide resolved
zhaquirks/lixee/zlinky.py Outdated Show resolved Hide resolved
@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch 2 times, most recently from 23df8ef to 67956d5 Compare November 28, 2021 09:58
@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch from 67956d5 to b8c9bed Compare December 11, 2021 17:01
@max5962
Copy link

max5962 commented Dec 14, 2021

any news about that Merge Request ? Still in DRAFT ?

@pdecat
Copy link
Contributor Author

pdecat commented Dec 14, 2021

Hi, it is not working yet, querying the manufacturer specific clusters is failing. I believe there are firmware related issues to be resolved before, and my Lixee ZLinky_TIC is loosing connectivity after a few hours/days which is not helping making progress.

Edit: my ZLinky_TIC issues were resolved by manufacturer, it was an hardware issue.

@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch from b8c9bed to 5d650b1 Compare February 4, 2022 07:50
@Jsl-1
Copy link
Contributor

Jsl-1 commented Mar 14, 2022

Hi, maybe reading error is related to this : Koenkk/zigbee2mqtt#11431

As i understand, reading is not working on this cluster when manufacturer code is specified.

@pdecat
Copy link
Contributor Author

pdecat commented Mar 15, 2022

As i understand, reading is not working on this cluster when manufacturer code is specified.

Indeed, that is the firmware related issue I'm referring to.

See also fairecasoimeme/Zlinky_TIC#46 (comment)

@Hedda
Copy link
Contributor

Hedda commented Aug 2, 2022

Any news on this?

@axellebot
Copy link
Contributor

axellebot commented Sep 1, 2022

FYI : OTA 6.0 released

@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch from 5d650b1 to 6c4f1af Compare September 1, 2022 15:57
@axellebot
Copy link
Contributor

How can I help on this ?

@pdecat
Copy link
Contributor Author

pdecat commented Sep 4, 2022

The issue when reading manufacturer specific cluster attributes with the manufacturer id specified seems to be still present with firmware v6.0.

Invoking the following with ZHA Toolkit with the manufacturer id:

service: zha_toolkit.attr_read
data:
  ieee: 00:15:8d:00:04:ff:96:92
  cluster: 65382
  attribute: 0
  manf: 4151

Does not work:

2022-09-02 14:41:11.750 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=True, direction=<Direction.Server_to_Client: 0>, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True, *is_reply=False), manufacturer=4151, tsn=187, command_id=<GeneralCommand.Read_Attributes: 0>, *direction=<Direction.Server_to_Client: 0>, *is_reply=False)
2022-09-02 14:41:11.750 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Sending request: Read_Attributes(attribute_ids=[0])
2022-09-02 14:41:11.859 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Received ZCL frame: b'\x1C\x37\x10\xBB\x01\x00\x00\x86'
2022-09-02 14:41:11.860 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=True, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True, *is_reply=True), manufacturer=4151, tsn=187, command_id=1, *direction=<Direction.Client_to_Server: 1>, *is_reply=True)
2022-09-02 14:41:11.861 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Decoded ZCL frame: ManufacturerSpecificCluster:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0000, status=<Status.UNSUPPORTED_ATTRIBUTE: 134>)])

Without the manufacturer id:

service: zha_toolkit.attr_read
data:
  ieee: 00:15:8d:00:04:ff:xx:xx
  cluster: 65382
  attribute: 0

It works:

2022-09-02 14:35:31.523 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, direction=<Direction.Server_to_Client: 0>, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True, *is_reply=False), tsn=124, command_id=<GeneralCommand.Read_Attributes: 0>, *direction=<Direction.Server_to_Client: 0>, *is_reply=False)
2022-09-02 14:35:31.523 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Sending request: Read_Attributes(attribute_ids=[0])
2022-09-02 14:35:32.334 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Received ZCL frame: b'\x18\x7C\x01\x00\x00\x00\x42\x10\x20\x20\x20\x20\x20\x20\x42\x41\x53\x45\x00\x20\x20\x20\x20\x20'
2022-09-02 14:35:32.335 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True, *is_reply=True), tsn=124, command_id=1, *direction=<Direction.Client_to_Server: 1>, *is_reply=True)
2022-09-02 14:35:32.335 DEBUG (MainThread) [zigpy.zcl] [0xCB89:1:0xff66] Decoded ZCL frame: ManufacturerSpecificCluster:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0000, status=<Status.SUCCESS: 0>, value=TypeValue(type=CharacterString, value='      BASE'))])

Anyway, I'm downgrading the firmware to v5.0 because v6.0 is causing issues.

@tex0l
Copy link

tex0l commented Sep 22, 2022

Apparently v7.0 has been released, does it help with this in any way?

@pdecat
Copy link
Contributor Author

pdecat commented Sep 22, 2022

Apparently v7.0 has been released, does it help with this in any way?

Sadly, not.

@fairecasoimeme
Copy link

This pre-release fix the manufacturer issue : https://github.com/fairecasoimeme/Zlinky_TIC/releases/tag/v9.0

@pdecat
Copy link
Contributor Author

pdecat commented Sep 30, 2022

Awesome, thanks! OTA in progress...

@pdecat
Copy link
Contributor Author

pdecat commented Sep 30, 2022

I can confirm it is now working fine:

service: zha_toolkit.attr_read
data:
  ieee: 00:15:8d:00:04:ff:96:92
  cluster: 65382
  attribute: 0
  manf: 4151
2022-09-30 22:02:52.899 DEBUG (MainThread) [zigpy.zcl] [0x77AF:1:0xff66] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=True, direction=<Direction.Server_to_Client: 0>, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True, *is_reply=False), manufacturer=4151, tsn=47, command_id=<GeneralCommand.Read_Attributes: 0>, *direction=<Direction.Server_to_Client: 0>, *is_reply=False)
2022-09-30 22:02:52.899 DEBUG (MainThread) [zigpy.zcl] [0x77AF:1:0xff66] Sending request: Read_Attributes(attribute_ids=[0])
2022-09-30 22:02:52.979 DEBUG (MainThread) [zigpy.zcl] [0x77AF:1:0xff66] Received ZCL frame: b'\x1C\x37\x10\x2F\x01\x00\x00\x00\x42\x10\x20\x20\x20\x20\x20\x20\x42\x41\x53\x45\x00\x20\x20\x20\x20\x20'
2022-09-30 22:02:52.980 DEBUG (MainThread) [zigpy.zcl] [0x77AF:1:0xff66] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=True, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True, *is_reply=True), manufacturer=4151, tsn=47, command_id=1, *direction=<Direction.Client_to_Server: 1>, *is_reply=True)
2022-09-30 22:02:52.980 DEBUG (MainThread) [zigpy.zcl] [0x77AF:1:0xff66] Decoded ZCL frame: ManufacturerSpecificCluster:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0000, status=<Status.SUCCESS: 0>, value=TypeValue(type=CharacterString, value='      BASE'))])

I'll update this PR ASAP.

@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch from 6c4f1af to a15a5ef Compare October 1, 2022 06:31
@pdecat
Copy link
Contributor Author

pdecat commented Oct 1, 2022

I've got good news to share:

image

image

image

image

Next on my TODO list is to translate all the attributes from French to English...

@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch 2 times, most recently from ac43627 to 0458f1d Compare October 1, 2022 08:52
@pdecat pdecat marked this pull request as ready for review October 1, 2022 08:59
@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch from 0458f1d to 50f7e66 Compare October 1, 2022 09:08
Comment on lines +34 to +38
0x0000: (
"hist_tariff_option_or_std_supplier_price_schedule_name",
t.LimitedCharString(16),
True,
),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be awesome to have descriptions on attributes that would show up in the UI, e.g.:

Suggested change
0x0000: (
"hist_tariff_option_or_std_supplier_price_schedule_name",
t.LimitedCharString(16),
True,
),
0x0000: (
"hist_tariff_option_or_std_supplier_price_schedule_name",
t.LimitedCharString(16),
True,
"Historical mode: Option tarifaire / Standard mode: Nom du calendrier tarifaire fournisseur",
),

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@puddly whatcha think about this request?

@pdecat
Copy link
Contributor Author

pdecat commented Oct 1, 2022

I believe this PR is now ready for another round of reviews. 🙏

@Hedda
Copy link
Contributor

Hedda commented Oct 3, 2022

Nice! By the way, would be great if someone wrote ZLinky TIC OTA Provider download code for zigpy, see -> zigpy/zigpy#1060

@pdecat pdecat force-pushed the lixee_manufacturer_specific_cluster branch from ed6b208 to d718950 Compare October 10, 2022 11:46
@pdecat pdecat requested review from dmulcahey and removed request for N0ciple October 10, 2022 21:04
@dmulcahey dmulcahey merged commit fceacf1 into zigpy:dev Oct 16, 2022
@pdecat
Copy link
Contributor Author

pdecat commented Oct 16, 2022

Thanks @dmulcahey! 🎉

@mospaeda
Copy link

mospaeda commented Oct 21, 2022

I have Home Assistant (version: 2022.10.5) with Zlinky (firmware 9 out-of-the-box) and I checked the ZLinkyTICManufacturerCluster. All is ok
Many thanks

This pull request was closed.
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.

[Device Support Request] ZLinky_TIC (French Linky electricity meter)