This commit is contained in:
sebseb7
2025-12-25 05:07:27 +01:00
parent ebfc848c82
commit 8f01f35470
2 changed files with 12 additions and 15 deletions

View File

@@ -163,12 +163,9 @@ class ViewManager extends Component {
const channel = rule.action?.channel || ''; const channel = rule.action?.channel || '';
const emojis = { const emojis = {
'CircFanLevel': '🌀', 'CircFanLevel': '🌀',
'TentLightLevel': '💡',
'TentExhaustLevel': '💨',
'RoomExhaustLevel': '🌬️',
'CO2Valve': '🫧', 'CO2Valve': '🫧',
'BigDehumid': '💧', 'BigDehumid': '💧',
'TentDehumid': '💦' 'TentExhaust': '💨'
}; };
return emojis[channel] || '⚡'; return emojis[channel] || '⚡';
}; };
@@ -200,8 +197,8 @@ class ViewManager extends Component {
} }
return `📅 ${operator} ${value}`; return `📅 ${operator} ${value}`;
case 'sensor': case 'sensor':
const sensorName = channel?.split(':').pop() || channel; // Show device:channel for clarity (e.g. "ac:controller:humidity")
return `📡 ${sensorName} ${op} ${value}`; return `📡 ${channel} ${op} ${value}`;
case 'output': case 'output':
return `⚙️ ${channel} ${op} ${value}`; return `⚙️ ${channel} ${op} ${value}`;
default: default:
@@ -214,12 +211,9 @@ class ViewManager extends Component {
if (!action?.channel) return '?'; if (!action?.channel) return '?';
const channelNames = { const channelNames = {
'CircFanLevel': '🌀 Circ Fan', 'CircFanLevel': '🌀 Circ Fan',
'TentLightLevel': '💡 Tent Light',
'TentExhaustLevel': '💨 Tent Exhaust',
'RoomExhaustLevel': '🌬️ Room Exhaust',
'CO2Valve': '🫧 CO2', 'CO2Valve': '🫧 CO2',
'BigDehumid': '💧 Big Dehumid', 'BigDehumid': '💧 Big Dehumid',
'TentDehumid': '💦 Tent Dehumid' 'TentExhaust': '💨 Tent Exhaust Fan'
}; };
const name = channelNames[action.channel] || action.channel; const name = channelNames[action.channel] || action.channel;
return `${name} = ${action.value}`; return `${name} = ${action.value}`;

View File

@@ -27,6 +27,7 @@ try {
const OUTPUT_BINDINGS = { const OUTPUT_BINDINGS = {
'BigDehumid': { device: 'tapo', channel: 'r0', type: 'switch' }, 'BigDehumid': { device: 'tapo', channel: 'r0', type: 'switch' },
'CO2Valve': { device: 'tapo', channel: 'c', type: 'switch' }, 'CO2Valve': { device: 'tapo', channel: 'c', type: 'switch' },
'TentExhaust': { device: 'tapo', channel: 'fantent', type: 'switch' },
}; };
// ============================================= // =============================================
@@ -526,12 +527,9 @@ module.exports = {
// Virtual output channel definitions // Virtual output channel definitions
const OUTPUT_CHANNELS = [ const OUTPUT_CHANNELS = [
{ channel: 'CircFanLevel', type: 'number', min: 0, max: 10, description: 'Circulation Fan Level' }, { channel: 'CircFanLevel', type: 'number', min: 0, max: 10, description: 'Circulation Fan Level' },
{ channel: 'TentLightLevel', type: 'number', min: 0, max: 10, description: 'Tent Light Level' },
{ channel: 'TentExhaustLevel', type: 'number', min: 0, max: 10, description: 'Tent Exhaust Fan Level' },
{ channel: 'RoomExhaustLevel', type: 'number', min: 0, max: 10, description: 'Room Exhaust Fan Level' },
{ channel: 'CO2Valve', type: 'boolean', min: 0, max: 1, description: 'CO2 Valve' }, { channel: 'CO2Valve', type: 'boolean', min: 0, max: 1, description: 'CO2 Valve' },
{ channel: 'BigDehumid', type: 'boolean', min: 0, max: 1, description: 'Big Dehumidifier' }, { channel: 'BigDehumid', type: 'boolean', min: 0, max: 1, description: 'Big Dehumidifier' },
{ channel: 'TentDehumid', type: 'boolean', min: 0, max: 1, description: 'Tent Dehumidifier' }, { channel: 'TentExhaust', type: 'boolean', min: 0, max: 1, description: 'Tent Exhaust Fan' },
]; ];
// GET /api/outputs - List output channel definitions // GET /api/outputs - List output channel definitions
@@ -855,7 +853,12 @@ module.exports = {
try { try {
const rules = db.prepare('SELECT * FROM rules WHERE enabled = 1 ORDER BY position ASC').all(); const rules = db.prepare('SELECT * FROM rules WHERE enabled = 1 ORDER BY position ASC').all();
const desiredOutputs = {}; // channel -> value
// Default all outputs to OFF (0) - if no rule sets them, they stay off
const desiredOutputs = {};
for (const ch of OUTPUT_CHANNELS) {
desiredOutputs[ch.channel] = 0;
}
for (const rule of rules) { for (const rule of rules) {
try { try {