plex und fhem

Begonnen von justme1968, 27 Oktober 2015, 01:11:32

Vorheriges Thema - Nächstes Thema

TottiToad

@justmer1968

Freut mich zu lesen das es hier weiter geht !

Danke

Grüße
Torsten

meddie

#346
Hallo zusammen, ist es möglich irgendwie eine Wiedergabe eines Songs oder Mehrere Songs eines bestimmten Interpreten oder eine bestimmte Wiedergabeliste auf dem Plex zu starten und diese auf einem Chromecast zu wiedergeben? Ich meine vom FHEM aus, über die Plex App geht es ja einwandfrei.

Vielen Dank im Voraus
VG Eddie

geforce28

Hallo zusammen,

versuche gerade meinen Plex Server mit Fhem zu verbinden...
Im log kommt immer die Meldung:
2018.02.12 21:35:06 2: Plex.SK: http request (http://x.x.x.x:32400/servers) failed: connect to http://x.x.x.x:32400 timed out
2018.02.12 21:35:06 3: Plex.SK: server disappeared: x.x.x.x


Wenn ich http://x.x.x.x:32400/servers eingebe kommt direkt die Meldung:
401 Unauthorized

Was läuft da falsch ?

Per http://x.x.x.x:32400/web im Browser funktioniert alles wunderbar!

justme1968

@meddie: bestimmt. aber ich weiss nicht wie :) leider gibt es wie für alles keine api dokumentation. wenn du per wireshark rausfindest wie das funktioniert kann ich versuchen es einzubauen.

@geforce28: hast du deinen server auf https only gestellt? das modul verwendet zur zeit meist noch http.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

geforce28

Sichere Verbindungen steht auf "bevorzugt"...
Mögliche weitere Optionen sind: "deaktiviert" und "erforderlich"...

Liegt es daran ?

justme1968

das ist ok.

stimmt die ip im log? die seite lässt sich nicht im browser aufrufen. hast du user und password hinterlegt? hast du dich per pin angemeldet?
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

geforce28

user + Passwort habe ich hinterlegt.
Die IP ist korrekt.

Wenn ich per Webinterface auf x.x.x.x/32400/web gehe, dann muss ich mich per pin anmelden.
Die Pin habe ich in FHEM nirgends hinterlegt, muss ich da noch Einstellungen vornehmen ? wo ?

justme1968

was im web interface passiert ist ziemlich egal.

du musst das fhem modul per pin anmelden.

get <name> pin und dann https://plex.tv/pin
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

geforce28

#353
@justme1968:
Okay habe ich gemacht. Danke für die Info, konnte diese nirgends finden...

Nun habe ich ein token bekommen, jedoch schein es immer noch nicht zu laufen.

Im Log steht:
2018.02.13 16:22:47 2: Plex.SK: PIN: XXXX
2018.02.13 16:23:30 3: Plex.SK: got token from pin
2018.02.13 16:23:38 1: PERL WARNING: Use of uninitialized value $ip in concatenation (.) or string at ./FHEM/37_plex.pm line 1573.
2018.02.13 16:23:44 1: PERL WARNING: Use of uninitialized value in sprintf at ./FHEM/37_plex.pm line 1173.


Edit:
Wenn ich FHEM Neustarte kommt jetzt die Meldung:
2018.02.13 16:35:20 2: Plex.SK: http request (http://x.x.x.x:32400/clients) failed: connect to http://x.x.x.x:32400 timed out
2018.02.13 16:35:20 3: Plex.SK: server disappeared: x.x.x.x


Edit2:
So jetzt hat er sich doch scheinbar irgendwie gefangen und ist verbunden. Soweit so gut.
Nun möchte ich aber Plex Clients per FHEM steuern.

Wenn ich nun "get plex clients" eingebe kommt auch die liste meiner Clients, allerdings nur alle eingetragen unter:
clients from myPlex:

Wieso findet er die Clients nicht ?
Habe testweise mal einen Player neu gestartet und etwas angespielt, da ja irgendwo stand, dass die Clients meist erst gefunden werden, wenn sie etwas abspielen.
Tut sich aber nichts.. Kann ich irgendwo einen Parameter setzen, dass er den Client manuell hinzufügt, anhand der IP o.ä ?

justme1968

gibt es log nachrichten wenn du die clients startest? am besten das plex modul vorher auf verbose 4 oder 5 stellen.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

geforce28

#355
Nein, keine Log Einträge, wenn der Client startet.

Nur wenn ich anfange etwas abzuspielen dann kommt folgendes...:
2018.02.13 17:24:46 2: Plex.SK: http request (http://x.x.x.x:32400Wohnzimmer) failed: http://x.x.x.x:32400Wohnzimmer: malformed or unsupported URL
2018.02.13 17:25:37 2: Plex.SK: http request (http://x.x.x.x:32400yjanr6g8i7oxkouewsgn45cd) failed: http://x.x.x.x:32400yjanr6g8i7oxkouewsgn45cd: malformed or unsupported URL
2018.02.13 17:34:27 1: PERL WARNING: Argument "5"" isn't numeric in addition (+) at ./FHEM/31_HUEDevice.pm line 593.
2018.02.13 17:49:39 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at ./FHEM/37_plex.pm line 4084.
2018.02.13 18:45:55 5: Plex.SK: websocket data: $VAR1 = {
          'NotificationContainer' => {
                                       'type' => 'transcodeSession.start',
                                       'size' => 1,
                                       'TranscodeSession' => [
                                                               {
                                                                 'transcodeHwRequested' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
                                                                 'sourceVideoCodec' => 'h264',
                                                                 'duration' => 9698987,
                                                                 'audioDecision' => 'transcode',
                                                                 'audioCodec' => 'opus',
                                                                 'sourceAudioCodec' => 'dca',
                                                                 'key' => '/transcode/sessions/lg9xtfxraf355jg7jikvs4ic',
                                                                 'videoCodec' => 'h264',
                                                                 'progress' => '0',
                                                                 'speed' => '0',
                                                                 'complete' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'transcodeHwRequested'},
                                                                 'videoDecision' => 'transcode',
                                                                 'context' => 'streaming',
                                                                 'container' => 'mkv',
                                                                 'protocol' => 'http',
                                                                 'throttled' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'transcodeHwRequested'},
                                                                 'audioChannels' => 6,
                                                                 'subtitleDecision' => 'copy'
                                                               }
                                                             ]
                                     }
        };

2018.02.13 18:45:55 4: Plex.SK: unhandled websocket text type: transcodeSession.start: {"NotificationContainer":{"type":"transcodeSession.start","size":1,"TranscodeSession":[{"key":"/transcode/sessions/lg9xtfxraf355jg7jikvs4ic","throttled":false,"complete":false,"progress":0.0,"speed":0.0,"duration":9698987,"context":"streaming","sourceVideoCodec":"h264","sourceAudioCodec":"dca","videoDecision":"transcode","audioDecision":"transcode","subtitleDecision":"copy","protocol":"http","container":"mkv","videoCodec":"h264","audioCodec":"opus","audioChannels":6,"transcodeHwRequested":false}]}}
2018.02.13 18:46:00 5: Plex.SK: websocket data: $VAR1 = {
          'NotificationContainer' => {
                                       'TranscodeSession' => [
                                                               {
                                                                 'complete' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
                                                                 'videoDecision' => 'transcode',
                                                                 'context' => 'streaming',
                                                                 'container' => 'mkv',
                                                                 'videoCodec' => 'h264',
                                                                 'progress' => '9.19999980926514',
                                                                 'speed' => '2.5',
                                                                 'audioChannels' => 6,
                                                                 'subtitleDecision' => 'copy',
                                                                 'protocol' => 'http',
                                                                 'throttled' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'complete'},
                                                                 'audioDecision' => 'transcode',
                                                                 'audioCodec' => 'opus',
                                                                 'sourceAudioCodec' => 'dca',
                                                                 'transcodeHwRequested' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'complete'},
                                                                 'sourceVideoCodec' => 'h264',
                                                                 'duration' => 9698987,
                                                                 'key' => '/transcode/sessions/lg9xtfxraf355jg7jikvs4ic',
                                                                 'remaining' => 3551
                                                               }
                                                             ],
                                       'type' => 'transcodeSession.update',
                                       'size' => 1
                                     }
        };

