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 Support for tint-remote keys #281

Closed
MoskitoHorst opened this issue Feb 16, 2019 · 25 comments
Closed

Add Support for tint-remote keys #281

MoskitoHorst opened this issue Feb 16, 2019 · 25 comments
Labels

Comments

@MoskitoHorst
Copy link
Contributor

Only 3 keys of the remotedo generate Messages. All others do not. The logfile has all keys pressed from up to down/left to Right.
Color-Keys seem to have cluster-ID 768, Scenes have cluster-ID 0.
The first part of the discussion and an Image of the device can be found here.

Koenkk/zigbee2mqtt#795

log4.txt

Thanks

@Koenkk
Copy link
Owner

Koenkk commented Feb 16, 2019

Do you see any direct output when you pres any of the button? (when running with DEBUG=* npm start)

@MoskitoHorst
Copy link
Contributor Author

yes, the following lines come, when I press "warm":
serialport:poller received "readable" +39s
serialport:bindings read +39s
serialport:unixRead Starting read +39s
serialport:unixRead Finished read 34 bytes +0ms
serialport:main binding.read finished +39s
cc-znp { sof: 254,
cc-znp len: 29,
cc-znp type: 'AREQ',
cc-znp subsys: 'AF',
cc-znp cmd: 'incomingMsg',
cc-znp payload:
cc-znp { groupid: 16388,
cc-znp clusterid: 768,
cc-znp srcaddr: 25648,
cc-znp srcendpoint: 1,
cc-znp dstendpoint: 1,
cc-znp wasbroadcast: 0,
cc-znp linkquality: 76,
cc-znp securityuse: 0,
cc-znp timestamp: 11712182,
cc-znp transseqnumber: 0,
cc-znp len: 9,
cc-znp data: <Buffer 11 32 0a 72 01 0a 00 00 00> },
cc-znp fcs: 130,
cc-znp csum: 130 } +39s
serialport:main _read reading +14ms
serialport:bindings read +15ms
serialport:unixRead Starting read +14ms
cc-znp:AREQ <-- AF:incomingMsg, { groupid: 16388, clusterid: 768, srcaddr: 25648, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 76, securityuse: 0, timestamp: 11712182, transseqnumber: 0, len: 9, data: <Buffer 11 32 0a 72 01 0a 00 00 00> } +6ms
zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +0ms
zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +39s
serialport:unixRead waiting for readable because of code: EAGAIN +34ms
serialport:poller Polling for "readable" +51ms
zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +31ms

They are in the logfile. But I do not see something without debug. All other keys produce similar results

@Koenkk
Copy link
Owner

Koenkk commented Feb 16, 2019

Can you add on https://github.com/Koenkk/zigbee-shepherd/blob/master/lib/components/af.js#L689

console.log('CMD ID', msg.zclMsg.cmdId)

@MoskitoHorst
Copy link
Contributor Author

It resulted in
CMD ID moveToColorTemp
for the colorWheel:
CMD ID moveToColor
and for the Scenes:
CMD ID write

@Koenkk
Copy link
Owner

Koenkk commented Feb 17, 2019

Good, you should add those to this list now: https://github.com/Koenkk/zigbee-shepherd/blob/master/lib/components/af.js#L686

@MoskitoHorst
Copy link
Contributor Author

