Author Topic: How can I use other devices data in events?  (Read 471 times)

mrbo

  • Making baby steps
  • Posts: 3
    • View Profile
How can I use other devices data in events?
« on: September 04, 2013, 08:55:47 pm »
I have different sleeping rooms and don't understand how I could handle them correctly for light automation. At the moment I use house mode to handle all sleeping rooms equally. But I would need a global data for modes or modes related to rooms (or devices) which I can use in event criteria selection. I sure am missing something here.

Ideally I would love to set global variables like "partymode = 1" or "kidsroomsleeping = 1" and use them in any event needed. Is there any way to do this?

Thanks!

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5501
  • DOES work for LinuxMCE.
    • View Profile
Re: How can I use other devices data in events?
« Reply #1 on: September 04, 2013, 09:00:41 pm »
I will need to think on this, and get back to you. The events in LinuxMCE are intentionally stateless, to avoid lots of potential pitfalls, but certain things like this, I am not 100% sure on how to handle. I'll basically be looking in the Event_Plugin source code, if you want to look there, as well.

-Thom

davegravy

  • Addicted
  • *
  • Posts: 525
    • View Profile
Re: How can I use other devices data in events?
« Reply #2 on: September 04, 2013, 09:41:21 pm »
I took a really bad approach to this in my setup. But it works.

I ended up having my events call a python script which gets the relevant device data or status directly from the mysql database and interacts back with LMCE via MessageSend.

mrbo

  • Making baby steps
  • Posts: 3
    • View Profile
Re: How can I use other devices data in events?
« Reply #3 on: September 04, 2013, 10:12:23 pm »
Thank you both. But I am still not familiar with the idea. For me it looks like it would be possible to use some device data and add them to the event parameters for my event. This would be handed over to the event handler via socket message. If this works I would need to tell the sensors what I want so they can put it in the events. I would need one parameter per room.

The idea of davegravy sounds handy. I could even go beyond the event and tell the ligths just to turn on when they are "active". Actually now I am reading the wiki again and I find there is a flag "ignore on/off" which sounds like it would make the device ignoring on/off commands. But I can not set this from the general info commands.

mrbo

  • Making baby steps
  • Posts: 3
    • View Profile
Re: How can I use other devices data in events?
« Reply #4 on: September 18, 2013, 10:50:02 pm »
It may not be related to my question but I found an easy workaround for my problem (having different sleeping areas). I am now using virtual rooms to simulate modes. So I created scenarios which may set the room for a sensor and in the events I can use the room from the sensor and have different scenarios depending of the room the sensor is in. The same could be more intuitive if it would be possible to read generic device data in the event criteria. I would have created a new integer field in the sensor and could also use expressions like "> 10" in the event criterias.