INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Startup Scripts for Initialization  (Read 2516 times)

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72444
  • Where did I put my teeth?
Startup Scripts for Initialization
« on: June 14, 2016, 02:17:26 pm »

This began as something specific to Engen,  but it may have broader applications, so please help us design it.

The specific use case I had in mind is to be able to turn on a Z-Wave outlet to power up my receiver and another to power up my TV,  both from a power off state.  

We can already do this manually with Engen, but I'd like to give MC the ability to do it automatically.  Here's the plan:

------------ begin MC changes ---------

In Startup settings, add Initialization

On resume from sleep, run this script [filename]
   sleep 5
   send url "xyz"
   sleep 5

On cold start, run this script [filename]

On sleep, run this script [filename]

On shutdown, run this script [filename]
Logged

rlebrette

  • Guest
Re: Startup Scripts for Initialization
« Reply #1 on: June 14, 2016, 04:41:11 pm »

Why to limit it to startup/shutdown events?
The lightning and air conditioning systems in my dedicated room are triggered depending on status of the player.
With the current implementation I poll the system every 500 ms to know what has changed and define a global state. The polling is pretty resource consuming.
I've different lightning scenes and air conditioning configurations, for example:

- When nothing is playing; lights are on, not fully powered.
- When playing music, I ve a soft ambiance with spots medium (enough to be able to read a book while listening) and led strips with a blue to green ambiance (not yet based on music ;))
- When paused during a movie, another ambiance with spots very low and a red ambiance.
- When the movie reaches the last chapter (usually the credentials) the lights starts to dim on after 30 seconds. (by the way, thank for the recent fix on MCWS chapter info, it helps a lot)

I've similar behavior on the air conditioning system especially while playing movie, I hate to watch the beginning of "Gravity" which is an astonishing silence while the air cond is full powered. So the fan mode is off while watching a movie.

Having MC able to run scripts on state change will make all this home automation far easier.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72444
  • Where did I put my teeth?
Re: Startup Scripts for Initialization
« Reply #2 on: June 14, 2016, 05:26:44 pm »

What are you using to control things?  Girder?  Eventghost?

Are you polling MC via MCWS?  I wonder if we might do a broadcast on certain events.  We might do that in Engen so we don't generate traffic for people who don't need it. 
Logged

rlebrette

  • Guest
Re: Startup Scripts for Initialization
« Reply #3 on: June 14, 2016, 08:36:17 pm »

What are you using to control things?  Girder?  Eventghost?

Are you polling MC via MCWS?  I wonder if we might do a broadcast on certain events.  We might do that in Engen so we don't generate traffic for people who don't need it. 

Hi Jim,

Sure I poll via MCWS, currently I've written a simple script engine in VB which is published here: https://github.com/rlebrette/jrmc-vb-status-listener.
It's running in background concurrently to the MC process.
When the script has detected an interesting change (chapter, track, player status) it sends a REST command to my home automation server (https://www.jeedom.com/site/en/index.html) which is coordinating all interactions with IoTs.
Logged

rlebrette

  • Guest
Re: Startup Scripts for Initialization
« Reply #4 on: June 14, 2016, 08:56:49 pm »

To be complete, I've three tablets that are dedicated as GUI for managing the interactions with Jeedom via the Android applications ImperiHome and Tasker.
As an example here's the sum up screen for my dedicated room:
Logged

rlebrette

  • Guest
Re: Startup Scripts for Initialization
« Reply #5 on: June 14, 2016, 09:12:11 pm »

Logged
Pages: [1]   Go Up