Forum Discussion

erinmausfd's avatar
2 years ago

Roku /keypress ECP command returning HTTP status code 401

Hi,

I'm having a weird issue where one of the Roku Ultra devices I have is returning a 401 status code when trying to perform any keypress/keydown/keyup ECP commands. Any other ECP commands I tested, like the device info and apps queries, seem to work just fine. The device is on the same subnet as all other devices where these ECP commands work and the machine that is sending the ECP commands is also on the same subnet.

This is the command:

curl -d '' -w "%{http_code}" '192.168.241.45:8060/keypress/home'

CURL returns a 401 with an empty body. Using "Home" or "home" does not matter. The device is up to date and does not return an error when accessing it via HTTP with developer mode enabled (like it would it it were out of date / could not check for updates).

    • babybird's avatar
      babybird
      Channel Surfer

      I have two 43" TCL Roku TVs that I bought at different times a few years apart. One of them still works with my ECP commands, while the other one doesn't and stopped working a week or two ago. I also have two more 43" TCL Roku TVs in my household that belong to a housemate that I could arrange some testing on as well, if more samples is helpful.

       

      Here is the info from the About screen on each TV to help your engineers isolate the root cause for your customers:

       

      ---

      Not Working TV:

      TCL model: 43S435

      Hardware ID: G109X

      Serial number: available privately if needed

      Software version: 12.5.5 - build 4174-CG

      Device ID: available privately if needed

      IP address: 192.168.187.109

       

      ---

      Working TV:

      TCL model: 43S403

      Hardware ID: 7126X

      Serial number: available privately if needed

      Software version: 12.5.5 - build 4174-30

      Device ID: available privately if needed

      IP address: 192.168.187.71

       

      ---

      Test setup for both samples: Tested from Elgato StreamDeck using two plugins - one called "API Request" and the other called "API Ninja". Both of these plugins were configured to send "http://<IP address>/keypress/PowerOn" and "http://<IP address>/keypress/PowerOff" ECP commands as an HTTP POST request. I also tested using PowerShell from Windows 11 Professional with these commands (results below each command): 

      Invoke-WebRequest -Method Post -Uri "http://192.168.187.109:8060/keypress/PowerOn"

      --> Returned error: Invoke-WebRequest : The remote server returned an error: (401) Unauthorized.

      Invoke-WebRequest -Method Post -Uri "http://192.168.187.109:8060/keypress/PowerOff"

      --> Returned error: Invoke-WebRequest : The remote server returned an error: (401) Unauthorized.

      Invoke-WebRequest -Method Post -Uri "http://192.168.187.71:8060/keypress/PowerOn"

      --> Returned expected response (TV powered on) with StatusCode 200

      Invoke-WebRequest -Method Post -Uri "http://192.168.187.71:8060/keypress/PowerOff"

      --> Returned expected response (TV powered off) with StatusCode 200

       

      The results were the same with all 4 tests from the StreamDecks using both plugins from both computers (a total of 24 tests, 12 per computer, 1 set of 4 tests with each method described from each computer) as the PowerShell results. These results indicate that the TV is receiving the requests but is not responding to them for an unidentified reason and returns a HTTP 401 Unauthorized error. For unrecognized commands, it returns a HTTP 404 Not Found error, as expected. I also tested all of these conditions from two different computers to rule out an issue on one computer - the results were identical from both computers in all test cases.

  • RokuNicole-S's avatar
    RokuNicole-S
    Community Moderator

    I've sent you each messages to collect some info about this issue, please check your DMs. Thank you!

    • tonyli7's avatar
      tonyli7
      Newbie

      Hi. I've been having issues as well. It started on March 27th. Any next steps?

    • cyborg_helpplea's avatar
      cyborg_helpplea
      Binge Watcher
       
      Repro (use your own IP and port number):

          const response = fetch("http://192.168.x.x:port_number/keypress/home", {
              method: "POST"
          }).then(response => {
              console.log("Response code:", response.status);
              if (!response.ok) {
                  throw new Error('Network response was not ok');
                }
               
              console.log("Response code:", response.status);
              return response.text();
          }).then(data => {
              if (data) {
                  return JSON.parse(data);
                } else {
                  console.log('No data to parse');
                }
          }).catch(error => { console.error('Error:', error); }); 
              console.log("Roku Home button pressed");
              return response;
       
      Output:
      Roku Home button pressed
      roku.js:21
      Response code: 401
      roku.js:6
      Error: Error: Network response was not ok
       
       
      I was able to reproduce the same with curl, and it affected all computers in my environment on the same day today.
      • JohnnyIV's avatar
        JohnnyIV
        Channel Surfer

        A simple curl example:

        curl -v -d '' "http://your-ip:8060/keypress/home"

        Output

        *   Trying n.n.n.n:8060...
        * Connected to n.n.n.n (n.n.n.n) port 8060
        > POST /keypress/home HTTP/1.1
        > Host: n.n.n.n:8060
        > User-Agent: curl/8.4.0
        > Accept: */*
        > Content-Length: 2
        > Content-Type: application/x-www-form-urlencoded
        >
        < HTTP/1.1 401 Unauthorized
        < Server: Roku/12.5.5 UPnP/1.0 Roku/12.5.5
        < Content-Length: 0
        <
        * Connection #0 to host n.n.n.n left intact
  • Same problem here.  any post commands respond with 401 unauthorized.  Same experience where it worked just find until March 27th.

    I rely on this functionality and the ability to control via API is essential to me and one of the reasons why i purchased this product.  

    Here are the system details in case it helps

     
    <device-info>
    <udn>redacted</udn>
    <serial-number>redacted</serial-number>
    <device-id>redacted</device-id>
    <advertising-id>redacted</advertising-id>
    <vendor-name>TCL</vendor-name>
    <model-name>65S4</model-name>
    <model-number>7134X</model-number>
    <model-region>US</model-region>
    <is-tv>true</is-tv>
    <is-stick>false</is-stick>
    <screen-size>65</screen-size>
    <panel-id>35</panel-id>
    <mobile-has-live-tv>true</mobile-has-live-tv>
    <ui-resolution>1080p</ui-resolution>
    <tuner-type>ATSC</tuner-type>
    <supports-ethernet>true</supports-ethernet>
    <wifi-mac>redacted</wifi-mac>
    <wifi-driver>realtek</wifi-driver>
    <has-wifi-5G-support>true</has-wifi-5G-support>
    <ethernet-mac>redacted</ethernet-mac>
    <network-type>ethernet</network-type>
    <friendly-device-name>Great Room TV</friendly-device-name>
    <friendly-model-name>TCL•Roku TV</friendly-model-name>
    <default-device-name>TCL•Roku TV - YN00T5984076</default-device-name>
    <user-device-name>Great Room TV</user-device-name>
    <user-device-location>Great Room</user-device-location>
    <build-number>30D.55E04174A</build-number>
    <software-version>12.5.5</software-version>
    <software-build>4174</software-build>
    <lightning-base-build-number>xxD.50E04182A</lightning-base-build-number>
    <ui-build-number>30D.55E04174A</ui-build-number>
    <ui-software-version>12.5.5</ui-software-version>
    <ui-software-build>4174</ui-software-build>
    <secure-device>true</secure-device>
    <language>en</language>
    <country>US</country>
    <locale>en_US</locale>
    <time-zone-auto>false</time-zone-auto>
    <time-zone>US/Eastern</time-zone>
    <time-zone-name>United States/Eastern</time-zone-name>
    <time-zone-tz>America/New_York</time-zone-tz>
    <time-zone-offset>-240</time-zone-offset>
    <clock-format>12-hour</clock-format>
    <uptime>3005</uptime>
    <power-mode>PowerOn</power-mode>
    <supports-suspend>true</supports-suspend>
    <supports-find-remote>false</supports-find-remote>
    <supports-audio-guide>true</supports-audio-guide>
    <supports-rva>true</supports-rva>
    <has-hands-free-voice-remote>false</has-hands-free-voice-remote>
    <developer-enabled>false</developer-enabled>
    <keyed-developer-id/>
    <search-enabled>true</search-enabled>
    <search-channels-enabled>true</search-channels-enabled>
    <voice-search-enabled>true</voice-search-enabled>
    <supports-private-listening>true</supports-private-listening>
    <supports-private-listening-dtv>true</supports-private-listening-dtv>
    <supports-warm-standby>true</supports-warm-standby>
    <headphones-connected>false</headphones-connected>
    <supports-audio-settings>false</supports-audio-settings>
    <expert-pq-enabled>1.0</expert-pq-enabled>
    <supports-ecs-textedit>true</supports-ecs-textedit>
    <supports-ecs-microphone>true</supports-ecs-microphone>
    <supports-wake-on-wlan>true</supports-wake-on-wlan>
    <supports-airplay>true</supports-airplay>
    <has-play-on-roku>true</has-play-on-roku>
    <has-mobile-screensaver>false</has-mobile-screensaver>
    <support-url>support.tcl.com/us</support-url>
    <grandcentral-version>11.1.25</grandcentral-version>
    <supports-trc>true</supports-trc>
    <trc-version>3.0</trc-version>
    <trc-channel-version>9.3.10</trc-channel-version>
    <av-sync-calibration-enabled>3.0</av-sync-calibration-enabled>
    </device-info>
  • It started working again tonight. No firmware update on the TV.

    • JRod85's avatar
      JRod85
      Reel Rookie

      There wasn't a firmware update the TV ad well. No idea why mine started working tonight.

      • fh2's avatar
        fh2
        Newbie

        Also started working for me overnight.

        The API calls get a 200 now instead of 401.

    • babybird's avatar
      babybird
      Channel Surfer

      Mine wasn't working this morning when I tried after reading these most recent reports, but it is working now this afternoon. No firmware updates, no changes in the TV configuration, nothing else changed in my environment, but my TV that wasn't working is now working again somehow. There must be some kind of back channel communication between the Roku devices and Roku's network, otherwise there's no real explanation for what's been happening. My formerly non-working but now working Roku TV is showing 3 days, 20 hours, and 51 minutes of uptime, so it hasn't rebooted or reset or anything between not working and working again.

       

      Grateful it's working again, but that is a very weird and unexpected behavior and I'm not sure how I feel about that.

      • cyborg_helpplea's avatar
        cyborg_helpplea
        Binge Watcher

        Is the difference that I'm using the 4K ultra device and not the TV? So far I'm seeing comments that some TVs are working.

  • JohnnyIV's avatar
    JohnnyIV
    Channel Surfer

    This started happening to me too today. Get commands work like query/apps, but Post commands are returning 401.

    • JohnnyIV's avatar
      JohnnyIV
      Channel Surfer

      I'll add that this has been working perfectly for over 3 years until today.

      • Profezzorn's avatar
        Profezzorn
        Reel Rookie

        I too have this problem. It was working fine for a very long time, and then stopped.

        Other SDK commands like going to a particular channel still work.

        (Roku Ultra)

         

  • This started happening to me a couple of days ago on TCL Roku TV. I reset and it worked again for a day and started happening again yesterday. Hope there is a fix for this. 

  • Just FYI, we have had reports of our customers having a similar issue with their Roku players using our driver that issues ECP commands.

    Our tech support has found that issuing a factory reset of the player seems to fix the issue.

    Something you all could try.

     

    • milehighmatt's avatar
      milehighmatt
      Reel Rookie

      12 different sites that we reset yesterday, yes on Easter, have all now succumbed to this issue. Waste your time if you must, but the reset devices only work ~24 hours from our experience. Thats a lot of typing in passwords for only a day of proper operation. 

      • ryan_erickson's avatar
        ryan_erickson
        Newbie

        Forgot to mention we also recommend disabling automatic updates after factory reset.  Don't know if that is why it's reoccurring...

  • Same issue here. 3x Roku Ultra 4660, only 1 has this issue which we began noticing on 3/31.

    • Rok4MomProject's avatar
      Rok4MomProject
      Channel Surfer

      This broken functionality does not seem to be associated with a software version or update. I think this is a bug. If this is part of roku removing the functionality can someone official please say so. I must figure out a solution for my mom and waiting here with silence from roku is no solution. My next step will be to attempt an infrared transmitter to accomplish the same tasks. If roku feels they must remove this functionality to stop 3rd party applications from taking away eyeballs from their internal method of promotion then maybe they can require the functionality to be enabled in a secret menu so that this one extra step makes the widespread use of a 3rd party app significantly less likely.

      • EvilRoosterC4's avatar
        EvilRoosterC4
        Newbie

        I do control4 I made an ir driver for just navigation and in programming I tell mini apps to swap to my driver instead of roku IP driver for navigation for the time being it’s working fine a little clunky if you press buttons too fast it keeps scrolling for a few seconds but it’ll get people by for now