Excodibur / ioBroker.tahoma

ioBroker adapter for Somfy Tahoma
MIT License
12 stars 9 forks source link

No commands created for shutter blinds due to nparams being 1 instead of 0 in updateDevice #17

Closed mghomedev closed 2 years ago

mghomedev commented 3 years ago

I did not get any commands for my rts:ExteriorBlindRTSComponent UpDownExteriorScreen component.

The reason is, that Tahoma reports nparams=1 instead of 0 so updateDevice simply discards them without reason.

As a hotfix for myself, I used this change:

` var allowedCommandsWithOneParam = ["up", "down", "open", "close", "stop"];

    if(command.nparams === 0 || (command.nparams === 1 &&  allowedCommandsWithOneParam.indexOf(command.commandName)>=0)) {

`

Then it works correctly.

I strongly suggest to fix that in a more general way asap, and also to add full logging for commands that have been discarded for whatever reason.

mghomedev commented 3 years ago

While you are at it, please also add logging for the setup-data-blob that is received from Tahoma like this:

Tahoma.prototype.getSetup = function(callback) { this.sendGET('setup', {}, function(err, data) { if(!err) { controller.context.debug.info("getSetup, data="+ JSON.stringify(data));

This allows to debug these issues much easier for us, when the Tahoma specification or behavior changes in future

Tino1410 commented 3 years ago

Hallo, bei mir werden auch keine commands angezeigt (nur identify + test). Was muss ich machen, damit ich "up", "down", "open", "close", "stop" bekomme und ansteuern kann?

Hi, I don't see any commands either (only identify + test). What do I have to do so that I can get and control "up", "down", "open", "close", "stop"?

Über Hilfe wäre ich sehr dankbar.

I would be really grateful for help.

grafik

smarial commented 3 years ago

I did not get any commands for my rts:ExteriorBlindRTSComponent UpDownExteriorScreen component.

The reason is, that Tahoma reports nparams=1 instead of 0 so updateDevice simply discards them without reason.

As a hotfix for myself, I used this change:

` var allowedCommandsWithOneParam = ["up", "down", "open", "close", "stop"];

    if(command.nparams === 0 || (command.nparams === 1 &&  allowedCommandsWithOneParam.indexOf(command.commandName)>=0)) {

`

Then it works correctly.

I strongly suggest to fix that in a more general way asap, and also to add full logging for commands that have been discarded for whatever reason.

@mghomedev : where did you put your hotfix exactly? I have exactly the same issue.

uwe72 commented 3 years ago

@mghomedev @smarial Hi guys. I have the same problem. There are no more states for "up" and "down" for my RTS roller shutter. Last year this worked well!

Is there at least any workaround?

uwe72 commented 3 years ago

@smarial He did it directly in the adapter code in tahoma.js in folder lib.

smarial commented 3 years ago

i meant where in code within tahoma.js?

uwe72 commented 3 years ago

i meant where in code within tahoma.js?

image

smarial commented 3 years ago

worked for me. i changed directly in the code via terminal and nano editor.

uwe72 commented 3 years ago

worked for me. i changed directly in the code via terminal and nano editor.

@smarial where exactly can i find this file within iobroker?

ok, i found it: image

uwe72 commented 3 years ago

@smarial

worked for me. i changed directly in the code via terminal and nano editor.

ok worked also for me!

smarial commented 3 years ago

I don‘t have for one device but Not for an other (similar) one.

mghomedev commented 3 years ago

Yes, exactly, I directly changed it there in the .js. I hope the code maintainer can fix it in future.

I have a "moving" state by the way (but I did not do any further changes):

image

uwe72 commented 3 years ago

Yes, exactly, I directly changed it there in the .js. I hope the code maintainer can fix it in future.

I have a "moving" state by the way (but I did not do any further changes):

image

yes, i also got after a few moments the states.moving state. Everything works fine now for me. I also did the bugfix directly in the .js file.

Excodibur commented 3 years ago

@mghomedev May I ask you to install the latest adapter release from Github, or install v0.4.0 onwards and send me the log outputs on debug-level? You can send it to excodibur-iobroker@posteo.de as it might be too much data to share here.

I am interested mostly in the new "RESPONSE:" entries (especially the call to /setup you mentioned).

As those contain the responses sent directly by Tahomalink, please remove your personal address data from the logs (e.g. location-object that is part of the /setup response, before sending them.

Mar-Bus commented 3 years ago

Hello,

I updated the adapter to version 0.4.3 and modified the code as suggested above by uwe72. In the past I did this already before with version 0.3.3 and it worked.

Apparently this modification does not work anymore with version 0.4.3, today the adapter does not connect anymore. If I replace the modified file with the original file again, the adapter connects again, but with missing commands.

Did anybody apply the suggested modification in the "tahoma.js" file with the adapter version 0.4.3? Did it work? Any help is appreciated since all my RTS shutters do not work anymore due to the missing commands.

@Excodibur: would be great if you could fix this problem in your adapter.

Excodibur commented 3 years ago

@Mar-Bus To fix this problem, I need someone with RTS shutters to run the current adapter release (0.4.3 or higher) with DEBUG logging enabled and then send the redacted logs to me via mail-address mentioned above. Attaching them to the ticket is probably also possible, but since there could still be personal information in there (like the private address you configured via tahomalink) I would advise to be careful with it.

Without the logs I unfortunately cannot do much to fix this, since I don't own any RTS devices and cannot reproduce the problem myself. To be honest I also don't want to simply merge the suggested "nparams" fix, since without understanding it, it could very well break the adapter for other users, or as it sounds according to your comment, just be a temporary fix.

If you can provide DEBUG logs, I would appreciate it very much. :-)

Mar-Bus commented 3 years ago

@Excodibur: I'm not experienced at all. How do I enable logging? In the adapter or in ioBroker? Regards and thanks for your help.

Excodibur commented 3 years ago

@Mar-Bus If you are using the new Admin UI, it should look something like this there:

At the top enable expert-mode via the icon: image

Go to the "Instance" tab, find your tahoma instance and change the loglevel from INFO to DEBUG. The adapter will restart automatically. image

Got to the "Logs" tab, filter for your tahoma instance, ensure you see logs with DEBUG-level there and download the logs. image

Remove personal data like address from the logs and deliver them to me. :-)

Mar-Bus commented 3 years ago

Thanks for your support, after a break ( vacation :-) ) I followed your instructions. Attached please find the data. It seems that I have coding problem. Therefore I attached also the modified file as a txt file. Could it be a problem that I use sometimes a macOS and sometimes Windows.

Many regard in advance for your support. tahoma_mod.jx.txt

iobroker.2021-10-11-letztes.log Kopie.docx

Excodibur commented 3 years ago

@Mar-Bus Thank you for providing the logfiles!

I made some changes to the current implementation. T.b.h. my workaround is not ideal, but it should hopefully enable you to use RTS devices properly.

May I ask you to install the latest adapter release from Github, or IOBroker beta-repo (v 0.5.0) and check if it works?

Mar-Bus commented 3 years ago

I installed the latest adapter, a first short test worked, more testing will follow during the next days. I'll keep you informed. Thanks again