mad-ady / home-assistant-customizations

Various customizations for home-assistant
29 stars 15 forks source link

Error fetching data and Fetch Rest #2

Closed tamet83 closed 4 years ago

tamet83 commented 5 years ago

Hi,

i tried to use your custom_component because I have a similar situation as yours with tautulli monitor sensor. What i need is to extract the attribute values for each user. The structure is this one:

Top Movie: null Top TV Show: null Top User: null stream_count: 1 total_bandwidth: 5834 stream_count_transcode: 0 wan_bandwidth: 0 stream_count_direct_play: 0 lan_bandwidth: 5834 stream_count_direct_stream: 1 tamet: { "Activity": "playing", "title": "Venom", "transcode_decision": "copy", "bandwidth": "5834" } Corrado: { "Activity": null, "title": "", "transcode_decision": "", "bandwidth": "" } Samsung TV: { "Activity": null, "title": "", "transcode_decision": "", "bandwidth": "" } friendly_name: Tautulli icon: mdi:plex

what i'd like to extrat, for each user, are the following attributes: Ativity Title transcode_decision bandwith

but i don't know why i receive the following erros: ERROR (SyncWorker_3) [custom_components.sensor.jsonrest] Error fetching data: <PreparedRequest [GET]>

and

ERROR (SyncWorker_3) [custom_components.sensor.jsonrest] Unable to fetch REST data

Could you please help me? Thanks in advance

mad-ady commented 5 years ago

The errors signify that the module couldn't get the data. Can you try with curl or wget to test your URL and see if it replies with a json header (and the data you want)?

By the way, the module should no longer be needed. The current official rest component can extract some parameters if you specify them:

On Sat, Feb 2, 2019 at 1:56 AM tamet83 notifications@github.com wrote:

Hi,

i tried to use your custom_component because I have a similar situation as yours with tautulli monitor sensor. What i need is to extract the attribute values for each user. The structure is this one:

Top Movie: null Top TV Show: null Top User: null stream_count: 1 total_bandwidth: 5834 stream_count_transcode: 0 wan_bandwidth: 0 stream_count_direct_play: 0 lan_bandwidth: 5834 stream_count_direct_stream: 1 tamet: { "Activity": "playing", "title": "Venom", "transcode_decision": "copy", "bandwidth": "5834" } Corrado: { "Activity": null, "title": "", "transcode_decision": "", "bandwidth": "" } Samsung TV: { "Activity": null, "title": "", "transcode_decision": "", "bandwidth": "" } friendly_name: Tautulli icon: mdi:plex

what i'd like to extrat are the following attributes: Ativity Title transcode_decision bandwith

but i don't know why i receive the following erros: ERROR (SyncWorker_3) [custom_components.sensor.jsonrest] Error fetching data: <PreparedRequest [GET]>

and

ERROR (SyncWorker_3) [custom_components.sensor.jsonrest] Unable to fetch REST data

Could you please help me? Thanks in advance

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mad-ady/home-assistant-customizations/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AEDvKkxTbGqK23ql4LxxatUoCj3oqr-lks5vJNQlgaJpZM4afR75 .

tamet83 commented 5 years ago

Hi because the url is on https i had to type the following command on curl:

curl --insecure -X GET https://my.internal.ip:8123/api/states/sensor.t autulli?api_password=My_Api_Password

The response is as follow:

{"attributes": {"Corrado": {"Activity": null, "bandwidth": "", "title": "", "tra nscode_decision": ""}, "Samsung TV": {"Activity": null, "bandwidth": "", "title" : "", "transcode_decision": ""}, "Top Movie": null, "Top TV Show": null, "Top Us er": null, "friendly_name": "Tautulli", "icon": "mdi:plex", "lan_bandwidth": 0, "stream_count": "0", "stream_count_direct_play": 0, "stream_count_direct_stream" : 0, "stream_count_transcode": 0, "tamet": {"Activity": null, "bandwidth": "", " title": "", "transcode_decision": ""}, "total_bandwidth": 0, "wan_bandwidth": 0} , "context": {"id": "71bf53b46f6447bbb320d61ddbd36940", "user_id": null}, "entit y_id": "sensor.tautulli", "last_changed": "2019-02-03T13:17:44.296877+00:00", "l

I don't understand why the rest platform doesn't work. Does it depend on the fact that i'm using an HTTPS url?

Just to give you more information, the code is the following:

mad-ady commented 5 years ago

There's a verify_ssl option in the rest sensor you can set to false. https://www.home-assistant.io/components/sensor.rest/

On Sun, Feb 3, 2019, 15:33 tamet83 <notifications@github.com wrote:

Hi because the url is on https i had to type the following command on curl:

curl --insecure -X GET https://my.internal.ip:8123/api/states/sensor.t autulli?api_password=My_Api_Password

The response is as follow:

{"attributes": {"Corrado": {"Activity": null, "bandwidth": "", "title": "", "tra nscode_decision": ""}, "Samsung TV": {"Activity": null, "bandwidth": "", "title" : "", "transcode_decision": ""}, "Top Movie": null, "Top TV Show": null, "Top Us er": null, "friendly_name": "Tautulli", "icon": "mdi:plex", "lan_bandwidth": 0, "stream_count": "0", "stream_count_direct_play": 0, "stream_count_direct_stream" : 0, "stream_count_transcode": 0, "tamet": {"Activity": null, "bandwidth": "", " title": "", "transcode_decision": ""}, "total_bandwidth": 0, "wan_bandwidth": 0} , "context": {"id": "71bf53b46f6447bbb320d61ddbd36940", "user_id": null}, "entit y_id": "sensor.tautulli", "last_changed": "2019-02-03T13:17:44.296877+00:00", "l `

I don't understand why the rest platform doesn't work. Does it depends on the fact that i'm using an HTTPS url?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mad-ady/home-assistant-customizations/issues/2#issuecomment-460052102, or mute the thread https://github.com/notifications/unsubscribe-auth/AEDvKuUE1cHWHWlEAaCWjFQn6kLxUw-nks5vJuUjgaJpZM4afR75 .

mad-ady commented 4 years ago

Closed for inactivity