diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index bcf3e554..bde8d9a1 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -4699,14 +4699,25 @@ function GenerateAlarmPage(page: PageAlarm): Payload[] { out_msgs.push({ payload: 'pageType~cardAlarm' }); let nsPath = NSPanel_Alarm_Path + 'Alarm.'; - if (existsState(nsPath + 'AlarmPin') == false || existsState(nsPath + 'AlarmState') == false || existsState(nsPath + 'AlarmType') == false || existsState(nsPath + 'PIN_Failed') == false || existsState(nsPath + 'PANEL') == false) { - createState(nsPath + 'AlarmPin', '0000', { type: 'string' }, function () { setState(nsPath + 'AlarmPin', '0000') }); - createState(nsPath + 'AlarmState', 'disarmed', { type: 'string' }, function () { setState(nsPath + 'AlarmState', 'disarmed') }); - createState(nsPath + 'AlarmType', 'D1', { type: 'string' }, function () { setState(nsPath + 'AlarmType', 'D1') }); - createState(nsPath + 'PIN_Failed', 0, { type: 'number' }, function () { setState(nsPath + 'PIN_Failed', 0) }); - createState(nsPath + 'PANEL', NSPanel_Path, { type: 'string' }, function () { setState(nsPath + 'PANEL', NSPanel_Path) }); + if (isSetOptionActive) { + if (existsState(nsPath + 'AlarmPin') == false || existsState(nsPath + 'AlarmState') == false || existsState(nsPath + 'AlarmType') == false || existsState(nsPath + 'PIN_Failed') == false || existsState(nsPath + 'PANEL') == false) { + createState(nsPath + 'AlarmPin', '0000', { type: 'string' }, function () { setState(nsPath + 'AlarmPin', '0000') }); + createState(nsPath + 'AlarmState', 'disarmed', { type: 'string' }, function () { setState(nsPath + 'AlarmState', 'disarmed') }); + createState(nsPath + 'AlarmType', 'D1', { type: 'string' }, function () { setState(nsPath + 'AlarmType', 'D1') }); + createState(nsPath + 'PIN_Failed', 0, { type: 'number' }, function () { setState(nsPath + 'PIN_Failed', 0) }); + createState(nsPath + 'PANEL', NSPanel_Path, { type: 'string' }, function () { setState(nsPath + 'PANEL', NSPanel_Path) }); + if (autoCreateAlias) { + setObject(AliasPath + 'Alarm', {type: 'channel', common: {role: 'sensor.alarm.fire', name:'Alarm'}, native: {}}); + await createAliasAsync(AliasPath + 'Alarm.ACTUAL', nsPath + 'AlarmState', true, { type: 'string', role: 'state', name: 'ACTUAL' }); + await createAliasAsync(AliasPath + 'Alarm.PIN', nsPath + 'AlarmPin', true, { type: 'string', role: 'state', name: 'PIN' }); + await createAliasAsync(AliasPath + 'Alarm.TYPE', nsPath + 'AlarmType', true, { type: 'string', role: 'state', name: 'TYPE' }); + await createAliasAsync(AliasPath + 'Alarm.PIN_Failed', nsPath + 'PIN_Failed', true, { type: 'string', role: 'state', name: 'PIN_Failed' }); + await createAliasAsync(AliasPath + 'Alarm.PANEL', nsPath + 'PANEL', true, { type: 'string', role: 'state', name: 'PANEL' }); + } + } } + if (existsState(nsPath + 'AlarmPin') && existsState(nsPath + 'AlarmState') && existsState(nsPath + 'AlarmType')) { //let entityPin = getState(nsPath + 'AlarmPin').val; let entityState = getState(nsPath + 'AlarmState').val;