Announcement

Collapse
No announcement yet.

Are there some first off opinions about how to manage Media devices?

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

    #31
    Originally posted by spud View Post

    Here a C# example that clear all StatusControl and StatusGraphic for a feature and recreate them:

    Code:
    private void UpdateSCSGForStatusFeature(int featRef)
    {
    _hs.ClearStatusControlsByRef(featRef);
    _hs.ClearStatusGraphicsByRef(featRef);
    
    StatusControl statusControl = new StatusControl(EControlType.Button);
    statusControl.TargetValue = 0;
    statusControl.Label = "Off";
    statusControl.ControlUse = EControlUse.Off;
    _hs.AddStatusControlToFeature(featRef, statusControl);
    
    statusControl = new StatusControl(EControlType.Button);
    statusControl.TargetValue = 1;
    statusControl.Label = "On";
    statusControl.ControlUse = EControlUse.On;
    _hs.AddStatusControlToFeature(featRef, statusControl);
    
    StatusGraphic statusGraphic = new StatusGraphic(ImagesStatusDir + "alarm.png" , -1);
    statusGraphic.Label = "Unreachable";
    _hs.AddStatusGraphicToFeature(featRef, statusGraphic);
    }
    Spud,

    Thanks! I was looking on HSfeature level as well as on FeatureFactory - which only can crate stuff and as such is not reusable. Back to plain HS level.

    Also PROGRESS!!! here. Clear to me now. Double Thanks!

    Wim
    -- Wim

    Plugins:RFXCOM, HSTouch Server, Squeezebox, BLGData, Restart, Jon00's Perfmon and Network monitor, WeatherXML, BLBackup, TenScripting, BC4, Pushover, PHLocation, JowiHue, Zwave, Sonos
    650 devices ---- 336 events ----- 40 scripts

    Comment


      #32
      rjh More progress but also getting seriously stuck

      Rich, how do I get to things like these features? Should they show up somewhere on the UI?

      Code:
                      Dim ff As FeatureFactory
      
                      ff = FeatureFactory.CreateFeature(Id)
                      ff.WithName("Genre")
                      ff.AsType(HomeSeer.PluginSdk.Devices.Identification.EFeatureType.Media, HomeSeer.PluginSdk.Devices.Identification.EMediaFeatureSubType.MediaGenre)
                      Dim genre As SortedDictionary(Of String, Double) = New SortedDictionary(Of String, Double)()
                      genre.Add("Pop", 0)
                      ff.AddTextDropDown(genre)
                      df.WithFeature(ff)
      
                      ff = FeatureFactory.CreateFeature(Id)
                      ff.WithName("Artists")
                      ff.AsType(HomeSeer.PluginSdk.Devices.Identification.EFeatureType.Media, HomeSeer.PluginSdk.Devices.Identification.EMediaFeatureSubType.MediaArtist)
                      Dim artists As SortedDictionary(Of String, Double) = New SortedDictionary(Of String, Double)()
                      artists.Add("U2", 0)
                      ff.AddTextDropDown(artists)
                      df.WithFeature(ff)
      Secondly, only the volume slider seem to generate SetMultiIO call backs all other buttons/controls don't seem to do anything. Suggestions? This is how it looks now: Click image for larger version  Name:	Devices.png Views:	0 Size:	255.0 KB ID:	1328587

      Comment


        #33
        For those who are coding as we speak and most likely struggle with the same ....
        If I follow the provided code
        Code:
                        ff = FeatureFactory.CreateFeature(Id)
                        ff.WithName("Artists")
                        ff.AsType(HomeSeer.PluginSdk.Devices.Identification.EFeatureType.Media, HomeSeer.PluginSdk.Devices.Identification.EMediaFeatureSubType.MediaArtist)
                        Dim artists As SortedDictionary(Of String, Double) = New SortedDictionary(Of String, Double)()
                        artists.Add("U2", 0)
                        artists.Add("U3", 0)
                        ff.AddTextDropDown(artists)
                        df.WithFeature(ff)
        
                        ff = FeatureFactory.CreateFeature(Id)
                        ff.WithName("Albums")
                        ff.AsType(HomeSeer.PluginSdk.Devices.Identification.EFeatureType.Media, HomeSeer.PluginSdk.Devices.Identification.EMediaFeatureSubType.MediaAlbum)
                        Dim albums As SortedDictionary(Of String, Double) = New SortedDictionary(Of String, Double)()
                        albums.Add("Some Album", 0)
                        ff.AddTextDropDown(albums)
                        df.WithFeature(ff)
        What I notice is that for each FeatureFactory you add to a DeviceFactory (the example above has 2 of them), it appears that each Feature (Factory) will end up with its own unique FeatureRef. This reference is passed in SetMultiIO. However, if you follow the provide code example above, you would not know what the assigned references are and you can't refer events to what feature it belonged to. Of course, It could be that I just don't know where to get the reference.

        If you first create a device and follow this code
        Code:
                        ff = FeatureFactory.CreateFeature(Id)
                        ff.WithName("Player Status")
                        ff.AsType(HomeSeer.PluginSdk.Devices.Identification.EFeatureType.Media, HomeSeer.PluginSdk.Devices.Identification.EMediaFeatureSubType.PlayerStatus)
                        '// At this point we want to make the player status the primary device. This API Is Not yet available.
                        Dim fd As NewFeatureData = ff.PrepareForHsDevice(HSRef)
                        HSFeatureRef = HomeSeerSystem.CreateFeatureForDevice(fd)
        You will have the reference to work with. So to the HS team rjh what am I doing wrong?




        Secondly, I found the answer to my question above here about what happened to all the features, it appears I need to switch views like this:

        Click image for larger version

Name:	device1.png
Views:	57
Size:	226.2 KB
ID:	1328601

        and then buttons seem to work.



        In this view:

        Click image for larger version

Name:	device2.png
Views:	35
Size:	103.6 KB
ID:	1328602

        Only the slider seems to work.

        Dirk

        Comment

        Working...
        X