christian-photo / ninaAPI

Mozilla Public License 2.0
13 stars 3 forks source link

Switch Info #7

Open JuergenTerpe opened 1 week ago

JuergenTerpe commented 1 week ago

Just a question, maybe room for improvement ...

For switches the data is very limited. I don't have such hardware and it is difficult to understand how it works without having the possibility to test on real devices. When I look at your examples the information is very limited. For writeable switches there is a range (min, max, stepwise) and maybe if the range is just (0,1) with stepszie 1, this could mean this is just a boolean. Otherwise, if the range is larger, this is very likely a normal value, perhaps a controllable power or something like that.

More difficult are readonly switches, because they just provide the current value without a range (just in the description, ugly). Is there a way to get a type, such as an enum to get the type of the value. I just want to have a chance to display something useful to the user. In case of power on/off switches, it is better to show this as an icon and not just as a value 0 for off and 1 for on. If this is impossible, the range min-max could also indicate, that this is just an on/off switch.

Is this information available for the plugin, so it can be added to this result?

"WritableSwitches": [ { "Maximum": 1, "Minimum": 0, "StepSize": 1, "TargetValue": 0, "Id": 9, "Name": "Raining", "Description": "Rain monitor, true if raining", "Value": 0 } ], "DeviceId": "ASCOM.Simulator.Switch", "Name": "ASCOM SwitchV2 Simulator Driver", "ReadonlySwitches": [ { "Id": 0, "Name": "Power1", "Description": "Generic power switch", "Value": 0 }, { "Id": 1, "Name": "Power2", "Description": "Generic Power switch", "Value": 0 }, { "Id": 2, "Name": "Light Box", "Description": "Light box , 0 to 100%", "Value": 0 }, { "Id": 3, "Name": "Flat Panel", "Description": "Flat panel , 0 to 255", "Value": 0 }, { "Id": 4, "Name": "Scope Cover", "Description": "Scope cover control true is closed, false is open", "Value": 0 }, { "Id": 5, "Name": "Scope Parked", "Description": "Scope parked switch, true if parked", "Value": 0 }, { "Id": 6, "Name": "Cloudy", "Description": "Cloud monitor: 0=clear, 1=light cloud, 2= heavy cloud", "Value": 0 }, { "Id": 7, "Name": "Temperature", "Description": "Temperature in deg C", "Value": 12 }, { "Id": 8, "Name": "Humidity", "Description": "Relative humidity %", "Value": 50 } ]

christian-photo commented 1 week ago

Hi, unfortunately the information that is sent, is the only information that is available to the plugin. I think you might need the user to set up the switches manually on the client side :/