This commit is contained in:
@@ -131,7 +131,8 @@ async function getBrightness(host, port) {
|
||||
const res = await soapWithFallback(host, port, BE_URL, BE_SVC, 'GetBinaryState');
|
||||
const raw = String(res['BinaryState'] ?? '0');
|
||||
|
||||
console.log(`[DWM] Raw BinaryState response: "${raw}"`);
|
||||
console.log(`[DWM] Full BinaryState response object:`, res);
|
||||
console.log(`[DWM] Raw BinaryState string: "${raw}"`);
|
||||
|
||||
// For dimmers, check if brightness is available as a separate parameter
|
||||
// This matches the Python pywemo implementation
|
||||
@@ -145,6 +146,7 @@ async function getBrightness(host, port) {
|
||||
// Example: "1|50|0" where 50 is the brightness level (0-100)
|
||||
if (raw.includes('|')) {
|
||||
const parts = raw.split('|');
|
||||
console.log(`[DWM] BinaryState parts:`, parts);
|
||||
if (parts.length >= 2) {
|
||||
const brightness = parseInt(parts[1], 10);
|
||||
console.log(`[DWM] Brightness from pipe format: ${brightness}`);
|
||||
@@ -155,7 +157,7 @@ async function getBrightness(host, port) {
|
||||
// If device is on but no brightness info, assume 100%
|
||||
// If device is off, return 0
|
||||
const isOn = raw === '1' || raw === '8';
|
||||
console.log(`[DWM] No brightness info, using binary state: ${isOn ? 100 : 0}`);
|
||||
console.log(`[DWM] No brightness info, using binary state: ${isOn ? 100 : 0} (raw: "${raw}")`);
|
||||
return isOn ? 100 : 0;
|
||||
} catch (err) {
|
||||
console.log(`[DWM] getBrightness failed: ${err.message}, falling back to binary state`);
|
||||
|
||||
Reference in New Issue
Block a user