Announcement

Collapse
No announcement yet.

Device Creation logic - Nooby question - IOMISC?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Device Creation logic - Nooby question - IOMISC?

    Hi All. I start learning HS plugin writing (C#) based on alexdresko/HSPI_MoskusSample/HSPI_HikAlarmCheck code.
    What I don't seen to get - different device creation scenarios and how to handle them in the plugin:
    1. Pluging starts first time - it creates devices in HS. So now HS keeps track of the devices and
    2. next time plugin loads - it should get list of the devices from HS (by enumerating all devices and checking interface name).

    So far so good. But it's possible that the user changes in HS device location, name, type, etc. So my plugin can safely rely only on the device reference numbers? But then how do I know what device is what? Does it mean that device configuration - i.e. mapping the device ref to it's purpose - should be strored in ini file?

    Most examples operate based on device name string (i.e. check if word "basic" is in device name) - but it breaks when user renames the device.
    Example: BLLAN plugin - if I change the device location it stops monitoring the computer connection...

    HS3 SDK documentation says:
    • At startup, get a DeviceEnumerator object and process all of the devices in the system.
    • Examine the device, and if the interface property is set to the name of your plug-in, then examine the IOMISC property to determine the type of device it is for your plug-in
    Sounds good, but I couldn't find any reference to IOMISC in any of the samples including official HS samples.

    [EDIT] Ok, found PlugExtraData_Get, so I guess I should be using EDO?

    Please advise
    Last edited by alexbk66; November 9th, 2018, 06:28 AM.

  • #2
    You can store information anywhere you wish - INI file, PED/EDO, other data structure or whatever. I think in most of my plugins over time I have done different things. For some devices then I have made use of the device code and address, so I might have a unique ID as the code and then 'status' as the address. The only reason I do that is that query by device address/code is already built into HS rather than if you store them in some database or the like and then you would have to create a routine to query and retrieve what reference is what device.
    My Plugins:

    Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
    Yeelight 3P | Nanoleaf 3P

    Comment


    • #3
      Originally posted by alexbk66 View Post
      Hi All. I start learning HS plugin writing (C#) based on alexdresko/HSPI_MoskusSample/HSPI_HikAlarmCheck code.
      What I don't seen to get - different device creation scenarios and how to handle them in the plugin:
      1. Pluging starts first time - it creates devices in HS. So now HS keeps track of the devices and
      2. next time plugin loads - it should get list of the devices from HS (by enumerating all devices and checking interface name).

      So far so good. But it's possible that the user changes in HS device location, name, type, etc. So my plugin can safely rely only on the device reference numbers? But then how do I know what device is what? Does it mean that device configuration - i.e. mapping the device ref to it's purpose - should be strored in ini file?

      Most examples operate based on device name string (i.e. check if word "basic" is in device name) - but it breaks when user renames the device.
      Example: BLLAN plugin - if I change the device location it stops monitoring the computer connection...

      HS3 SDK documentation says:
      • At startup, get a DeviceEnumerator object and process all of the devices in the system.
      • Examine the device, and if the interface property is set to the name of your plug-in, then examine the IOMISC property to determine the type of device it is for your plug-in
      Sounds good, but I couldn't find any reference to IOMISC in any of the samples including official HS samples.

      [EDIT] Ok, found PlugExtraData_Get, so I guess I should be using EDO?

      Please advise
      Interface should be set your plugin, then you can use the address field to give you more context if needed...

      Comment


      • #4
        "Address" field sounds good as it looks 'readonly' so user can't change it. Any other fields can be made readonly?
        Location/Cote/Type can be changed...

        Comment


        • #5
          BTW, https://forums.homeseer.com/forum/ho...-plugextradata

          Comment


          • #6
            The PED is good for storing information about your device once you have discovered which devices are yours. Since it's an extra set of objects and data that has to be remoted from the HS system, I do not recommend you use it to determine IF its one of your devices, use it store whatever you need after you've made that determination.

            Comment


            • #7
              Originally posted by bsobel View Post
              The PED is good for storing information about your device once you have discovered which devices are yours. Since it's an extra set of objects and data that has to be remoted from the HS system, I do not recommend you use it to determine IF its one of your devices, use it store whatever you need after you've made that determination.
              That's exactly what this quoted post is about

              Comment

              Working...
              X