Author Topic: Device state information  (Read 3440 times)

derailed

  • Newbie
  • *
  • Posts: 10
    • View Profile
Device state information
« on: February 27, 2009, 07:44:13 am »
Hi,

    Can anyone post some information on how to get a device current state. Somehow the state is persisted in the db for lights only but does not appear to be consistent across other devices.

    So can someone enlighten me on how to ask a device for it's current state ie can I use MessageSend to get this type of information somehow - ie a light is on/off/dimed. an IP cam is active or not - a motion sensor is active, etc...


Thanks !!

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Device state information
« Reply #1 on: February 27, 2009, 09:26:15 am »
Devices have device data, and this is often used to persist device information that needs to remain consistent across reloads.

You can explicitly set a particular devicedata as "Set By Device" so that it can not be edited by a user.

Accessing this device-data depends on:

* Whether you are accessing your own device data (accessors are provided for this), or Whether you are accessing someone else's device data (The General Info Plugin is used for this.)
* Whether you are doing this from a C++ device (using the accessors defined in Gen_Devices for your device), or from a Ruby/GSD device (using the DevData_[xxx] accessors (where xxx is the particular ID of device data you're trying to access.)

-Thom

derailed

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Device state information
« Reply #2 on: February 27, 2009, 08:25:37 pm »
Thanks for the info Thom !

So are you saying there is actually no way to talk to the device directly and ask it for its current state/status ?

It would seem that I should be able to perform a MessageSend to that device somehow and ask it which state is it currently in ?


Thanks !!

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Device state information
« Reply #3 on: February 27, 2009, 08:55:26 pm »
The device should alter its device data when state changes, it should also emit events.

-Thom