Closed wvuyk closed 5 years ago
You can set a Label to a StatusGraphic which will be displayed as the status:
statusGraphic = new StatusGraphic(ImagesStatusDir + "fan-state-off.png", 0);
statusGraphic.Label = "Off";
HS.AddStatusGraphicToFeature(featRef, statusGraphic);
I don't think it works yet for events, but this is the idea.
Ok, missed the label field on the statusgraphic. But that indeed does not help the users to choose a 'logical' status description in their events. So i hope there will be a solution created for that?
I think the event engine has not been adapted yet for this new label, but you're right users should be able to select logical status description in their events. I will make sure this problem doesn't slip through the cracks.
Ok, missed the label field on the statusgraphic. But that indeed does not help the users to choose a 'logical' status description in their events. So i hope there will be a solution created for that?
Correct. This is a bug in the current implementation of the trigger type. We are working on addressing this issue so the StatusControls and StatusGraphics are queried correctly to display the expected list of options to the user.
I am trying to get to use the statusgraphic as a fake status only object, but I cannot set decimalplaces to the object as well as suffix and/of prefixes. It is of no good use yet as replacement for statusonly replacements.
Also, using the label does not add this label visually in the device list. So how can I proceed on this as my plugin is using a lot of sensors, and thus uses the 'statusonly' states a lot. There is no way I can test this now?
Also in Controls.EControlType there is still a statusonly (1) value present. But when used it throws an error, guess this has to be removed still? Although I do think that using this statusonly control would make coding with the prefix/suffix and decimalplace the logical place?
How come this became out of scope? It is missing functionality that is needed for events?
How come this became out of scope? It is missing functionality that is needed for events?
It just means the problem is not in the PluginSDK but in HS4 itself. I have created a bug in our internal bug tracker for this issue.
A "status only" control (as used in HS3) can be defined using a StatusGraphic
.
You can set the prefix, suffix, decimal places, and offset through the StatusGraphic.TargetRange property. This is a ValueRange type. If the StatusGraphic
only targets a single value, set the Label
to the desired status as a static state instead of relying on a prefix, suffix, etc to dynamically generate the status.
For example, in the Z-Wave plugin a motion sensor uses the following StatusGraphic
for a static state:
statusGraphic = New StatusGraphic("/images/HomeSeer/status/nomotion.png", 0, "No Motion")
And a battery feature uses the following StatusGraphic
for a range of values:
statusGraphic = New StatusGraphic("/images/HomeSeer/status/battery_50.png", 37, 64)
statusGraphic.TargetRange.Suffix = "%"
Jon,
I tested this and indeed, I must have overlooked the StatusGraphic.TargetRange
at first glances of using this class. Or was this the result of solving the bug you mentioned earlier?
I now also can find it back in the events creation (although there are some real challenges creating an event - other issue I guess).
Guess this issue can be closed?
Noting for internal use that some of this content should be moved over to the core documentation to help other users.
My plugin holds a lot of sensors, which only set status, but cannot be controlled, like motion sensors, temperature sensors etc.. Also switches set a status as "pressed" or similar, but cannot be controlled.
With the new statuscontrol class it is no longer to set a status-only attribute.
According to this page in the plugin SDK documentation this is removed deliberatly?
Why is this done? And more important, how to use the status then? Users tend to act on the sensors with events.
IF My Motion sensor changes to Motion THEN Set MyLight to On
Becomes
IF My Motion sensor changes to 100 <=== we hope.... THEN Set MyLight to On
Which is not really a user friendly solution. A workaround could be to use the statuscontrol anyway and just do nothing when the user presses the button? Which is not user friendly again... and a lot of work for the plugin to exclude the buttons......
How can we resolve this missing part?