Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/triggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,23 @@ const GenericEventTrigger = (eventTopic, eventSource, eventTypes, triggerName) =
* });
*
* @memberof triggers
* @param {string} dutycycleItem Item (PercentType) to read the duty cycle from
* @param {Item|string} dutycycleItemOrName the Item or name of the Item (PercentType) to read the duty cycle from
* @param {number} interval constant interval in which the output is switch ON and OFF again (in sec)
* @param {number} [minDutyCycle] any duty cycle below this value will be increased to this value
* @param {number} [maxDutyCycle] any duty cycle above this value will be decreased to this value
* @param {number} [deadManSwitch] output will be switched off, when the duty cycle is not updated within this time (in ms)
* @param {boolean} [equateMinToZero=false] whether the duty cycle below `minDutyCycle` should be set to 0
* @param {boolean} [equateMaxToHundred=true] whether the duty cycle above `maxDutyCycle` should be set to 100
* @param {string} [triggerName] the optional name of the trigger to create
*/
const PWMTrigger = (dutycycleItem, interval, minDutyCycle, maxDutyCycle, deadManSwitch, triggerName) =>
const PWMTrigger = (dutycycleItemOrName, interval, minDutyCycle, maxDutyCycle, deadManSwitch, equateMinToZero = false, equateMaxToHundred = true, triggerName) =>
_createTrigger('pwm.trigger', triggerName, {
dutycycleItem,
dutycycleItem: _isItem(dutycycleItemOrName) ? dutycycleItemOrName.name : dutycycleItemOrName,
interval,
minDutyCycle,
equateMinToZero,
maxDutyCycle,
equateMaxToHundred,
deadManSwitch
});

Expand Down
4 changes: 4 additions & 0 deletions test/triggers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ describe('triggers.js', () => {
minDutyCycle,
maxDutyCycle,
deadManSwitch,
undefined,
undefined,
triggerName
);

Expand All @@ -379,7 +381,9 @@ describe('triggers.js', () => {
dutycycleItem,
interval,
minDutyCycle,
equateMinToZero: false,
maxDutyCycle,
equateMaxToHundred: true,
deadManSwitch
}
})
Expand Down
6 changes: 4 additions & 2 deletions types/triggers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,16 @@ export function DateTimeTrigger(itemOrName: Item | string, timeOnly?: boolean, o
* });
*
* @memberof triggers
* @param {string} dutycycleItem Item (PercentType) to read the duty cycle from
* @param {Item|string} dutycycleItemOrName the Item or name of the Item (PercentType) to read the duty cycle from
* @param {number} interval constant interval in which the output is switch ON and OFF again (in sec)
* @param {number} [minDutyCycle] any duty cycle below this value will be increased to this value
* @param {number} [maxDutyCycle] any duty cycle above this value will be decreased to this value
* @param {number} [deadManSwitch] output will be switched off, when the duty cycle is not updated within this time (in ms)
* @param {boolean} [equateMinToZero=false] whether the duty cycle below `minDutyCycle` should be set to 0
* @param {boolean} [equateMaxToHundred=true] whether the duty cycle above `maxDutyCycle` should be set to 100
* @param {string} [triggerName] the optional name of the trigger to create
*/
export function PWMTrigger(dutycycleItem: string, interval: number, minDutyCycle?: number, maxDutyCycle?: number, deadManSwitch?: number, triggerName?: string): HostTrigger;
export function PWMTrigger(dutycycleItemOrName: Item | string, interval: number, minDutyCycle?: number, maxDutyCycle?: number, deadManSwitch?: number, equateMinToZero?: boolean, equateMaxToHundred?: boolean, triggerName?: string): HostTrigger;
/**
* Creates a trigger for the {@link https://www.openhab.org/addons/automation/pidcontroller/ PID Controller Automation} add-on.
*
Expand Down
2 changes: 1 addition & 1 deletion types/triggers.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.