[AutoDiscovery] Update PluginTemplate

This commit is contained in:
Ton Huisman
2025-06-28 22:05:20 +02:00
parent 9485a01106
commit e4f774edc5
+11 -2
View File
@@ -122,6 +122,7 @@ boolean Plugin_xxx(uint8_t function, struct EventStruct *event, String& string)
dev.TimerOption = false; // Allow to set the "Interval" timer for the plugin.
dev.TimerOptional = false; // When taskdevice timer is not set and not optional, use default "Interval" delay (Settings.Delay)
dev.DecimalsOnly = true; // Allow to set the number of decimals (otherwise treated a 0 decimals)
dev.CustomVTypeVar = false; // Enable to allow the user to configure the Sensor_VType per Value that's available for the plugin
break;
}
@@ -208,9 +209,17 @@ boolean Plugin_xxx(uint8_t function, struct EventStruct *event, String& string)
// configured for the task.
// Per taskvalue you can provide a Sensor_VType value (casted to int) in Par1..Par4, SENSOR_TYPE_NONE == 0, so actually not needed to set
// In event->Par5 is the current value for PLUGIN_GET_DEVICEVALUECOUNT available, so you can loop to set multiple the same VTypes, see P004
// See P052 for an example how to return correct data for a User-selected TaskValue configuration
// See P026 or P052 for an example how to return correct data for a User-selected TaskValue configuration
// See P033 for a user-selected Sensor_VType per Value
// If the DeviceStruct.VType is set to one of the supported VTypes and matches the available values, this function can be ommitted, see P028
event->Par1 = static_cast<int>(Sensor_VType::SENSOR_TYPE_NONE); // Not (yet) supported
# if FEATURE_CUSTOM_TASKVAR_VTYPE // This part should only be used when the user should choose the Sensor_VType setting per value because we can't determine that
for (uint8_t i = 0; i < event->Par5; ++i) {
event->ParN[i] = ExtraTaskSettings.getTaskVarCustomVType(i); // Custom/User selection
}
# else // if FEATURE_CUSTOM_TASKVAR_VTYPE
event->Par1 = static_cast<int>(Sensor_VType::SENSOR_TYPE_NONE); // Select a default Sensor_VType oer value, or let the user choose
# endif // if FEATURE_CUSTOM_TASKVAR_VTYPE
success = true; // To indicate that we have set a value
break;
}