system.registerSensor¶
since 26.1.3
Register an S.Port sensor definition, so that it gets recognized (name, unit, decimals, protocol min/max) when the sensors Discover finds an appId in this range, instead of falling back to a generic unnamed sensor.
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
params |
table | yes | see the fields below |
Fields of params:
manufacturer(string, optional): restricts this definition to models that have this manufacturer selected (Model / Edit) - omit it to make the definition usable regardless of the model's manufacturer choiceappIdStart(integer): first S.Port appId this definition matchesappIdEnd(integer, optional): last S.Port appId this definition matches (defaults toappIdStart, ie a single appId)name(string): sensor nameunit(integer, optional): sensor unit (UNIT_* constant, defaults to UNIT_NONE)decimals(integer, optional): number of decimals (defaults to 0)min(number, optional): protocol minimum value, in display units (eg 100.0 with 1 decimal is stored as 1000)max(number, optional): protocol maximum value, in display unitsuserMin(number, optional): user-editable minimum value, in display units (defaults tomin)userMax(number, optional): user-editable maximum value, in display units (defaults tomax)onDiscover(function, optional): handler called with the newly created sensor's source, when the sensors Discover creates it
Returns¶
Nothing.
Examples¶
From the official Ethos documentation
system.registerSensor({appIdStart=0x5150, appIdEnd=0x515F, name="My sensor", unit=UNIT_VOLT, decimals=2, min=0, max=42.0})