Giter VIP home page Giter VIP logo

Comments (14)

BasvanH avatar BasvanH commented on June 25, 2024 1

Ok got it solved. I cherry picked your code to the 4.1.x branch, now the binding starts without errors. Looks like something changed in the meanwhile where your code does not account for yet.

I then started testing and got the 400 REST API error solved. When I change min="-5" to min="0" it no longer gives the 400. So we need to find a other way to deal with the tilting. Negative number doesn't seem to be supported on Dimmer channel type.

We could change it to Number channel type, it support the negative number. Confirmed working.

from openhab-addons.

BasvanH avatar BasvanH commented on June 25, 2024

I have debugged the tilt requests, and there are they:

Tilt UP:

POST https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/exec/apply?optimizeWithProtocolGroups=true HTTP/1.1
Authorization: Bearer XXXXXXXX
X-OVK-API-Key: 5a5e0523-b9f9-4111-a879-775e7d871346
X-OVK-Application-Id: tahoma3-android
User-Agent: Dalvik/2.1.0 (Linux; U; Android 14; sdk_gphone64_x86_64 Build/UE1A.230829.036.A1);tahoma
Content-Type: application/json; charset=UTF-8
Content-Length: 134
Host: ha101-1.overkiz.com
Connection: Keep-Alive
Accept-Encoding: gzip

{"label":"apply","actions":[{"deviceURL":"rts:\/\/1227-9296-2XXX\/16746XXX","commands":[{"name":"tiltNegative","parameters":[3,0]}]}]}

Tilt DOWN:

POST https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/exec/apply?optimizeWithProtocolGroups=true HTTP/1.1
Authorization: Bearer XXXXXX
X-OVK-API-Key: 5a5e0523-b9f9-4111-a879-775e7d871346
X-OVK-Application-Id: tahoma3-android
User-Agent: Dalvik/2.1.0 (Linux; U; Android 14; sdk_gphone64_x86_64 Build/UE1A.230829.036.A1);tahoma
Content-Type: application/json; charset=UTF-8
Content-Length: 134
Host: ha101-1.overkiz.com
Connection: Keep-Alive
Accept-Encoding: gzip

{"label":"apply","actions":[{"deviceURL":"rts:\/\/1227-9296-2XXX\/16746XXX","commands":[{"name":"tiltPositive","parameters":[3,0]}]}]}

The number in this captures is 3 but can be in range of 1 to 5. This is the amount of tilt need to be applied.

The result of both requests is:

HTTP/1.1 200
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 18 Jan 2024 10:05:58 GMT
Server: overkiz

31
{"execId":"1c08dbcb-0a19-0482-5287-3eb946266230"}
0

from openhab-addons.

BasvanH avatar BasvanH commented on June 25, 2024

This is a screenshot of the feature.

The more you move the slider up or down the number increases but nothing happens until you release the slider. Then it sends the number and the slats execute the tilt amount. When the slider is released it returns to the middle.

Slider up = tiltNegative
Slider down = tiltPositive

Screenshot_20240119-113553

from openhab-addons.

octa22 avatar octa22 commented on June 25, 2024

OK, I get the point, how do you want to control it in OH? Two new command channels tilt_positive, tilt_negative - each incresing the specific tilt by the number provided, default 1 and max 5? thanks

from openhab-addons.

BasvanH avatar BasvanH commented on June 25, 2024

Yes, like this, two number channels.

from openhab-addons.

octa22 avatar octa22 commented on June 25, 2024

Here is the latest snapshot based on the OAUTH branch and containg support for your blinds. Please remove the original blinds from OH and let it rediscover new blinds. Up/Down Venetian blinds should appear with a control and a new tilt dimmer channel. The tilt channel expects a number in <-5..5> range and decides whether to send tiltNegative or tiltPositive commands. Please let me know if it is working or not. In case it doesn't work as expected, please, provide me with the debug log. Thanks.
https://www.dropbox.com/scl/fi/iggw634q0dvhb0mx8q0da/org.openhab.binding.somfytahoma-4.2.0-SNAPSHOT.jar?rlkey=sko2uwq0anevl50xln0m8p942&dl=1

from openhab-addons.

BasvanH avatar BasvanH commented on June 25, 2024

Alright, I did the testing.

I have removed a blind and added it again. It is discovered as Somfy Up/Down Venetian Blind and has the Tilt channel.

When creating a Item on the Tilt channel a Dimmer type is suggested. When using this and use the Dimmer widget the OH REST API returns a 400 Bad Request, no matter which command I send, positive, negative number. Always a 400 Bad Request.

I then added a Number type Item and linked it to the tilt channel. I then send commands to this item. The Item gets updated but nothing happens in the binding. Trace/Debug logs show no activity in the Somfy binding. Other commands on the Thing work, just the Tilt doesn't seem to do anything.

I tested this with multiple blinds, same result.

from openhab-addons.

octa22 avatar octa22 commented on June 25, 2024

OK, check this version and provide me with the trace log, if it returns 400 it must send some command, which the cloud does not support.
This version doesn't fix anythig, just adds some debug logs.
Thanks
https://www.dropbox.com/scl/fi/538lpq7i5z8iwt0p2mub7/org.openhab.binding.somfytahoma-4.2.0-SNAPSHOT.jar?rlkey=71bsqm7sseb9b5wyxdde22oua&dl=1