2018.02.13 18:46:00 4: Plex.SK: unhandled websocket text type: transcodeSession.update: {"NotificationContainer":{"type":"transcodeSession.update","size":1,"TranscodeSession":[{"key":"/transcode/sessions/lg9xtfxraf355jg7jikvs4ic","throttled":false,"complete":false,"progress":9.199999809265137,"speed":2.5,"duration":9698987,"remaining":3551,"context":"streaming","sourceVideoCodec":"h264","sourceAudioCodec":"dca","videoDecision":"transcode","audioDecision":"transcode","subtitleDecision":"copy","protocol":"http","container":"mkv","videoCodec":"h264","audioCodec":"opus","audioChannels":6,"transcodeHwRequested":false}]}}
2018.02.13 18:46:02 5: Plex.SK: websocket data: $VAR1 = {
          'NotificationContainer' => {
                                       'PlaySessionStateNotification' => [
                                                                           {
                                                                             'guid' => '',
                                                                             'viewOffset' => 882089,
                                                                             'transcodeSession' => 'lg9xtfxraf355jg7jikvs4ic',
                                                                             'key' => '/library/metadata/59691',
                                                                             'playQueueItemID' => 56371,
                                                                             'ratingKey' => '59691',
                                                                             'sessionKey' => '27',
                                                                             'state' => 'buffering',
                                                                             'url' => ''
                                                                           }
                                                                         ],
                                       'size' => 1,
                                       'type' => 'playing'
                                     }
        };

2018.02.13 18:46:02 4: Plex.SK: unhandled websocket text type: playing: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"27","guid":"","ratingKey":"59691","url":"","key":"/library/metadata/59691","viewOffset":882089,"playQueueItemID":56371,"state":"buffering","transcodeSession":"lg9xtfxraf355jg7jikvs4ic"}]}}
2018.02.13 18:46:05 5: Plex.SK: websocket data: $VAR1 = {
          'NotificationContainer' => {
                                       'size' => 1,
                                       'type' => 'transcodeSession.update',
                                       'TranscodeSession' => [
                                                               {
                                                                 'protocol' => 'http',
                                                                 'throttled' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
                                                                 'audioChannels' => 6,
                                                                 'subtitleDecision' => 'copy',
                                                                 'videoCodec' => 'h264',
                                                                 'timeStamp' => '1518543076.93536',
                                                                 'progress' => '9.30000019073486',
                                                                 'speed' => '1.79999995231628',
                                                                 'complete' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'throttled'},
                                                                 'videoDecision' => 'transcode',
                                                                 'context' => 'streaming',
                                                                 'container' => 'mkv',
                                                                 'remaining' => 4752,
                                                                 'key' => '/transcode/sessions/lg9xtfxraf355jg7jikvs4ic',
                                                                 'minOffsetAvailable' => '1',
                                                                 'transcodeHwRequested' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'throttled'},
                                                                 'duration' => 9698987,
                                                                 'sourceVideoCodec' => 'h264',
                                                                 'maxOffsetAvailable' => '884.76',
                                                                 'audioDecision' => 'transcode',
                                                                 'audioCodec' => 'opus',
                                                                 'sourceAudioCodec' => 'dca'
                                                               }
                                                             ]
                                     }
        };

