Jump to content

New Plugin - Samsung SmartThings


chef
 Share

Recommended Posts

@@hstamas, how are your pause and resume scenes setup? What and how are you running them? Are you tying to Hue lights direct or are you running with a virtual switch to IFTTT? Timers in them might be conflicting with them is why I ask. I run with a virtual switch, sends commands to IFTTT and LIFX, timers in LIFX and IFTTT match.

Link to comment
Share on other sites

What I did here was remove a check which tries to limit running code during the PlaybackProgress event which fires every second of the movie.

 

I was trying to limit the overhead of the code on the server by looking to see if any sessions had paused media, or if there was any sessions added to our  pausedSession list. If there was none then just break the operation.

 

However, perhaps letting the conditions run every second is okay... ?? maybe.

 

This version adds a ton more logging, and should tell us (hopefully) why the un-pause event is making its way through those conditions.

 

I hope we see better results.

 

DOWNLOAD: SamsungSmartThings.zip

Link to comment
Share on other sites

@@chef,

Just watched a movie, everything ran as it should. This was with the new code you sent last week. Play worked (after intros played), pause worked, resume worked, credits ran at the 89 second mark towards the last 89 seconds of the movie and the stop scene ran when the movie was done and Emby screen went back to movie info. I have attached the log for you to review.

 

 

this was a good log. We can see that only once did the unpause scene glitch out, but it was picked up by the following progress event, and saved.

Link to comment
Share on other sites

Strange that the log showed a glitch, did not experience one when I paused or resumed the movie. One thing I noted from the last plug-in from April was that if a movie had been watched previously the credit scene would not run. I will see if I can replicate it again. Not a big issue, might be a flag I have checked to show “watched movies”.

  • Like 1
Link to comment
Share on other sites

@@hstamas, how are your pause and resume scenes setup? What and how are you running them? Are you tying to Hue lights direct or are you running with a virtual switch to IFTTT? Timers in them might be conflicting with them is why I ask. I run with a virtual switch, sends commands to IFTTT and LIFX, timers in LIFX and IFTTT match.

I just did standard Smartthings scenes. Hue lights are call upon directly.

  • Like 1
Link to comment
Share on other sites

Tried mine yesterday @@chef,

Play works fine, first pause/ resume worked like it should. Second pause about 10 minutes later, activated 1 virtual switch correctly, second virtual switch started to light then glitched and went off. Resume worked correctly on the one that did light. Tried again for a third time, all worked as it should no glitch. Weird that it glitches after first time.

 

Did set credits to 120 seconds and it activated correctly at 120 seconds left of movie. I will adjust again to 180 seconds and see if it still works.

 

embyserver.txt

Link to comment
Share on other sites

In order to persist the way we are keeping track of sessions in a paused state, we check and see if they are in a list of paused sessions.

 

If they are not in the list and they are paused then, that session has just paused.

 

That session is then ignored while the state is paused and it exists in the list.

 

After the session is unpaused it is removed from the list.

 

There is something strange happening between the first conditional check of a paused session, and it's addition to the list during the playback progress event, and the next time the playback progress event fires.

Link to comment
Share on other sites

@@chef, when I did mine I left about 10 minutes in between and also a few minutes after I paused to resume, I didn’t want it to get confused.

  • Like 1
Link to comment
Share on other sites

I'm probably remembering incorrectly but ... plugin version 1.0.0.2 from the catalogue, Samsung TV, Emby App. All my scenes work through the Smartthings app manually, 4 scenes for play, pause, unpause and stop.

I remember at some point that when I hit the back button on my remote to "stop" playback then the stop scene was fired by the plugin. Is that right? Or because there isn't a stop button in the gui/on the tv remote am I just remembering wrong? Reason I ask is because my stop scene isn't being run by the plugin. Only noticed it myself today but wife says it's been like that for a while ("I dunno, more than a week, maybe ....did it ever do that?"). Just thought I'd check if it was me or something else going on :P

Link to comment
Share on other sites

I'm probably remembering incorrectly but ... plugin version 1.0.0.2 from the catalogue, Samsung TV, Emby App. All my scenes work through the Smartthings app manually, 4 scenes for play, pause, unpause and stop.

I remember at some point that when I hit the back button on my remote to "stop" playback then the stop scene was fired by the plugin. Is that right? Or because there isn't a stop button in the gui/on the tv remote am I just remembering wrong? Reason I ask is because my stop scene isn't being run by the plugin. Only noticed it myself today but wife says it's been like that for a while ("I dunno, more than a week, maybe ....did it ever do that?"). Just thought I'd check if it was me or something else going on :P

The stop scene should fire when the stream is closed in Emby.

 

That isn't happening

  • Like 1
Link to comment
Share on other sites

Ok, think I'm going to need some help on this one.

 

If I play on my HTPC via Emby app or Kodi or a web browser, works fine with the same scenes. If I run from my PC upstairs, same apps, all fine with different lights and scenes.

 

Via the TV app however, the stop scene never runs. Things I've tried -

 

Deleted profile in the plugin and recreated.

Created a second stop scene in Smartthings.

Checked the same scenes in different apps/devices.

Tried using playback controls and gui controls on different apps/devices.

 