from openhab-addons.

BasvanH avatar BasvanH commented on June 25, 2024

Thanks, cleared the cache and tmp folders and installed this new version. Same result and no log entries during the Dimmer test. It's not making any requests to Somfy and the OH API returns a 400. I checked with tcpdump, there's really no request being made.

POST http://x.x.x.x:8080/rest/items/Somfy_Keuken_Klein_raam_Tilt HTTP/1.1
Host: x.x.x.x:8080
Connection: keep-alive
Content-Length: 2
X-Requested-With: XMLHttpRequest
Authorization: Bearer xxxx
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Content-Type: text/plain
Accept: */*
Origin: http://x.x.x.x:8080
Referer: http://x.x.x.x:8080/settings/things/somfytahoma:updownvenetianblind:a52746421f:rts1227929624791674xxxx/links/Somfy_Keuken_Klein_raam_Tilt/tilt
Accept-Encoding: gzip, deflate
Accept-Language: nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: _pk_id.1.4f3d=1ac8c5d01478f824.1690543726.; X-OPENHAB-SESSIONID=67a357f8-d796-42e8-beae-7f1c1742a44c;

-5

Response

HTTP/1.1 400 Bad Request
Date: Tue, 30 Jan 2024 11:16:56 GMT
Content-Length: 0
Server: Jetty(9.4.52.v20230823)

from openhab-addons.

octa22 avatar octa22 commented on June 25, 2024

Thanks, I thing I fixed it, now it should work :-) The channel was marked as read-only, sorry for your time spent.
https://www.dropbox.com/scl/fi/538lpq7i5z8iwt0p2mub7/org.openhab.binding.somfytahoma-4.2.0-SNAPSHOT.jar?rlkey=71bsqm7sseb9b5wyxdde22oua&dl=1
please let me know if it works...

from openhab-addons.

BasvanH avatar BasvanH commented on June 25, 2024

Sorry, still a 400 from OH API.

I noticed the <state /> element in the channels.xml closes itself, should it perhaps be like <state></state>?
Edit: This should not be a problem, this seems supported.

Is a negative value for Dimmer supported?

https://github.com/octa22/openhab2-addons/blob/71f0a861d2da638915def07f368ca10a42e58ea3/bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/thing/channels.xml#L892

from openhab-addons.

BasvanH avatar BasvanH commented on June 25, 2024

On a side note, I wanted to test some things on the code myself but I when I compile the new binding with maven and deploy it I get this error when OH starts:

2024-02-01 08:30:17.161 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.NoClassDefFoundError: org/openhab/core/config/discovery/AbstractThingHandlerDiscoveryService
        at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:1017) ~[?:?]
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:283) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:716) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:639) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:607) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:587) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:566) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:335) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:397) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:500) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168) ~[org.eclipse.osgi-3.18.0.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
        at org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaBridgeHandler.getServices(SomfyTahomaBridgeHandler.java:476) ~[?:?]
        at org.openhab.core.thing.binding.BaseThingHandlerFactory.registerServices(BaseThingHandlerFactory.java:146) ~[?:?]
        at org.openhab.core.thing.binding.BaseThingHandlerFactory.registerHandler(BaseThingHandlerFactory.java:140) ~[?:?]
        at org.openhab.core.thing.internal.ThingManagerImpl.doRegisterHandler(ThingManagerImpl.java:531) ~[?:?]
        at org.openhab.core.thing.internal.ThingManagerImpl.registerHandler(ThingManagerImpl.java:512) ~[?:?]
        at org.openhab.core.thing.internal.ThingManagerImpl.registerAndInitializeHandler(ThingManagerImpl.java:927) ~[?:?]
        at org.openhab.core.thing.internal.ThingManagerImpl.checkMissingPrerequisites(ThingManagerImpl.java:1124) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: java.lang.ClassNotFoundException: org.openhab.core.config.discovery.AbstractThingHandlerDiscoveryService cannot be found by org.openhab.binding.somfytahoma_4.2.0.202402010726
        at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:541) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:487) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168) ~[org.eclipse.osgi-3.18.0.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
        ... 27 more

When I compile I have an extra file in the jar: /OSGI-INF/org.openhab.binding.somfytahoma.internal.discovery.SomfyTahomaItemDiscoveryService.xml

When I remove this line from internal/discovery/SomfyTahomaItemDiscoveryService.java the extra file in the jar is gone but still got the error like above.

@Component(scope = ServiceScope.PROTOTYPE, service = SomfyTahomaItemDiscoveryService.class)

Any idea whats going on here?

from openhab-addons.

octa22 avatar octa22 commented on June 25, 2024

Yeah the compilation with the 4.1.1 branch is one way (but discovery is not working for the new thing), another one is to replace the SomfyTahomaItemDiscoveryService.java with the attached one and compiling with the -Dohc.version=4.1.1 parameter.
SomfyTahomaItemDiscoveryService.zip

from openhab-addons.

octa22 avatar octa22 commented on June 25, 2024

So I will change it to Number - thank you very much for testing.

from openhab-addons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.