Author Topic: Few basic questions about creating real-life scenarios  (Read 10127 times)

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Few basic questions about creating real-life scenarios
« on: March 21, 2008, 09:04:38 am »
Hi,

I'm creating first few scenarios in my new house and in a lack of any experience have few basic questions how to :

- create scenario to play some music for X mins ...

- do something when bluetooth phone appears in range (Wiki talks about bluetooth phone coming/going but couldn't find it on preselectable pull down menu....) ?

- can I run another scenario from new scenario ?

- create scenario, where actions appear over time (for instance wake up: start slowly music, after 5 mins slowly come up with lights, after 10mins start coffe machine, then tell weather forecast, etc....) ?

- when I have wake up scenario - how to easily setup wake up time on daily basis (from Orbiter maybe) ?

- can I schedule power down of core at night ? (I can easily make him wake up in the morning by BIOS)...

- it's mentioned that Ruby can be used for event handling. Anyone tried that ?

Any advices ?

I'd also like to hear about popular scenarios you're using at your homes....

Thanks in advance,

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #1 on: March 21, 2008, 09:44:00 am »
Scenarios are nothing more than defined buttons that appear on the orbiter. For example, creating a "Bathroom" scenario for your bedroom orbiter will create a button (under lighting if thats where you defined it) with the text "Bathroom" on it. You might have this scenario set up to turn all lights between your bedroom and your bathroom on to 50% (I have these set up on my kids' orbiters, so they can hit one button in the middle of the night and the lights going from their room to the bathroom will light up for them).

I think what you are looking to do is "respond to events", check it out in the web admin, a lot of it is self-explainitory.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #2 on: March 22, 2008, 01:18:38 pm »
Scenarios are nothing more than defined buttons that appear on the orbiter. For example, creating a "Bathroom" scenario for your bedroom orbiter will create a button (under lighting if thats where you defined it) with the text "Bathroom" on it. You might have this scenario set up to turn all lights between your bedroom and your bathroom on to 50% (I have these set up on my kids' orbiters, so they can hit one button in the middle of the night and the lights going from their room to the bathroom will light up for them).

I think what you are looking to do is "respond to events", check it out in the web admin, a lot of it is self-explainitory.
Hi, thanks of response.

What I was after are problems in how to implement such things. I don't think those things are so self explanatory (just two examples) - but could be easily that I'm missing something - that's why I wrote post:

- I can't find corresponding event to respond to in case of detection of Mobile phone in Bluetooth range

- It's not clear to me how to start music and end it after some time (Event handle has mostly "do this at this time", but not "do this after xxx mins"

- Scenarios (AFAIK) don't have "run this after x mins" support, so I'm curious if anyone tried something similar already...


Thanks in advance,

regards,

Bulek.
 

Thanks in advance,

regards,

Bulek.

caiman

  • Veteran
  • ***
  • Posts: 119
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #3 on: March 29, 2008, 09:57:15 am »
Hi Bulek,

For BT device detection, go to menu Advanced -> Configuration -> Events. Click "create advanced event" and you will find ¨Bluetooth dongle -> Mobile orbiter detected"in the list. I have just tried it and had a message displayed on the orbiter when my phone was in range.

For the timer, you can do this. In the commands you enter to respond to the event, send a command to DCERouter. You will have there the option to send a "delay"command. Enter the value in milliseconds (I think). I have used this to have a light stay on for a few minutes when movement was detected in a room.

Sam

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #4 on: March 29, 2008, 09:52:03 pm »
Hi Bulek,

For BT device detection, go to menu Advanced -> Configuration -> Events. Click "create advanced event" and you will find ¨Bluetooth dongle -> Mobile orbiter detected"in the list. I have just tried it and had a message displayed on the orbiter when my phone was in range.

Hi,

thanks for response. We're moving ahead.... Aaah, that "create advanced event" was the trick... Have found it - can you distinguish which mobile orbiter is detected or you just have response to any mobile orbiter detected ?

For the timer, you can do this. In the commands you enter to respond to the event, send a command to DCERouter. You will have there the option to send a "delay"command. Enter the value in milliseconds (I think). I have used this to have a light stay on for a few minutes when movement was detected in a room.

Sam

I've added delay command, but I'm not sure if I follow your explanation... ok, you put 1000 (fpor 1 sec) and add Delay command. What happens now ? How do you specify what will happen after 1000 msec ?

It seems you've done few interesting scenarios. Can you please post to Wiki about scenarios you created ? I'd love to read more..

Thanks in advance,

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

caiman

  • Veteran
  • ***
  • Posts: 119
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #5 on: March 30, 2008, 01:09:56 am »
Hi Bulek,

good catch for the identification of the mobile orbiter. I had a look and I don't see how to specify the phone/mobile orbiter. When the orbiter is detected, we can see in the DCErouter logs some interesting parameters:
Code: [Select]
07      03/30/08 0:48:15.226            Received Message from 30 (Bluetooth Dongle / Salon TV) to -1001 (unknown / ), type 2 id 4 Event:Mobile orbiter detected, retry none, parameters: <0x841ccb90>
07      03/30/08 0:48:15.226              Parameter 5(Mac Address): 00:17:E5:04:xx:xx <0x841ccb90>
07      03/30/08 0:48:15.226              Parameter 6(Signal Strength): 0 <0x841ccb90>
07      03/30/08 0:48:15.226              Parameter 7(ID): Lembas <0x841ccb90>
but I do not see many useful options in the "criteria"  menu. Let's keep on searching...

For the delay, the idea is the following. Assume you have a sensor which detects presence in a room. You want a light to be turned on during 10 minutes when that sensor is triggered. What you need to do is create a event handler for sensor tripped, and define 3 actions:
1) turn the light on
2) send a delay of 600000 ms to dcerouter
3) turn off the light
This works fine for me. I agree, itś not intuitive :)

