Sammy 790 Posted May 1, 2019 Posted May 1, 2019 (edited) @@chef Is it possible to have the Vera Plugin trigger a task in Windows? Specifically, can I have it trigger MCEBuddy to start processing when the Emby Server is in a idle state and stop MCEBuddy when it is not in an idle state? @@cayars Any suggestions? Edited May 1, 2019 by Sammy
Sammy 790 Posted May 1, 2019 Author Posted May 1, 2019 BTW, I also have the Emby Plugin installed on my Vera. Any way to do it from there? I don't care how it happens so long as it happens! LOL.
Sammy 790 Posted May 1, 2019 Author Posted May 1, 2019 I cross posted. https://community.getvera.com/t/vera-2-emby/199693/73?u=sammy2
Sammy 790 Posted May 1, 2019 Author Posted May 1, 2019 Anyone? Anyone? Bueller? Anyone? Sent from my SM-G960U1 using Tapatalk
Luke 42077 Posted May 2, 2019 Posted May 2, 2019 I would suggest posting in the thread for the plugin to make sure the developer sees it. 1
PrincessClevage 175 Posted May 2, 2019 Posted May 2, 2019 (edited) At the moment I don’t think this is possible and short of someone creating this functionality from scratch I can’t see it working (but would be useful). Technically it is possible and one product I use for putting emby server to sleep when I say “Alexa turn of media switch “ is Sleep On Lan (SOL) https://github.com/SR-G/sleep-on-lan/blob/master/README.md I use the rest method with a http call sent from Vera hub to emby server (win 10) when it turns off the amp, cooling for the amp (starts a countdown timer) , tv and emby server. The service listening then executes code to execute the sleep mode (s3 power state) on the pc, perhaps you can adjust this to execute some other command like schtasks /run /tn TaskName [/s computer [/u [domain\]user /p password]] This in conjunction with Rigpapa Vera > Emby app (monitoring for inactivity as a trigger to send the http call) Hope this is of some help Sammy Edited May 2, 2019 by PrincessClevage
Sammy 790 Posted May 2, 2019 Author Posted May 2, 2019 (edited) At the moment I don’t think this is possible and short of someone creating this functionality from scratch I can’t see it working (but would be useful). Technically it is possible and one product I use for putting emby server to sleep when I say “Alexa turn of media switch “ is Sleep On Lan (SOL) https://github.com/SR-G/sleep-on-lan/blob/master/README.md I use the rest method with a http call sent from Vera hub to emby server (win 10) when it turns off the amp, cooling for the amp (starts a countdown timer) , tv and emby server. The service listening then executes code to execute the sleep mode (s3 power state) on the pc, perhaps you can adjust this to execute some other command like schtasks /run /tn TaskName [/s computer [/u [domain\]user /p password]] This in conjunction with Rigpapa Vera > Emby app (monitoring for inactivity as a trigger to send the http call) Hope this is of some help Sammy I'm sorry but you totally lost me on the command schtasks /run /tn TaskName [/s computer [/u [domain\]user /p password]] What are the variables TaskName computer Domain\ And the switches /tn /s Is /run the same as running a task window via the Run Command in Windows? Is this put in the LUA part of setting up a scene in Vera? TIA Edited May 2, 2019 by Sammy
PrincessClevage 175 Posted May 2, 2019 Posted May 2, 2019 (edited) You will need to consult the oracle (google) some what for: How to run scheduled tasks from command line And How to create a batch file in windows If it is possible (and you find a way ) to change what is executed. Below is a start for the first (written for server 2003 but I believe is still relevant for win10) https://support.microsoft.com/en-au/help/814596/how-to-use-schtasks-exe-to-schedule-tasks-in-windows-server-2003 Edited May 2, 2019 by PrincessClevage 1
Sammy 790 Posted May 2, 2019 Author Posted May 2, 2019 I do know how to create .bat files. Remember config.sys and autoexec.bat? I do use a couple .bat files already as scheduled tasks but not in this fashion. Thanks for pointing me in the right direction. @@Luke how to pull the ServerIsIdle information? The Emby Plugin in Vera pulls it and displays it when no users are connected. Displaying the information is one thing. Doing something useful with the information is another altogether! TIA Sent from my SM-G960U1 using Tapatalk
PrincessClevage 175 Posted May 2, 2019 Posted May 2, 2019 You can possibly use Rigpapas reactor plugin for Vera and add one entry for each of the emby clients you want to check for activity using value “lastActivity” = 0 and set a time period for say 45min as a condition for trigger and action would be to send http command from Vera to server luup.inet.wget('http command goes here') (assuming you use and get the process that I previously mentioned working with a bat script etc)
Sammy 790 Posted May 2, 2019 Author Posted May 2, 2019 So.. If the client hasn't been active for 45 minutes it'll trigger the http call? Hmm.. Interesting. I'd need to set it up for each client. rigpapa responded on the Vera Forum and it seems the plugin doesn't check for Emby Server Idle state but rather reports it as idle when no clients are connected. Your suggestion seems to be in line with that logic. Now to set it up and give it a whirl. I have Reactor installed on my Vera (reinstalled after needing to clear space for the update last week) but have never found the time to play with it. I suppose I should try something more simple first with devices inside my Vera ecosystem before venturing on to this.
Sammy 790 Posted May 2, 2019 Author Posted May 2, 2019 (edited) I see that I'd have to set up a reactor for each client that connects to my Emby Server? There's about 30 ATM.. Of course some of them are from the same user, just many clients. This sounds like a lot of set up! Edited May 2, 2019 by Sammy
Sammy 790 Posted May 2, 2019 Author Posted May 2, 2019 (edited) I got Reactor to trip when the Emby Server was "Active". I'm pretty sure I can get Reactor to trip when the server is idle.. Now to figure out how to get that into a script to tell Windows when to run and not to run MCEBuddy. Edited May 2, 2019 by Sammy
Sammy 790 Posted May 2, 2019 Author Posted May 2, 2019 Basically yes. It would be nice to be able to run MCEBuddy whenever my Emby Server is idle because when MCEBuddy kicks off ComSkip and especially HandBrake the CPU goes to +90% even though I have MCEBuddy set to use HWA. When this happens, Emby slows to a crawl or sometimes doesn't load at all. I use the timer in MCEBuddy but it only allows for one time to be set and on some days all my recordings don't get processed and then I end up with a backlog. This in turn causes me to have to fire up an RDP Session using Jump Desktop on my phone to "unpause" MCEBuddy before turning in for the night. Thanks, @@chef
chef 3810 Posted May 2, 2019 Posted May 2, 2019 (edited) Okay, we would know idle time using session events. No connected sessions would mean idle server. Unless anyone else reading this thread has a better idea of getting idle time from the server. However, what happens if a session becomes active, and mcebuddy is interrupted? Will that cause problems with encoding media? What does the mcebuddy emby plugin do? Just want to make sure bases are covered before sketching it up Edit: the command line would pause mcebuddy when a session starts. Right? Edited May 2, 2019 by chef
Sammy 790 Posted May 2, 2019 Author Posted May 2, 2019 Pausing MCEBuddy is the goal, yes. It does this internally but only has one schedule. My usage gives it about 9 hours during the day and maybe 6 at night so I choose the daytime run. My wife's a teacher so soon the daytime will be active at times too. I need some better timing between the two apps to not bog down my server. This would be a matter of pausing the MCEBuddy Process or Service and then un-pausing it when Emby Server is idle I know @@Luke has ComSkip buried in a release from at least six months ago but Emby isn't using it yet and I've seen nothing about it in the beta server either.
chef 3810 Posted May 12, 2019 Posted May 12, 2019 @@Sammy Finally got some time to work on this. Is there any reason why there would ever be a session connected to your Emby server (example: Vera Plugin... not mine but the one connected from the Vera... creates a connection that idles on the the emby server)? The reason I ask is that in this plugin I'm writing, it would look for 'no' connections to decided if the server was idle. In this case a windows process would kick off and run. If there was a connection, then the process would stop. However if there where connections idle on the server like the Vera Plugin from Rigpapa, then the process would never start because the connections would never be zero. If this is the case, then I would have to create a 'white-list' of connections that would be ignored in order to kick off the windows process... Not difficult, but it's gonna take me a a bit to work it into the plugin. Let me know if that makes any sense to you Thanks!
Sammy 790 Posted May 13, 2019 Author Posted May 13, 2019 This is what I see in Emby and in Vera. I'm not sure if it gives you the information you need? .
Sammy 790 Posted May 13, 2019 Author Posted May 13, 2019 BTW, whenever I look at the Emby Plugin in Vera, the "Last Seen" value in Emby resets. Also, refreshing the Emby Dashboard over the course of 60 Seconds and the "Last Seen" value resets to 0. Short answer is that I believe that the Emby Plugin in Vera is "active" in Emby every 60 seconds when it checks the idle state. It seems it would need to be white listed. BTW, thank you @@chef ! I think that there could be other useful purposes for a plugin such as this. What say you @@Luke and @@ebr ?
Sammy 790 Posted May 14, 2019 Author Posted May 14, 2019 Wow! It shouldn't need a schedule because it will not be running when Emby is. Sent from my SM-G960U1 using Tapatalk
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now