2018.02.13 18:46:05 4: Plex.SK: unhandled websocket text type: transcodeSession.update: {"NotificationContainer":{"type":"transcodeSession.update","size":1,"TranscodeSession":[{"key":"/transcode/sessions/lg9xtfxraf355jg7jikvs4ic","throttled":false,"complete":false,"progress":9.300000190734864,"speed":1.7999999523162842,"duration":9698987,"remaining":4752,"context":"streaming","sourceVideoCodec":"h264","sourceAudioCodec":"dca","videoDecision":"transcode","audioDecision":"transcode","subtitleDecision":"copy","protocol":"http","container":"mkv","videoCodec":"h264","audioCodec":"opus","audioChannels":6,"transcodeHwRequested":false,"timeStamp":1518543076.9353567,"maxOffsetAvailable":884.76,"minOffsetAvailable":1.0}]}}
2018.02.13 18:46:06 5: Plex.SK: websocket data: $VAR1 = {
          'NotificationContainer' => {
                                       'type' => 'playing',
                                       'size' => 1,
                                       'PlaySessionStateNotification' => [
                                                                           {
                                                                             'state' => 'playing',
                                                                             'url' => '',
                                                                             'sessionKey' => '27',
                                                                             'ratingKey' => '59691',
                                                                             'playQueueItemID' => 56371,
                                                                             'key' => '/library/metadata/59691',
                                                                             'guid' => '',
                                                                             'viewOffset' => 882132,
                                                                             'transcodeSession' => 'lg9xtfxraf355jg7jikvs4ic'
                                                                           }
                                                                         ]
                                     }
        };

2018.02.13 18:46:06 4: Plex.SK: unhandled websocket text type: playing: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"27","guid":"","ratingKey":"59691","url":"","key":"/library/metadata/59691","viewOffset":882132,"playQueueItemID":56371,"state":"playing","transcodeSession":"lg9xtfxraf355jg7jikvs4ic"}]}}
2018.02.13 18:46:10 5: Plex.SK: websocket data: $VAR1 = {
          'NotificationContainer' => {
                                       'type' => 'transcodeSession.update',
                                       'size' => 1,
                                       'TranscodeSession' => [
                                                               {
                                                                 'key' => '/transcode/sessions/lg9xtfxraf355jg7jikvs4ic',
                                                                 'minOffsetAvailable' => '1',
                                                                 'remaining' => 3506,
                                                                 'audioDecision' => 'transcode',
                                                                 'maxOffsetAvailable' => '904.822',
                                                                 'sourceAudioCodec' => 'dca',
                                                                 'audioCodec' => 'opus',
                                                                 'transcodeHwRequested' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
                                                                 'sourceVideoCodec' => 'h264',
                                                                 'duration' => 9698987,
                                                                 'audioChannels' => 6,
                                                                 'subtitleDecision' => 'copy',
                                                                 'protocol' => 'http',
                                                                 'throttled' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'transcodeHwRequested'},
                                                                 'context' => 'streaming',
                                                                 'videoDecision' => 'transcode',
                                                                 'complete' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'transcodeHwRequested'},
                                                                 'container' => 'mkv',
                                                                 'videoCodec' => 'h264',
                                                                 'timeStamp' => '1518543076.93536',
                                                                 'speed' => '2.5',
                                                                 'progress' => '9.39999961853027'
                                                               }
                                                             ]
                                     }
        };

2018.02.13 18:46:10 4: Plex.SK: unhandled websocket text type: transcodeSession.update: {"NotificationContainer":{"type":"transcodeSession.update","size":1,"TranscodeSession":[{"key":"/transcode/sessions/lg9xtfxraf355jg7jikvs4ic","throttled":false,"complete":false,"progress":9.399999618530274,"speed":2.5,"duration":9698987,"remaining":3506,"context":"streaming","sourceVideoCodec":"h264","sourceAudioCodec":"dca","videoDecision":"transcode","audioDecision":"transcode","subtitleDecision":"copy","protocol":"http","container":"mkv","videoCodec":"h264","audioCodec":"opus","audioChannels":6,"transcodeHwRequested":false,"timeStamp":1518543076.9353567,"maxOffsetAvailable":904.822,"minOffsetAvailable":1.0}]}}
2018.02.13 18:46:12 5: Plex.SK: websocket data: $VAR1 = {
          'NotificationContainer' => {
                                       'PlaySessionStateNotification' => [
                                                                           {
                                                                             'viewOffset' => 887429,
                                                                             'transcodeSession' => 'lg9xtfxraf355jg7jikvs4ic',
                                                                             'guid' => '',
                                                                             'key' => '/library/metadata/59691',
                                                                             'playQueueItemID' => 56371,
                                                                             'ratingKey' => '59691',
                                                                             'sessionKey' => '27',
                                                                             'state' => 'playing',
                                                                             'url' => ''
                                                                           }
                                                                         ],
                                       'type' => 'playing',
                                       'size' => 1
                                     }
        };