I haven't done so many scenarios, as much as I would love to because automation is still very unreliable: my home is half x10 half zwave.

X10 has never worked well if there are sensors around because of the bad checksum bug http://mantis.linuxmce.org/view.php?id=3845 (except for a nasty workaround with heyu that I suggested in an earlier post). I have seen with delight that this has been fixed but not in beta4, I am now in the process of installing a dev environment to try to compile the cm11a driver for a 32 bits arch. Fingers crossed.

Zwave is unreliable because it looses half of my devices at each router reload: [url][http://mantis.linuxmce.org/view.php?id=3614/url] which is unresolved. I have ordered a seluxis dongle hoping its driver will be better but I have doubts.

So you see, my setup remains experimental :(

But I disgress... some typical scenarios I have are:
- turn off all devices at late night, to be sure I haven left anything on
- react on Sunset event and add 1.5 hour. Then only, light outside lamps at 30% (power save...)
- turn lights on when I enter a room, but only during the day
- etc etc
So still quite basic :)

Hope this helps

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #6 on: March 30, 2008, 01:14:05 am »
Caiman-

You should drop into #linuxmce on IRC, we can hve youre dev environment up and running in no time... Also, I put an entry in the wiki on setting up a development environment. I'd like to help you get your CM11A up and stable for you - if I had a 32 bit setup I'd compile it for you. Either way, I think you will be impressed with how stable the CM11A is now

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #7 on: March 30, 2008, 01:24:15 am »
Regarding the delay command....  I haven't had time to test it myself, but does anyone know if it actually schedules the command to be sent at a later time (without blocking any other commands between _now and _now+delay?

For example, if I create a scenario which ends up turning a light on, then doing a delay for 5 minutes before a command to turn the lights back off.. During that 5 minutes, will other commands sent to that light still have an effect, or, will it jump to the end of the line and get executed after the command that gets executed after the 5 minutes expires?

caiman

  • Veteran
  • ***
  • Posts: 119
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #8 on: March 30, 2008, 02:07:57 pm »
Hi jondecker76,

thanks. I am doing the first "svn update" right now :)
I have seen your posts regarding the new cm11 driver and I cannot wait !

I also want to have a look at the source of the zwave plugin to see why we loose devices when there is a gap in the sequence.

For the delay, I am not sure, but I believe you are right saying there will be some sort of locking. See this old post: http://forum.linuxmce.org/index.php?topic=136.0. I would expect that you can still send commands to the device during the delay period (to be verified) but it seems you cannot "reset" the timer.

See you soon on IRC...

Sam


chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #9 on: March 31, 2008, 11:45:07 am »
So isn't there going to be a problem in that if you enter a room the timer is set up for 10 mins, but if you stay in there and are moving around the light will still turn off after 10 mins because it is not possible to keep extending the timer whenever movement is detected? This would mean every 10 mins the light would go off and then back on again, which would be quite annoying.

Is there a way around this?

Chris


caiman

  • Veteran
  • ***
  • Posts: 119
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #10 on: March 31, 2008, 09:55:43 pm »
Chris,

that is correct. Maybe we could reach out to aaron.b from plutohome to ask if it has been implemented in the meantime.
http://plutohome.com/support/phpbb2/viewtopic.php?t=136&highlight=x10+timed+events

Sam

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #11 on: April 01, 2008, 03:16:03 pm »
Good work finding that post. Do you know how we can get hold of Aaron?

caiman

  • Veteran
  • ***
  • Posts: 119
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #12 on: April 07, 2008, 02:27:12 pm »
No idea. In the meantime I found some possible leads.

This post: http://wiki.linuxmce.org/index.php/Make_things_happen_at_set_times_or_intervals talks about the possibility to use ruby code to create advanced events. While I understand how this could be done with standalone ruby scripts connecting to the DCErouter, I didn't find in the GUI the possibility to enter "snippets of code".

In the events editor, using the "Advanced Wizard", one can send a "delay" message to DCE router as I explained above. Now I see two other message types that can be sent to DCE router: "Execute command group" and "Stop pending command group". If the latter is what I think, it could be used to reset the timer associated to a presence sensor each time the sensor is triggered. I haven't tried though, and we would need to find how to obtain the command group ID (and how to create command groups for that matter)

Sam

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #13 on: April 07, 2008, 02:36:42 pm »
Hi,

not sure if any help, but command groups are also custom scenarios that you create to appear on Orbiters. I have found no other way of searching them beside digging directly in sql database.... I use them to trigger LMCE scenarios from lower level automation system...

Regards,

Bulek.
Thanks in advance,

regards,

Bulek.

caiman

  • Veteran
  • ***
  • Posts: 119
    • View Profile
Re: Few basic questions about creating real-life scenarios
« Reply #14 on: April 07, 2008, 02:48:43 pm »
Bulek,

thank you !
I could indeed find them in the DB in the table CommandGroup (surprise surprise :) )

Sam