mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 15:04:24 +01:00
Get dp from NSPanelSendTopic
This commit is contained in:
@@ -204,7 +204,6 @@ let Debug: boolean = false;
|
|||||||
// EN: Adapt to the MQTT adapter instance directories
|
// EN: Adapt to the MQTT adapter instance directories
|
||||||
const NSPanelReceiveTopic: string = 'mqtt.0.SmartHome.NSPanel_1.tele.RESULT';
|
const NSPanelReceiveTopic: string = 'mqtt.0.SmartHome.NSPanel_1.tele.RESULT';
|
||||||
const NSPanelSendTopic: string = 'mqtt.0.SmartHome.NSPanel_1.cmnd.CustomSend';
|
const NSPanelSendTopic: string = 'mqtt.0.SmartHome.NSPanel_1.cmnd.CustomSend';
|
||||||
NSPanelStateTopic = 'mqtt.0.SmartHome.NSPanel_1.stat'
|
|
||||||
|
|
||||||
// DE: nur ändern, falls der User im Tasmota vor dem Kompilieren umbenannt wurde (Standard Tasmota: admin)
|
// DE: nur ändern, falls der User im Tasmota vor dem Kompilieren umbenannt wurde (Standard Tasmota: admin)
|
||||||
// EN: only change if the user was renamed in Tasmota before compiling (default Tasmota: admin)
|
// EN: only change if the user was renamed in Tasmota before compiling (default Tasmota: admin)
|
||||||
@@ -972,9 +971,6 @@ let weatherForecast: boolean;
|
|||||||
let pageCounter: number = 0;
|
let pageCounter: number = 0;
|
||||||
let alwaysOn: boolean = false;
|
let alwaysOn: boolean = false;
|
||||||
|
|
||||||
var NSPanelStateTopic = NSPanelStateTopic !== undefined ? NSPanelStateTopic : ''
|
|
||||||
|
|
||||||
|
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const dayjs = require('dayjs');
|
const dayjs = require('dayjs');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
@@ -1730,18 +1726,17 @@ on({id: [String(NSPanel_Path) + 'Config.Dateformat.Switch.weekday',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Set Relays from Tasmota
|
//Set Relays from Tasmota
|
||||||
if (NSPanelStateTopic != '') {
|
const NSPanelStatTopic = NSPanelSendTopic.replace('.tele.','.stat.').replace('.CustomSend','.');
|
||||||
on({id: [String(NSPanelStateTopic) + '.POWER1',String(NSPanelStateTopic) + '.POWER2'], change: "ne"}, (obj) => {
|
on({id: [String(NSPanelStatTopic) + 'POWER1',String(NSPanelStatTopic) + 'POWER2'], change: "ne"}, (obj) => {
|
||||||
if (!obj || !obj.id) return
|
if (!obj || !obj.id) return
|
||||||
const n = obj.id.substring(obj.id.length-1);
|
const n = obj.id.substring(obj.id.length-1);
|
||||||
if ( n === '1' || n === '2') {
|
if ( n === '1' || n === '2') {
|
||||||
if (getState(NSPanel_Path + 'Relay.' + n).val != obj.state.val) {
|
if (getState(NSPanel_Path + 'Relay.' + n).val != obj.state.val) {
|
||||||
setState(NSPanel_Path + 'Relay.' + n, obj.state.val == 'ON' ? true : false, true);
|
setState(NSPanel_Path + 'Relay.' + n, obj.state.val == 'ON' ? true : false, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
//Control Relays from DP's
|
//Control Relays from DP's
|
||||||
on({id: [String(NSPanel_Path) + 'Relay.1',String(NSPanel_Path) + 'Relay.2'], change: "ne", ack: false}, async function (obj) {
|
on({id: [String(NSPanel_Path) + 'Relay.1',String(NSPanel_Path) + 'Relay.2'], change: "ne", ack: false}, async function (obj) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user