Directv in 3.3

I am trying to use an Item that used to work in 2.3 like this:

Switch DirecTV_ABC “ABC” [ “Switchable” ] { http=“>[*:GET:http://192.168.1.50:8080/tv/tune?clientAddr=347A60F39712&major=15]” }

But when I try to use it in 3.3 I get an error in the got when I try to toggle the switch using a ‘List Item’ to toggle the element, see error below:

2022-11-05 05:35:38.366 [ERROR] [rg.apache.cxf.jaxrs.utils.JAXRSUtils] - No message body reader has been found for class java.lang.String, ContentType: application/octet-stream
2022-11-05 05:35:38.367 [WARN ] [s.impl.WebApplicationExceptionMapper] - javax.ws.rs.WebApplicationException: HTTP 415 Unsupported Media Type
at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1473)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.processRequestBodyParameter(JAXRSUtils.java:950)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:881)
at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:215)
at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:79)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:74)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:294)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:90)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
at java.base/java.lang.Thread.run(Thread.java:829)

That is a configuration for HTTP binding version 1. The only HTTP binding available in OH3 is the newer Things and channels version, you’ll have to convert your config to that.

I can try again but I created a Thing like the below yesterday and it did the same error when I tried to toggle the Item that referenced the Thing instead:

Thing http:url:ABC “DtvABC” [
baseURL=“http://192.168.1.50:8080/tv/tune?clientAddr=347A60F39712&major=15”,
refresh=0] {
Channels:
Type string : Status “Status” [ stateTransformation=“JSONPATH:$.status.code” ]
}

I could be wrong, but looks like you are creating some sort of favorites list? I have something similar, but a little different approach. Here is my thing. Just queries for a few items for use later:

UID: http:url: YourUID
label: Your Label
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://IPA.DD.RE.SS:8080/tv/getTuned
  delay: 0
  stateMethod: GET
  refresh: 10
  commandMethod: GET
  timeout: 3000
  bufferSize: 2048
channels:
  - id: DirecTV_title
    channelTypeUID: http:string
    label: DirecTV Title
    description: ""
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.title
  - id: DirecTV_callsign
    channelTypeUID: http:string
    label: DirecTV Callsign
    description: ""
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.callsign
  - id: DirecTV_Channel
    channelTypeUID: http:number
    label: DirecTV Channel
    description: ""
    configuration:
      stateTransformation: JSONPATH:$.major

Then I use a rule for each favorite channel. Here is one for Item TV_ABC. It might seem clunky to have a rule for each favorite channel (and there may be a better way, like command extensions on a thing), but I have a about 20, so not that much work.

configuration: {}
triggers:
  - id: "1"
    configuration:
      command: ON
      itemName: TV_ABC
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: sendHttpGetRequest("http://IPA.DD.RE.SS:8080/tv/tune?major=10")
    type: script.ScriptAction
1 Like

There is always many ways to skin a cat, thats not a bad way of doing it either and all your favorites are all in one place too. And yes I am building a favorites and a command list to press play and pause so I can integrate into Google Assistant and just tell her to turn on ESPN, ABC, NBC, NFL Network…

Yep, same concept. I use Siri, but same result.