Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Block
{{ list=plugin_function 'HomeSeerSamplePlugin' 'MyCustomFunctionArray' ['1'] }}
Custom function array values:<br>
{{ for item in list }}
	Item: {{item}}<br>
{{ end }}

If you want to  use your own class as the returned type, you need to make it Serializable:

Code Block
public class TriggerOptionItem 
	public int Id { get; set; }
	public string Name { get; set; }

	public TriggerOptionItem(int id, string name) {
		Id = id;
		Name = name;

	public TriggerOptionItem() { }

public List<TriggerOptionItem> GetTriggerOption(int numTriggerOptions) 
	var triggerOptions = new List<TriggerOptionItem>();
	for (var i = 1; i <= numTriggerOptions; i++) 
		triggerOptions.Add(new TriggerOptionItem(i, $"Trigger Option {i}"));
	return triggerOptions;

To use the properties of your class in your html file:

Code Block
{{ list2=plugin_function 'HomeSeerSamplePlugin' 'GetTriggerOption' [2] }}
{{ for item in list2 }}
<div class="jui-view jui-toggle">
	<label class="jui-toggle-text" for="{{ }}">{{ }}</label>
	<span class="jui-toggle-control"><span class="form-check form-check-inline jui-toggle-checkbox"><input type="checkbox" class="form-check-input jui-input" id="{{ }}"/> <label class="form-check-label jui-toggle-checkbox-label" for="{{ }}"></label></span></span>
{{ end }}


The definition of the serializable class needs to be in the plugin exe, located in the HS root folder.