2018.02.13 18:46:12 4: Plex.SK: unhandled websocket text type: playing: {"NotificationContainer":{"type":"playing","size":1,"PlaySessionStateNotification":[{"sessionKey":"27","guid":"","ratingKey":"59691","url":"","key":"/library/metadata/59691","viewOffset":887429,"playQueueItemID":56371,"state":"playing","transcodeSession":"lg9xtfxraf355jg7jikvs4ic"}]}}
2018.02.13 18:46:15 5: Plex.SK: websocket data: $VAR1 = {
          'NotificationContainer' => {
                                       'type' => 'transcodeSession.update',
                                       'size' => 1,
                                       'TranscodeSession' => [
                                                               {
                                                                 'videoCodec' => 'h264',
                                                                 'timeStamp' => '1518543076.93536',
                                                                 'speed' => '2.20000004768372',
                                                                 'progress' => '9.60000038146973',
                                                                 'videoDecision' => 'transcode',
                                                                 'context' => 'streaming',
                                                                 'complete' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
                                                                 'container' => 'mkv',
                                                                 'protocol' => 'http',
                                                                 'throttled' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'complete'},
                                                                 'audioChannels' => 6,
                                                                 'subtitleDecision' => 'copy',
                                                                 'transcodeHwRequested' => $VAR1->{'NotificationContainer'}{'TranscodeSession'}[0]{'complete'},
                                                                 'sourceVideoCodec' => 'h264',
                                                                 'duration' => 9698987,
                                                                 'audioDecision' => 'transcode',
                                                                 'maxOffsetAvailable' => '915.249',
                                                                 'sourceAudioCodec' => 'dca',
                                                                 'audioCodec' => 'opus',
                                                                 'remaining' => 3910,
                                                                 'key' => '/transcode/sessions/lg9xtfxraf355jg7jikvs4ic',
                                                                 'minOffsetAvailable' => '1'
                                                               }
                                                             ]
                                     }
        };

2018.02.13 18:46:15 4: Plex.SK: unhandled websocket text type: transcodeSession.update: {"NotificationContainer":{"type":"transcodeSession.update","size":1,"TranscodeSession":[{"key":"/transcode/sessions/lg9xtfxraf355jg7jikvs4ic","throttled":false,"complete":false,"progress":9.600000381469727,"speed":2.200000047683716,"duration":9698987,"remaining":3910,"context":"streaming","sourceVideoCodec":"h264","sourceAudioCodec":"dca","videoDecision":"transcode","audioDecision":"transcode","subtitleDecision":"copy","protocol":"http","container":"mkv","videoCodec":"h264","audioCodec":"opus","audioChannels":6,"transcodeHwRequested":false,"timeStamp":1518543076.9353567,"maxOffsetAvailable":915.249,"minOffsetAvailable":1.0}]}}


EDIT:
yjanr6g8i7oxkouewsgn45cd
ist genau die ID von dem Client-Player.

Reinerlein

Hi Andre,

das klingt so, als würde geforce28 auch Plex Home verwenden. Sind zumindest die gleichen Symptome wie bei mir...
Gibt es dazu denn eine API-Beschreibung?

Grüße
Reiner

geforce28

Hallo zusammen,

ja das scheint in der Tat so zu sein.
Wenn mit Plex Home gemeint ist, dass ich mehrere Benutzer in Plex habe...

justme1968

ok...

wenn du mehrere plex home benutzer hast wäre das eine erklärung.

ich weiss aber noch nicht was genau passiert und warum es nicht geht. sobald ich dazu kommen versuche ich es nachzustellen.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

justme1968

@Reinerlein: 90% der funktionalität im modul sind reverse engendered. für etwa 10% gibt es im prinzip eine api bschreibung. die ist aber nicht aktuell und zum teil so ungenau das von diesen 10% auch noch mal mindestens 5% ohne rewerse engineering und wireshark nicht funktionieren würden.

es bleibt also nur zeit haben und nachstellen...
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968