Skip to content

Commit

Permalink
handle properly older sets power status
Browse files Browse the repository at this point in the history
- while digging #90 and with the awesome help from @tjm7844 who provided
  live access to an affected set it was found that on some older sets
  the TV was returning X_ScreenState with a state ('none') when online
  not yet accounted by the plugin. this is now fixed and those TVs are
  now propperly recognized as ON when they actually are on.

Signed-off-by: António Meireles <antonio.meireles@reformi.st>
  • Loading branch information
AntonioMeireles committed Jan 21, 2022
1 parent 1039d2a commit 301aa34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/viera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ class VieraTV implements VieraTV {
if (properties.X_ScreenState) {
resolve(properties.X_ScreenState === 'on')
} else if (Array.isArray(properties)) {
const match = properties.find((prop) => ['on', 'off'].includes(prop.X_ScreenState))
match ? resolve(match.X_ScreenState === 'on') : resolve(false)
const match = properties.find((prop) =>
['on', 'off', 'none'].includes(prop.X_ScreenState)
)
match ? resolve(match.X_ScreenState !== 'off') : resolve(false)
} else resolve(false)
})
.on('error', () => resolve(false))
Expand Down

0 comments on commit 301aa34

Please sign in to comment.