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

Enable Control Application support? #110

Open
sgraystar opened this issue Sep 2, 2020 · 11 comments
Open

Enable Control Application support? #110

sgraystar opened this issue Sep 2, 2020 · 11 comments

Comments

@sgraystar
Copy link

Excellent work with this plugin @anthonywebb , thanks.

Is the Enable Control application supported?

I was tinkering with my cbus setup and changed some virtual GA from Lighting to Enable Control, however it appears to be partially working.

Defining them as a Light sees the cbus on/off state reflected in the iPhone Home app, but any changes initiated in the app are not accepted:

2020-09-01T23:54:31.039Z cbus:client sent command '[206] ramp //DENDY4/254/203/0 0% # setOn (off)' 2020-09-01T23:54:31.039Z cbus:client rx response { commandId: 206, code: 402, matched: false, processed: false, type: 'response', raw: '[206] 402 Operation not supported by: //DENDY4/254/203/0 (Method ramp not found)' } 2020-09-01T23:54:31.039Z cbus:client matched request '[206] ramp //DENDY4/254/203/0 0% # setOn (off)' with response '[206] 402 Operation not supported by: //DENDY4/254/203/0 (Method ramp not found)' (0 pending requests)

Similarly, defining them as triggers are also not accepted:
'[135] 402 Operation not supported by: //DENDY4/254/203/0 (Method triggerevent not found)'

This is a small issue, I can change back to the Lighting application if required.

@JasonY00
Copy link
Contributor

JasonY00 commented Sep 2, 2020

AFAIK, the C-Bus messages for enable & trigger control are in a lighting format.

I did notice in your homebridge log that there was a errored "ramp" command. Is this defined in your config.json? If it is, "rampDuration" isn't defined in the trigger control accessory. This "may" be the cause of the problem.

Trigger accessories need this format:

{ "type": "trigger", "application": 202, "id": 0, "action": 1, "name": "recall preset 2" },

so to define as an "enable" with the type still set to "trigger" but using the enable Application Number.

When defined as trigger, they should appear as a switch and not a light/dimmer in homebridge.

If you have this type lighting "dimmer" format:

{ "type": "dimmer", "id": 22, "name": "Wake Up Lights", "rampDuration": "10 min"} in your config.json file, or you are trying to "slide" the dimmer in the home app, one of these may be the cause of your problem.

If you put up the snippet from your config.json file that defines the accessory in question, then it will be easier to troubleshoot.

Cheers

Jason

@sgraystar
Copy link
Author

sgraystar commented Sep 2, 2020

Hi Jason.

Starting with the simplest config:
{ "type": "light", "application": 203, "id": 0, "name": "AC Power", "enabled": true }

This generates the error above for 'Method ramp not found':
2020-09-01T23:54:31.039Z cbus:client sent command '[206] ramp //DENDY4/254/203/0 0% # setOn (off)' 2020-09-01T23:54:31.039Z cbus:client rx response { commandId: 206, code: 402, matched: false, processed: false, type: 'response', raw: '[206] 402 Operation not supported by: //DENDY4/254/203/0 (Method ramp not found)' } 2020-09-01T23:54:31.039Z cbus:client matched request '[206] ramp //DENDY4/254/203/0 0% # setOn (off)' with response '[206] 402 Operation not supported by: //DENDY4/254/203/0 (Method ramp not found)' (0 pending requests)

Changing to a dimmer config:
{ "type": "dimmer", "application": 203, "id": 0, "name": "AC Power", "enabled": true }

Gives the same error:
2020-09-02T01:12:08.275Z cbus:client sent command '[138] ramp //DENDY4/254/203/0 0% # setOn (off)' 2020-09-02T01:12:08.276Z cbus:client rx response { commandId: 138, code: 402, matched: false, processed: false, type: 'response', raw: '[138] 402 Operation not supported by: //DENDY4/254/203/0 (Method ramp not found)' } 2020-09-02T01:12:08.276Z cbus:client matched request '[138] ramp //DENDY4/254/203/0 0% # setOn (off)' with response '[138] 402 Operation not supported by: //DENDY4/254/203/0 (Method ramp not found)' (0 pending requests)

Adding ramp rate to dimmer config:
{ "type": "dimmer", "application": 203, "id": 0, "name": "AC Power", "rampDuration": "1 min", "enabled": true }

Gives the same error:
2020-09-02T01:20:56.561Z cbus:client sent command '[137] ramp //DENDY4/254/203/0 0% 60 # setOn (off)' 2020-09-02T01:20:56.564Z cbus:client rx response { commandId: 137, code: 402, matched: false, processed: false, type: 'response', raw: '[137] 402 Operation not supported by: //DENDY4/254/203/0 (Method ramp not found)' } 2020-09-02T01:20:56.564Z cbus:client matched request '[137] ramp //DENDY4/254/203/0 0% 60 # setOn (off)' with response '[137] 402 Operation not supported by: //DENDY4/254/203/0 (Method ramp not found)' (0 pending requests)

And changing to trigger config:
{ "type": "trigger", "application": 203, "id": 0, "action": 0, "name": "AC Power Off", "enabled": true }, { "type": "trigger", "application": 203, "id": 0, "action": 255, "name": "AC Power On", "enabled": true }

Gives the different error:
2020-09-02T01:26:31.019Z cbus:client sent command '[125] trigger event //DENDY4/254/203/0 0' 2020-09-02T01:26:31.020Z cbus:client rx response { commandId: 125, code: 402, matched: false, processed: false, type: 'response', raw: '[125] 402 Operation not supported by: //DENDY4/254/203/0 (Method triggerevent not found)' } 2020-09-02T01:26:31.020Z cbus:client matched request '[125] trigger event //DENDY4/254/203/0 0' with response '[125] 402 Operation not supported by: //DENDY4/254/203/0 (Method triggerevent not found)' (0 pending requests) 2020-09-02T01:26:33.208Z cbus:client sent command '[126] trigger event //DENDY4/254/203/0 255' 2020-09-02T01:26:33.209Z cbus:client rx response { commandId: 126, code: 402, matched: false, processed: false, type: 'response', raw: '[126] 402 Operation not supported by: //DENDY4/254/203/0 (Method triggerevent not found)' } 2020-09-02T01:26:33.209Z cbus:client matched request '[126] trigger event //DENDY4/254/203/0 255' with response '[126] 402 Operation not supported by: //DENDY4/254/203/0 (Method triggerevent not found)' (0 pending requests)

@JasonY00
Copy link
Contributor

JasonY00 commented Sep 2, 2020

OK,

Try it as a switch:

{ "type": "switch", "application": 203, "id": 0, "name": "AC Power", "enabled": true }

It is implicit in the design of the switch accessory that the ON level is 255 and the OFF level is 0

If you want, you can also have an active duration defined...

Cheers

Jason

@sgraystar
Copy link
Author

Config:
{ "type": "switch", "application": 203, "id": 0, "name": "AC Power", "enabled": true }

Error:
2020-09-02T02:16:24.031Z cbus:client sent command '[136] off //DENDY4/254/203/0' 2020-09-02T02:16:24.032Z cbus:client rx response { commandId: 136, code: 402, matched: false, processed: false, type: 'response', raw: '[136] 402 Operation not supported by: //DENDY4/254/203/0 (Method off not found)' } 2020-09-02T02:16:24.032Z cbus:client matched request '[136] off //DENDY4/254/203/0' with response '[136] 402 Operation not supported by: //DENDY4/254/203/0 (Method off not found)' (0 pending requests)

@JasonY00
Copy link
Contributor

JasonY00 commented Sep 2, 2020

Hmmm. That's puzzling. I will look up the options for enable and see if perhaps we can write an enable accessory. I'm not sure if there is a specific "enable" command in C-Gate Until then, perhaps stick with lighting and I will read up.

Cheers

Jason

@sgraystar
Copy link
Author

No worries, it is a simple change for me.
Cheers

@JasonY00
Copy link
Contributor

JasonY00 commented Sep 2, 2020

OK. So looking at the c-gate manual I had a false memory that "enable" and "trigger" had a similar command.

A trigger event command looks like this:
trigger event //system/1/202/144 2

where an enable command looks like this:
enable set //system/1/203/144 2

The good news is that an enable accessory can be effectively "cloned" from the trigger accessory with the same functionality. It would also appear as a switch accessory in homekit.

So in your case you would have the following as your accessory definition:

{ "type": "enablecontrol", "application": 203, "id": 0, "action": 0, "name": "AC Power Off", "enabled": true },

I think something like "enablecontrol" may be better than "enable" for the accessory type as it may be too easily confused with the "enabled" option for each accessory.

I will try to get this up and running and submit it for approval by Anthony as soon as I have time.

Cheers

Jason

@sgraystar
Copy link
Author

If nobody has noticed until now I would not rush to implement something just for this case.
Maybe a symptom of how widely EC is actually used.

@JasonY00
Copy link
Contributor

JasonY00 commented Sep 2, 2020

I think it is worth the effort. Anything that brings C-Bus and Homekit closer to a 1:1 relationship is worth the effort. In this case, its not a big effort and it gives an option to incorporate the feature of enable control as it has been designed for in c-bus. That way you can keep your enable variables in the enable application where they are supposed to be. I can tell you that my own lighting application 56 is already full and I created a lighting application 57 for the overflow...

@JasonY00
Copy link
Contributor

JasonY00 commented Sep 2, 2020

I have written a enable control accessory and submitted it today as a pull request for Anthony. As soon as he approves it , you are good to go. It is set up the same way as a trigger accessory. Just use application 203 instead of 202 and "enablecontrol" instead of "trigger" in config.json like this:

{ "type": "enablecontrol", "application": 203, "id": 0, "action": 0, "name": "AC Power Off", "enabled": true },

It will be rendered as a switch service in the home app and perform in exactly the same way as a "trigger" switch does.

Cheers

Jason

@sgraystar
Copy link
Author

Thanks Jason

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

No branches or pull requests

2 participants