Ok, this worked for most of the keys. The Scenes do not:
serialport:main binding.read finished +24s
cc-znp { sof: 254,
cc-znp len: 29,
cc-znp type: 'AREQ',
cc-znp subsys: 'AF',
cc-znp cmd: 'incomingMsg',
cc-znp payload:
cc-znp { groupid: 16388,
cc-znp clusterid: 0,
cc-znp srcaddr: 25648,
cc-znp srcendpoint: 1,
cc-znp dstendpoint: 1,
cc-znp wasbroadcast: 0,
cc-znp linkquality: 78,
cc-znp securityuse: 0,
cc-znp timestamp: 8278316,
cc-znp transseqnumber: 0,
cc-znp len: 9,
cc-znp data: <Buffer 14 1b 12 58 02 05 40 20 02> },
cc-znp fcs: 66,
cc-znp csum: 66 } +24s
serialport:main _read reading +9ms
serialport:bindings read +11ms
serialport:unixRead Starting read +11ms
cc-znp:AREQ <-- AF:incomingMsg, { groupid: 16388, clusterid: 0, srcaddr: 25648, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 78, securityuse: 0, timestamp: 8278316, transseqnumber: 0, len: 9, data: <Buffer 14 1b 12 58 02 05 40 20 02> } +4ms
zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +24s
zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +24s
serialport:unixRead waiting for readable because of code: EAGAIN +9ms
serialport:poller Polling for "readable" +21ms
zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +8ms
CMD ID write

Maybe, the value of 0 is a Special case.

Horst

@MoskitoHorst
Copy link
Contributor Author

I put my changes in devices.pm and fromZigbee.pm

@MoskitoHorst
Copy link
Contributor Author

Sorry, Maybe my pull request is a bit missformed.

@MoskitoHorst
Copy link
Contributor Author

