Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubActionTypeNames missing? #69

Closed
wvuyk opened this issue Jan 11, 2020 · 7 comments
Closed

SubActionTypeNames missing? #69

wvuyk opened this issue Jan 11, 2020 · 7 comments
Assignees

Comments

@wvuyk
Copy link

wvuyk commented Jan 11, 2020

I am trying to get the actIons and subactions to work in HS4. But although I do find a "SelectedSubActionIndex" property, I cannot set the names with something like "SubActionTypeNames". How should this work?

For triggers creating a list for "SubTriggerTypeNames" works fine, but it seems to be missing for actions?

@wvuyk
Copy link
Author

wvuyk commented Jan 15, 2020

Anyone cheking in now and then on the issues here? This one is a show stopper for the conversion of action for my plugin?

@jldubz
Copy link
Collaborator

jldubz commented Jan 21, 2020

You will have to handle SubActionTypeNames manually. The HS3 code has SubTriggerTypes integrated directly into the workflow, but Actions were never completely integrated in the same way. The SelectedSubActionIndex is for backward compatibility only right now because that information would otherwise be lost. The documentation will need to be updated to properly reflect this. Your best bet is to ignore it and manually handle it like another select list on your page because it is not processed automatically like the Triggers are.

@jldubz jldubz closed this as completed Jan 21, 2020
@jldubz jldubz self-assigned this Jan 21, 2020
@wvuyk
Copy link
Author

wvuyk commented Jan 21, 2020

Are you really saying it is not to be converted? Suggesting we leave users hanging on this offering NO conversion of their events?

image
I never did anything special to list of names like above.other then creating the list in the plugin, HS3 did this! And I need it to convert for users..... unless you like to offer no conversion of their events?

Cannot be for real you are just closing issues like this?

@jldubz
Copy link
Collaborator

jldubz commented Jan 21, 2020

@wvuyk

There was no suggestion to leave users hanging in any way; so I'm not understanding your position here. There is no functionality to convert from the perspective of the SDK.

Sub-Actions were never implemented in the same way as Sub-Triggers as is evident by the existence of legacy members like ReadOnly Property SubTriggerName(ByVal TriggerNumber As Integer, ByVal SubTriggerNumber As Integer) As String and ReadOnly Property SubTriggerCount(ByVal TriggerNumber As Integer) As Integer but no matching members for Actions like SubActionName() or SubActionCount(). Any name matching you were doing was being performed by your plugin and not automatically by the HomeSeer platform.

I have done exactly what I am recommending for the Z-Wave plugin, and have run into no issues with it as a solution. Unless you are converting a legacy action you should be ignoring the SelectedSubActionIndex and implementing it manually as a select list on your configuration page as it is not handled by the ActionTypeCollection. During conversion, I query the SelectedSubActionIndex to identify which item is selected in the SelectList for the sub actions. In all other situations, I ignore the property because I handle it manually through the OnConfigItemUpdate() when I process changes for that SelectList. I am happy to share example code for you if you need it.

I closed this issue because there is no action item for it in terms of development necessary within the SDK at this time. The functionality was ported exactly as it was and verified to be working as expected. This is an improvement that we can look at moving forward; at which time we can reopen the issue.

@wvuyk
Copy link
Author

wvuyk commented Jan 21, 2020

@jldubz , Jon,

Here is all the code I needed in the hs3 version to show the magic window I posted in my earlier post:

`Region "Action Properties"

Sub SetActions()
    Dim o As Object = Nothing
    If actions.Count = 0 Then
        actions.Add(o, "JowiHue Actions")
        'actions.Add(o, "Set Scene")
        'actions.Add(o, "Start Animation")
        'actions.Add(o, "Stop running Animation")
    End If
End Sub

Sub SetSubActions()
    Dim o As Object = Nothing
    If subactions.Count = 0 Then
        subactions.Add(o, "(select an action)")
        subactions.Add(o, "Set Lights")
        subactions.Add(o, "Set Scene")
        subactions.Add(o, "Start Animation")
        subactions.Add(o, "Stop running Animation")
        subactions.Add(o, "Pause Polling")
        subactions.Add(o, "Dim running Animation")
    End If
End Sub

Function ActionCount() As Integer
    SetActions()
    Return actions.Count
End Function

ReadOnly Property ActionName(ByVal ActionNumber As Integer) As String
    Get
        SetActions()
        If ActionNumber > 0 AndAlso ActionNumber <= actions.Count Then
            Return IFACE_NAME & ": " & actions.Keys(ActionNumber - 1)
        Else
            Return ""
        End If
    End Get
End Property

ReadOnly Property SubActionName(ByVal SubActionNumber As Integer) As String
    Get
        SetSubActions()
        If SubActionNumber > 0 AndAlso SubActionNumber <= subactions.Count Then
            Return subactions.Keys(SubActionNumber - 1)
        Else
            Return ""
        End If
    End Get
End Property

`

All entries were prepared in the sample plugin for HS3. This resulted in the above image, which I did not have to program other then catching the SubActionNumber.
When I use the current AbstractActionType the pluginSDK is offering, there is no way I can offer the same actionsubtypes to the user, let alone convert it. I have no knowledge on how to display this nor convert this for users.

Really, the plugin here is ready to show to users, including the conversion, except for this step. In ZWave also subactions are shown in HS3. What is needed other then the above code to use it in HS4?

Wim

@wvuyk
Copy link
Author

wvuyk commented Jan 22, 2020

Had a good night sleep and rechecked again this morning. Went over it several times in the past few weeks. But indeed, found it finally, I created this list myself!
Sorry for that, it was my mistake!

Thanks!

@wvuyk
Copy link
Author

wvuyk commented Jan 23, 2020

@jldubz

I am testing what you described, earlier: Unless you are converting a legacy action you should be ignoring the SelectedSubActionIndex. I am now trying to convert the actions and helas, the SelectedSubActionIndex is always 0. In the HS3 plugin the ActInfo.SubTANumber is set and works fine there. It appears as this number is not copied to SelectedSubActionIndex.

Tried to guestimate the SubTANumber by looking at the fields that are set, but I have a challenge with 3 of the actions as they all contain the same fields, so I really would need this value?

Any suggestions on this?

jldubz added a commit that referenced this issue Mar 3, 2022
Merge in HSPI/plugin-sdk from release/1.4.0.0 to dev

* commit '6cce84830efe7eb08b9d0f59a0c0a5fd88f0542f': (71 commits)
  JLW mark nuspec version as release candidate
  JLW add navigation button to sample plugins
  Removed the & symbol from some documentation
  PSDK-221 JLW ignore ID validation test in AbstractViewTests until there is more clarity on how invalid IDs should be handled. See PSDK-261 for more.
  PSDK-218 Fix InputView date and time implementation
  PSDK-258 JLW add check for invalud Rows on TextAreaView. Update associate unit tests
  PSDK-221 JLW remove invalid unit tests now that the SelectListView Selection property can never be set to an invalid value.
  PSDK-257 JLW add a selection check on set to the SelectListView
  PSDK-259 JLW fix formatting
  PSDK-260 JLW check value on InputView everywhere it is set
  PSDK-259 JLW check name in all InputView constructors
  PSDK-218 JLW add a space to the InputView date and time classes
  PSDK-218 JLW add InputView date and time implementation. DateTime still needs to be done.
  PSDK-234 Fix references to the deprecated AbstractHsDevice.Status in docs. Fix HsFeature.Duplicate() and HsDevice.Duplicate() methods. Fix docs for EProperty.DisplayedStatus and EProperty.StatusString
  PSDK-213 Add ESelectListType.SearchableDropDown select list type.
  Jui/Views/SelectListView.cs edited online with Bitbucket
  PSDK-244 JLW moved updated docs to remarks
  PSDK-192 JLW Add unit tests for AddNamed<TData>, AddUnNamed<TData>, GetNamed<TData>, and GetUnNamed<TData>
  PSDK-138 JLW move TestData class to project root so it can be used by any tests.
  PSDK-240 JLW update RemovedUnNamed documentation
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants