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

Hubitat custom integration not handling Roku variables correctly #288

Closed
rpiasentin opened this issue Sep 4, 2024 · 4 comments
Closed

Comments

@rpiasentin
Copy link

I think I detected a bug in the way Roku commands are being passed through the Habitat integration. Please take a look at the advance. Deb logging. I pulled from Home Assistant. There appears to be a variable tight mismatch related to power and I suspect this is causing my Roku to come on in the middle of the night when they’re being polled :

WSource: custom_components/hubitat/hub.py:484
integration: Hubitat (documentation, issues)
First occurred: September 3, 2024 at 8:15:53 PM (14 occurrences)
Last logged: 11:53:31 AM

Error handling event : Sensor sensor.roku_spare_12f536_power has device class 'power', state class 'measurement' unit 'W' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'PowerOn' (<class 'str'>)
Error handling event : Sensor sensor.roku_spare_12f536_power has device class 'power', state class 'measurement' unit 'W' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'PowerOn' (<class 'str'>)
Error handling event <Event device_id="15" device_name="Roku master (F2E2BC)" attribute="supportedInputs" value="["Home","Prime Video","Apple TV","Hulu","Disney Plus","Max","Paramount

Describe the bug

To Reproduce

Screenshots

Environment

  • Home Assistant version:
  • Integration version:
@jason0x43
Copy link
Owner

Could you get the capabilities for your Roku device?

@rpiasentin
Copy link
Author

rpiasentin commented Sep 5, 2024

here is what I can find:

{
 "name": "Roku spare (12F536)",
    "label": "Roku spare (12F536)",
    "type": "Roku TV",
    "id": "31",
    "date": "2024-09-05T08:52:07+0000",
    "model": null,
    "manufacturer": null,
    "room": null,
    "capabilities": [
      "Configuration",
      "Refresh",
      "TV",
      "Polling",
      "AudioVolume",
      "MediaTransport",
      "Initialize",
      "Switch",
      "MediaInputSource"
    ],
    "attributes": {
      "movieMode": null,
      "dataType": "ENUM",
      "values": [
        "unmuted",
        "muted"
      ],
      "switch": "on",
      "transportStatus": "stopped",
      "application": "Roku Dynamic Menu",
      "power": "PowerOn",
      "supportedInputs": "[\"Home\",\"Prime Video\",\"Hulu\",\"Sling TV - Live Sports, News, Shows + Freestream\",\"The Roku Channel\",\"Vudu\",\"ESPN\",\"Roku Media Player\",\"YouTube\",\"Roku Tips & Tricks\",\"Plex - Free Movies & TV\",\"Roku | Getting Started\",\"Disney Plus\",\"Wondrium\",\"Crackle\",\"discovery+ | Stream TV Shows\",\"HBO Max\",\"Apple TV\",\"Freevee\",\"Xumo Play\",\"Netflix\",\"The CW\",\"Paramount Plus\",\"Live TV on The Roku Channel\",\"Kids & Family on The Roku Channel\"]",
      "channel": null,
      "mediaInputSource": "Roku Dynamic Menu",
      "volume": null,
      "picture": null,
      "sound": null,
      "mute": null
    },
    "commands": [
      {
        "command": "channelDown"
      },
      {
        "command": "channelUp"
      },
      {
        "command": "configure"
      },
      {
        "command": "home"
      },
      {
        "command": "initialize"
      },
      {
        "command": "keyPress"
      },
      {
        "command": "mute"
      },
      {
        "command": "off"
      },
      {
        "command": "on"
      },
      {
        "command": "pause"
      },
      {
        "command": "play"
      },
      {
        "command": "poll"
      },
      {
        "command": "queryActiveApp"
      },
      {
        "command": "queryDeviceInfo"
      },
      {
        "command": "queryInstalledApps"
      },
      {
        "command": "queryMediaPlayer"
      },
      {
        "command": "quiter"
      },
      {
        "command": "refresh"
      },
      {
        "command": "reloadApps"
      },
      {
        "command": "search"
      },
      {
        "command": "setChannel"
      },
      {
        "command": "setInputSource"
      },
      {
        "command": "setVolume"
      },
      {
        "command": "stop"
      },
      {
        "command": "unmute"
      },
      {
        "command": "volumeDown"
      },
      {
        "command": "volumeDown10"
      },
      {
        "command": "volumeUp"
      },
      {
        "command": "volumeUp10"
      }
    ]
  }

@jason0x43
Copy link
Owner

As far as the error goes, the issue is that the Roku driver and the integration don't agree on what a power attribute should represent. The integration assumes drivers are following Hubitat's device capabilities spec, and in the spec a power attribute is a power measurement. The Roku driver, on the other hand, is using that attribute to report a general power state.

I suspect this is causing my Roku to come on in the middle of the night when they’re being polled.

The integration doesn't poll devices device. However, if you have an automation that's polling the device and trying to make decisions from the power attribute, I can see how you might be running into trouble. Ideally I'd say automations should look at the switch attribute to tell if the device is on or off, but I'm not sure what that driver is using the switch attribute for, so that might not work.

In any case, I'm going to update the integration to consider the device's stated capabilities as well as its attributes when adding power sensors. That should resolve this, although you may need to remove the Roku from the Maker API and re-add it if simply updating the integration doesn't do the trick.

@jason0x43
Copy link
Owner

Closing this as resolved (v0.9.35)

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