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

[Supla] SBW-01 not working with cloud #4

Closed
tjach opened this issue Feb 1, 2020 · 5 comments
Closed

[Supla] SBW-01 not working with cloud #4

tjach opened this issue Feb 1, 2020 · 5 comments
Assignees

Comments

@tjach
Copy link

tjach commented Feb 1, 2020

Context

Hardware used:
1 x SBW-01, connected to supla cloud

System state:

  1. Openhab 2.5 installed and working.
  2. Compiled supla binding from source.

Expected Behavior

  1. I am able to choose proper command for gate open/close channel
  2. Garage door open and close controlled from Openhab

Current Behavior

  1. Added Thing Supla Cloud
  2. Manually added SBW-01
  3. Thing was populated with two channels
Open/Close Gate
supla:device:suplaCloud:EE53E9DD-B892-FD9E-4F5D-CF8A5B41FED4:5055
String

Read only ON/OFF switch
supla:device:suplaCloud:EE53E9DD-B892-FD9E-4F5D-CF8A5B41FED4:5056 
  1. Added two items to sitemap
Switch   BramaWjazdowa5056   "Status bramy"   {channel="supla:device:suplaCloud:EE53E9DD-B892-FD9E-4F5D-CF8A5B41FED4:5056"}
String   BramaWjazdowa5055   "5055"   {channel="supla:device:suplaCloud:EE53E9DD-B892-FD9E-4F5D-CF8A5B41FED4:5055"}
  1. Item (read-only) BramaWjazdowa5056 gets populated properly.
  2. Item 5055 is displayed as a down-arrow on sitemap, but after clicking it - no modal is shown, no options are shown.
  3. When added item 5055 to sitemap as:
Switch item=BramaWjazdowa5055 label="[%s]" mappings=[ON="OTWARTE",OFF="ZAMKNIĘTE"]

and clicking either button, stacktrace in logs appears:

18:08:08.515 [TRACE] [nal.cloud.api.SwaggerChannelsCloudApi] - Log for request: [14/1386]
--> PATCH https://svr28.supla.org/api/v2.3.0/channels/5056 HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 20
Authorization: Bearer ...
Accept: application/json
User-Agent: magx2/jSuplaApi

{"action":"TURN_ON"}
--> END PATCH (20-byte body)
<-- HTTP/1.1 400 Bad Request (143ms)
Date: Sat, 01 Feb 2020 17:08:08 GMT
Server: Apache/2.4.25 (Debian)
Vary: Authorization
Cache-Control: no-cache, private
Content-Length: 102
Connection: close
Content-Type: application/json
OkHttp-Sent-Millis: 1580576888470
OkHttp-Received-Millis: 1580576888514

{"status":400,"message":"Cannot execute the requested action TURN_ON on function OPENINGSENSOR_GATE."}
<-- END HTTP (102-byte body)

18:08:08.515 [ERROR] [g.supla.handler.AbstractDeviceHandler] - Error occurred while handling command ON (OnOffType) on channel supla:device:suplaCloud:EE53E9DD-B892-FD9E-4F5D-CF8A5B41FED4:5056$
pl.grzeslowski.jsupla.api.generated.ApiException: Bad Request
at pl.grzeslowski.jsupla.api.generated.ApiClient.handleResponse(ApiClient.java:947) ~[swagger-java-client-fat-2.0.4.jar:?]
at pl.grzeslowski.jsupla.api.generated.ApiClient.execute(ApiClient.java:863) ~[swagger-java-client-fat-2.0.4.jar:?]
at pl.grzeslowski.jsupla.api.generated.ApiClient.execute(ApiClient.java:846) ~[swagger-java-client-fat-2.0.4.jar:?]
at pl.grzeslowski.jsupla.api.generated.api.ChannelsApi.executeActionWithHttpInfo(ChannelsApi.java:145) ~[swagger-java-client-fat-2.0.4.jar:?]
at pl.grzeslowski.jsupla.api.generated.api.ChannelsApi.executeAction(ChannelsApi.java:132) ~[swagger-java-client-fat-2.0.4.jar:?]
at org.openhab.binding.supla.internal.cloud.api.SwaggerChannelsCloudApi.executeAction(SwaggerChannelsCloudApi.java:20) ~[bundleFile:?]
at org.openhab.binding.supla.internal.cloud.api.GuavaChannelsCloudApi.executeAction(GuavaChannelsCloudApi.java:35) ~[bundleFile:?]
at org.openhab.binding.supla.handler.CloudDeviceHandler.handleOneZeroCommand(CloudDeviceHandler.java:339) ~[bundleFile:?]
at org.openhab.binding.supla.handler.CloudDeviceHandler.handleOnOffCommand(CloudDeviceHandler.java:248) ~[bundleFile:?]
at org.openhab.binding.supla.handler.AbstractDeviceHandler.handleCommand(AbstractDeviceHandler.java:50) [bundleFile:?]
at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
at com.sun.proxy.$Proxy1054.handleCommand(Unknown Source) [?:?]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:74) [bundleFile:?]
at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [bundleFile:?]
at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_232]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

@tjach
Copy link
Author

tjach commented Feb 1, 2020

Update:
Control works in PaperUI, does not work in Basic UI. Investigating.

@magx2 magx2 self-assigned this Feb 5, 2020
@magx2
Copy link

magx2 commented Feb 5, 2020

This plugin was only tested with PaperUI so I don't know if it will work in BasicUI.

As you can see here channel type for gate is String with only one option open-close. Try coding this in your BasicUI.

<channel-type id="toggle-gate-channel">
	<item-type>String</item-type>
	<label>Open/Close Gate</label>
	<command>
		<options>
			<option value="open-close">Open/Close</option>
		</options>
	</command>
</channel-type>

@tjach
Copy link
Author

tjach commented Feb 6, 2020

Thank you for the hint. I was able to make a workaround.
Things file:

Thing exec:command:openGate [command="/usr/local/bin/openGate"]

openGate script:

openhab@openhab:/usr/local/bin$ cat openGate
#!/bin/bash
curl --header "Authorization: Bearer <auth header>" --data "{\"action\":\"OPEN_CLOSE\"}" -X PATCH https://svrXX.supla.org/api/v2.3.0/channels/<id>

Items file:

Switch  BramaWjazdowaPilot "Pilot bramy wjazdowej" (OU_Driveway) {channel="exec:command:openGate:run", autoupdate="false"}  

Then sitemap:

            Switch item=BramaWjazdowaPilot mappings=[ON="CLICK"]

Looks like this:
obraz

The channel is a simple command

@magx2
Copy link

magx2 commented Feb 6, 2020 via email

@tjach tjach closed this as completed Feb 6, 2020
@tjach
Copy link
Author

tjach commented Feb 6, 2020

Sure, thank you.

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