Radioh / ha_twitch_helix

Home Assistant custom component to integrate with Twitch helix api.
MIT License
21 stars 2 forks source link

sensor value "Unknown" #1

Closed JuniorGamingTime closed 2 years ago

JuniorGamingTime commented 2 years ago

So the sensors show up but i just get "Unknown" as a value. How do you have the App setup in dev.Twitch?

This is how my sensor is setup:

Radioh commented 2 years ago

Yo, I just tried to create a new app in the twitch developer console and with the same configuration as you. It seems to be working the way I expect it to.

I set up the twitch app like so:

Oauth redirect url: http://localhost Category: Website Integration

And then clicked the generate client secret button and saved the Twitch app.

It should create an entity with the name: sensor.dashducks after a home assistant reboot

If there is an issue with communicating with the Twitch API during startup of the component, then it should log this to the "home-assistant.log" file: "Error during initial twitch api check. Check config variables".

Does it have a log entry like that in your file?

Maybe you can try to create a new client secret and save your Twitch app and then paste the new secret in to your config and reboot Home assistant.

JuniorGamingTime commented 2 years ago

Not getting any errors in the logs, I can see the sensors they just show up as "Unknown" Does the client_id and client_secret need to be in quotation marks? I also have my Twitch App setup like yours. Also the way i added the component is under the "custom_components" folder (custome_components/twitch_helix), but should be ok because the sensors show up.

The only info in the logs is: We found a custom integration twitch_helix which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

Radioh commented 2 years ago

I don't have my client_secret or client_id in quotation marks. I just tested putting quotation marks but they are accepted either way.

If you get that entry in your log, then it seems like you've set the component up correctly in the folder. I'm thinking right now, that the component doesn't run on your Home Assistant device. If there was a critical error, then something should be in the logs, and sensors would show as "Unavailable", not "Unknown". At least they do on my instance.

How is your configuration set up, do you have a separate sensors.yaml file? Do you have it included like so in your configurations.yaml: sensor: !include sensors.yaml

You can try to insert _LOGGER.error("Initiated Twitch_Helix") as a new line right after def setup_platform(hass, config, add_entities, discovery_info=None): line in the sensor.py file, reboot your Home assistant and see if that will add a entry to your log file. If it doesn't, then the component doesn't run.

JuniorGamingTime commented 2 years ago

My HA is setup in docker. The sensors are separate and included but im using !include_dir_merge_list instead of just !include

JuniorGamingTime commented 2 years ago

this is the error i got image

Radioh commented 2 years ago

Alright, cool. Well, at least we can conclude something is running and not throwing any errors. :) I might do a little code cleanup and poke around some more to see if I can reproduce when I have some spare time in the next couple of days. I'll let you know if I find anything worthwhile.

Bleach3D commented 2 years ago

I cant find it in HACS. What am i doing wrong?

JuniorGamingTime commented 2 years ago

@Bleach3D it's a manual custom component not in HACS.

Radioh commented 2 years ago

@Bleach3D Did you add it as a custom repository in HACS? I added a hacs.json to the repo, so HACS should be able to pick that up now. If you click the 3 dots in the upper right corner, you should be able to add this repository (https://github.com/Radioh/ha_twitch_helix) as a custom integration. Remember to also configure the component in 'configuration.yaml' .

Radioh commented 2 years ago

@JuniorGamingTime - Did you somehow magically get it to work? I looked through the code but kind of concluded that it must be somehow related to your setup for some reason. Maybe if you used the official twitch component and then switched to this there could be some conflicts, since the sensor names should be the same. But at this point, I'm just guessing.

Bleach3D commented 2 years ago

@Radioh I have deinstalled HACS again and just tried to install it manually again and then it somehow worked.

Works great by the way, thank you very much.

JuniorGamingTime commented 2 years ago

I just tried using it with HACS and still getting the same issue.

NicciZar commented 2 years ago

@JuniorGamingTime - Did you somehow magically get it to work? I looked through the code but kind of concluded that it must be somehow related to your setup for some reason. Maybe if you used the official twitch component and then switched to this there could be some conflicts, since the sensor names should be the same. But at this point, I'm just guessing.

I am using both right now. The Streamer (sensor) with the same name just gets a _2 added to the sensor name.

JuniorGamingTime commented 2 years ago

That's what I'm getting too the same name with the _2 but still not working. I've Uninstalled it multiple times with the same outcome.

JuniorGamingTime commented 2 years ago

Seems like the new update fixed whatever issue I was having