I did a local change in:
af.js, Line 694:
if ( cmdIDs.includes(msg.zclMsg.cmdId) && msg.zclMsg.payload) {
// if (frameType === 1 && cmdIDs.includes(msg.zclMsg.cmdId) && msg.zclMsg.payload) {

but a do not know About side effects. After this, I get results for the scene-keys as well, but I donot trust in my change.

@stale
Copy link

stale bot commented Oct 18, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 18, 2019
@stale stale bot closed this as completed Oct 25, 2019
@FHeilmann
Copy link

@Koenkk sorry to resurrect this closed issue, but I'm seing the same issue @MoskitoHorst was seing. All buttons on the remote work, except the scene buttons, which don't trigger any response in zigbee2mqtt.

I'm running the latest dev, freshly pulled today. Lmk if there is anything I can try to assist you.

@Koenkk
Copy link
Owner

Koenkk commented Dec 5, 2019

@FHeilmann please provide the log when pressing the button and running zigbee2mqtt with herdsman debug log enabled.

To enable herdsman debug logging, see https://www.zigbee2mqtt.io/information/debug.html#zigbee-herdsman-debug-logging

@FHeilmann
Copy link

mueller_tint_remote_scene_keys.log

There you go, this is the log of pressing each of the scene buttons once.

Bests,
-Florian

@Koenkk
Copy link
Owner

Koenkk commented Dec 7, 2019

Do you see a No converter available... message in the zigbee2mqtt log with debug logging enabled?

To enable debug logging set in configuration.yaml:

advanced:
  log_level: debug

@FHeilmann
Copy link

Unfortunately no. Zigbee2mqtts log does not react at all to the scene buttons, regardless of the log level.

@Koenkk
Copy link
Owner

Koenkk commented Dec 7, 2019

Could you sniff the traffic while pressing the buttons? https://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html

@FHeilmann
Copy link

FHeilmann commented Dec 9, 2019

Sure, here is the capture file from Wireshark:

tint.zip

The file contains the following sequence:

I pressed

  • Color temp down (towards warm)
  • Color temp up (towards cold)
  • Brightness down
  • Brightness up
  • Each Scene button once: Reading, Sunset, Disco, Moonlight, Fireplace, Heartbeat
  • Each Scene button once, again: Reading, Sunset, Disco, Moonlight, Fireplace, Heartbeat
  • Color temp down (towards warm)
  • Color temp up (towards cold)
  • Brightness down
  • Brightness up

Hope this helps,

-Florian

Koenkk added a commit to Koenkk/zigbee-herdsman that referenced this issue Dec 11, 2019
@Koenkk
Copy link
Owner

Koenkk commented Dec 11, 2019

Thanks, it turns out that the scene buttons are not common write request. These were not yet emitted, and therefore you wouldn't get No converter available.. messages. Please update to the latest zigbee2mqtt dev branch and set the log level to debug. You should now see these No converter available... messages and can start writing the missing converters.

@FHeilmann
Copy link

FHeilmann commented Dec 11, 2019

Thank you so much for the swift fix. I also have some tint bulbs, does this patch also expose the functionality so I can send the 'write' requests to those bulbs too?

edit: I can already confirm that the missing converter messages are now triggered:


zigbee2mqtt:debug 2019-12-11 19:49:40: Received Zigbee message from 'RGB Remote', type 'write', cluster 'genBasic', data '{"16389":3}' from endpoint 1 with groupID 16388
zigbee2mqtt:warn  2019-12-11 19:49:40: No converter available for 'MLI-404011' with cluster 'genBasic' and type 'write' and data '{"16389":3}'
zigbee2mqtt:debug 2019-12-11 19:49:46: Received Zigbee message from 'RGB Remote', type 'write', cluster 'genBasic', data '{"16389":1}' from endpoint 1 with groupID 16388
zigbee2mqtt:warn  2019-12-11 19:49:46: No converter available for 'MLI-404011' with cluster 'genBasic' and type 'write' and data '{"16389":1}'
zigbee2mqtt:debug 2019-12-11 19:49:47: Received Zigbee message from 'RGB Remote', type 'write', cluster 'genBasic', data '{"16389":2}' from endpoint 1 with groupID 16388
zigbee2mqtt:warn  2019-12-11 19:49:47: No converter available for 'MLI-404011' with cluster 'genBasic' and type 'write' and data '{"16389":2}'
zigbee2mqtt:debug 2019-12-11 19:49:48: Received Zigbee message from 'RGB Remote', type 'write', cluster 'genBasic', data '{"16389":6}' from endpoint 1 with groupID 16388
zigbee2mqtt:warn  2019-12-11 19:49:48: No converter available for 'MLI-404011' with cluster 'genBasic' and type 'write' and data '{"16389":6}'
zigbee2mqtt:debug 2019-12-11 19:49:49: Received Zigbee message from 'RGB Remote', type 'write', cluster 'genBasic', data '{"16389":4}' from endpoint 1 with groupID 16388
zigbee2mqtt:warn  2019-12-11 19:49:49: No converter available for 'MLI-404011' with cluster 'genBasic' and type 'write' and data '{"16389":4}'
zigbee2mqtt:debug 2019-12-11 19:49:50: Received Zigbee message from 'RGB Remote', type 'write', cluster 'genBasic', data '{"16389":5}' from endpoint 1 with groupID 16388
zigbee2mqtt:warn  2019-12-11 19:49:50: No converter available for 'MLI-404011' with cluster 'genBasic' and type 'write' and data '{"16389":5}'

Koenkk added a commit that referenced this issue Dec 12, 2019
@Koenkk
Copy link
Owner

Koenkk commented Dec 12, 2019

With the latest zigbee2mqtt dev branch these messages should now be converted to MQTT (please wait a few hours before checking the latest dev). Based on this you can further create your own automations based on these actions (e.g. setting a certain color using Home Assistant).

@FHeilmann
Copy link

If I want to send the scene command to my tint bulbs I need a converter in "toZigbee.js" as well right? Thanks for fixing the converter!

@FHeilmann
Copy link

I've done some digging, but I've never worked with typescript before so my skills there are severely limited. My goal is to be able to send the scene commands to the mueller licht GU10 lightbulbs which I own.

I tried the following:

  • added a converter to toZigbee.js:
    tint_scene : {
        // scene selection, tint specific
        key: ['scene'],
        convertSet: async (entity, key, value, meta) => {
            value = parseInt(value);
            if (value > 6) {
              return;
            }
            await entity.command('genBasic', 'write', {'16389': value});
        },
    },
  • modified the respective entry in devices.js to use the new converter:
    // Müller Licht
    {
        zigbeeModel: ['ZBT-ExtendedColor'],
        model: '404000/404005/404012',
        vendor: 'Müller Licht',
        description: 'Tint LED bulb GU10/E14/E27 350/470/806 lumen, dimmable, color, opal white',
        fromZigbee: [
            fz.color_colortemp, fz.on_off, fz.brightness, fz.ignore_basic_report,
        ],
        toZigbee: [
            tz.light_onoff_brightness, tz.light_color_colortemp, tz.ignore_transition,
            tz.light_alert, tz.light_brightness_move, tz.tint_scene,
        ],
    },

Now I'm getting the following error when trying to set a payload with a 'scene' parameter:

zigbee2mqtt:debug 2019-12-12 22:33:00: Error: Cluster 'genBasic' has no command 'write'
    at Object.getCommand (/app/node_modules/zigbee-herdsman/dist/zcl/utils.js:106:19)
    at Endpoint.<anonymous> (/app/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:245:37)
    at Generator.next (<anonymous>)
    at /app/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/app/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:4:12)
    at Endpoint.command (/app/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:243:16)
    at Object.convertSet (/app/node_modules/zigbee-herdsman-converters/converters/toZigbee.js:1188:26)
    at EntityPublish.onMQTTMessage (/app/lib/extension/entityPublish.js:169:52)
    at Controller.callExtensionMethod (/app/lib/controller.js:322:44)