It's only on the Samsung TV via the Emby Theater app that the stop scene never runs. I've no idea when it stopped working (current events have made me a busy boy :( ) but I'm 99.9% positive it did work at some point.

 

In comparing entries in the log, what jumped out at me was -

2020-05-25 12:01:26.992 Info Samsung Smart Things: Samsung Smart Things Reports Playback UnPaused...
2020-05-25 12:01:26.992 Info Samsung Smart Things: Samsung Smart Things Found Profile Device: Samsung SmartTV (QE55Q80RATXXU)
2020-05-25 12:01:26.992 Info Samsung Smart Things: Samsung Smart Things Reports Movie will trigger Playback UnPaused Scene for Samsung SmartTV (QE55Q80RATXXU)

compared with -

2020-05-25 12:01:39.862 Info Samsung Smart Things: Samsung Smart Things Reports Playback Stopped

and my HTPC -

2020-05-25 12:02:34.529 Info Samsung Smart Things: Samsung Smart Things Reports Playback Stopped
2020-05-25 12:02:34.530 Info Samsung Smart Things: Samsung Smart Things Found Profile Device: Media-PC 
2020-05-25 12:02:34.530 Info Samsung Smart Things: Samsung Smart Things Reports Movie will trigger Playback Stopped Scene on Media-PC

Also on occasions when I pause the video, the pause scene will fire but go immediately back to the play scene until the GUI disappears and then the pause scene is fired again (so lights raise to 50% then right back to 12%, wait a few seconds and GUI disappears, then lights to 50%; I'm assuming this is related to the glitchyness others have reported before).

 

Emby Server 4.4.2.0

Smart Things 1.0.0.2

Samsung QE55Q80RATXXU (UK)

Emby Theater 1.0.77

  • Like 1
Link to comment
Share on other sites

@@CashMoney thank you for the good explanation of your experience.

 

I'm aware of the pause and unpause issue, I've been trying to figure that one out.

 

The TV app problem is definitely a new one.

 

Would it be possible to get a clean log with just the play, stop and pause events from the TV in it?

 

Would it also be possible to use the test version of the plugin from post #53 of this thread to get the logs.

 

That version has a whole bunch of extra logging in it.

 

Thank you for your time.

Edited by chef
  • Like 1
Link to comment
Share on other sites

@@CashMoney thank you for the good explanation of your experience.

 

I'm aware of the pause and unpause issue, I've been trying to figure that one out.

 

The TV app problem is definitely a new one.

 

Would it be possible to get a clean log with just the play, stop and pause events from the TV in it?

 

Would it also be possible to use the test version of the plugin from post #53 of this thread to get the logs.

 

That version has a whole bunch of extra logging in it.

 

Thank you for your time.

I'll do that now, thanks @@chef

 

Edit - New log with plugin version from post #52

 

 

embyserver.txt

Edited by CashMoney
Link to comment
Share on other sites

Okay a lot if interesting things happening there.

 

I think this log is going to help us fix the pause/unpause issue actually.

 

however, the plugin is seeing the stop the event fired from the TV, but for some reason it is not triggering the scene, or at least isn't triggering the scene and logging it properly.

 

This will be priority today.

  • Like 1
Link to comment
Share on other sites

Pause/unpause glitch is still there, sorry @@chef. It is however not instant like before if that helps any? There is now a longer delay before it re-activates the correct pause scene.

 

Attached log should be a start server, play, pause, unpause stop only log. HTH.

 

Edit, probably helps if I actually attach the log.

embyserver-63726017193.txt

Edited by CashMoney
  • Like 1
Link to comment
Share on other sites

I changed the way the progress events are calculated. 

 

Now we look at all the open sessions instead of the session which triggers the event.

 

The problem is that if you calculate the session which triggers the event, and there is another open session playing something, then two events gets triggered, and there isn;t enough time for the code to execute and update lists of paused sessions. This will cause wierd behaviour.

 

I think this is what was happening.  I'm sorry that it hasn't been a quick fix. I'm hoping that by look at each session on the progress event, that it will stop the glitchy wierdness with the project.

 

DOWNLOAD: SamsungSmartThings.zip

Link to comment
Share on other sites

Same. The delay is now gone (though it occurred to me that maybe that was just the extra logging?), but it acts as before.

 

Pressing play doesn't turn the lights on if they are off the first time (scene does have the on command and executes as expected manually).

When I pause, the lights decrease to play level (12%), wait about 3 seconds then increase to pause level (50%). They do this even if they were off (as expected)

When I unpause, the lights go to play level (12%).

When I pause again, sometimes I get the above, sometimes it acts as it should.

Stop scene never fires.

 

Just to be sure here; should we be removing/clearing our profiles each time or is just shutting down the server, swapping the plugin.dll and restarting the server enough? I've been doing the latter.

 

Just tested with my sons tv, another samsung running emby theater 1.0.75; the stop scene works for him, but still the same pause glitch. Could the stop issue be something to do with Emby Theater version differences? Anyone else here running Emby theater on a Samsung TV with 1.0.77?

embyserver.txt

Link to comment
Share on other sites

No need to remove profiles. I just posted a new version above the last post which I am hoping will fix this.

Link to comment
Share on other sites

I changed the way the progress events are calculated. 

 

Now we look at all the open sessions instead of the session which triggers the event.

 

The problem is that if you calculate the session which triggers the event, and there is another open session playing something, then two events gets triggered, and there isn;t enough time for the code to execute and update lists of paused sessions. This will cause wierd behaviour.

 

I think this is what was happening.  I'm sorry that it hasn't been a quick fix. I'm hoping that by look at each session on the progress event, that it will stop the glitchy wierdness with the project.

 

DOWNLOAD: attachicon.gifSamsungSmartThings.zip

So just tried the above, does nothing at all now?

 

Thanks again for looking at this @@chef we are all very appreciative of your efforts!

embyserver.txt

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...