This is where things start to go over my head, because there is a lot of data that has to be added in different places. Here's what I've found so far:

  • toZigbee.js needs to get the manufacturer info for tint added to the options dict:
         tint: {
           manufacturerCode: 0x121b,
         },
    
  • cluster.ts of zigbee-herdsman needs the following attributes added to the genBasic cluster:
    TintScene: {ID: 16389, type: DataType.uint8},
    and the following added to commands:
     write: {
                 ID: 2,
                 parameters: [
                 ],
             },
    

This would also require to rewrite the toZigbee.js converter to:

    tint_scene : {
        // scene selection, tint specific
        key: ['scene'],
        convertSet: async (entity, key, value, meta) => {
            const TintScene = parseInt(value);
            if (TintScene > 6) {
              return;
            }
            await entity.command('genBasic', 'write', {TintScene}, options.tint);
        },
    },

I'm not sure which of these steps are correct. In particular I am not sure if a manufacturerspecific cluster should be defined here, and if so, how I am going to obtain the ID of said cluster. This seems to go into the more advanced device configuration for which I as a js-know-nothing would need your help to accomplish ;)

Thanks in advance

  • Florian

P.S.: The fixed converter for incoming messages works flawlessly.

Koenkk added a commit that referenced this issue Dec 13, 2019
@Koenkk
Copy link
Owner

Koenkk commented Dec 13, 2019

In the latest zigbee2mqtt dev branch this should be possible now (try in a few hours). Send to zigbee2mqtt/[FRIENDLY_NAME]/set payload {"tint_scene": 1} (where the number can be anything between 1 and 6)

@FHeilmann
Copy link

@Koenkk Works great, the only thing I noticed is that I can issue the command to the bulbs directly, but trying to issue the command to a group with several of them in it I get a 'no converter available' message.

Bests,
Florian

Koenkk added a commit to Koenkk/zigbee2mqtt that referenced this issue Dec 16, 2019
@Koenkk
Copy link
Owner

Koenkk commented Dec 16, 2019

Possible with latest dev now.

xmow49 pushed a commit to xmow49/zigbee-herdsman-converters that referenced this issue Jun 14, 2024
I dropped the Mireds prefix, so it matches colorTemperature attribute name used in herdsman.

See ZCL (v7 doc, page 357), while here I also added coupleColorTempToLevelMin which was also missing and marked as mandatory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants