sebbo2002 / node-pyatv

A lightweight node.js wrapper around pyatv…
MIT License
26 stars 2 forks source link

fix(core): fix unintentional event trigger #301

Closed maxileith closed 6 months ago

maxileith commented 6 months ago

Currently, if atvscript is reporting {"result": "success", "datetime": "xxx", "volume": 0.0}, all events but volume are triggered, since volume is not catched as a special case. The reason is that the condition newState.volume is false for 0.0. Therefore, the condition should be newState.volume !== null.

https://github.com/sebbo2002/node-pyatv/blob/478f2ddb97af0dc2e4ffa417aecacbbf76d22ab3/src/lib/device-events.ts#L59-L63

[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] Wohnzimmer (A8:51:AB:02:4D:6F): Rocket Remote: set_output_devices=82091D04-8D8E-4CF8-8FAA-4B7FC9979EB9
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] stdout: {"result": "success", "datetime": "2024-01-16T00:55:45.836461+01:00", "volume": 0.0}
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] > {"result": "success", "datetime": "2024-01-16T00:55:45.836461+01:00", "volume": 0.0}
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No hash value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No mediaType value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No deviceState value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No title value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No artist value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No album value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No genre value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No totalTime value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No position value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No shuffle value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No repeat value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No app value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No appId value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No powerState value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] CustomPyATVInstance: [node-pyatv][30] No focusState value found in input ({"result":"success","datetime":"2024-01-16T00:55:45.836461+01:00","volume":0})
[1/16/2024, 12:55:45 AM] [Apple TV Enhanced] Wohnzimmer (A8:51:AB:02:4D:6F): event mediaType: null

About this Pull Request

Pull Request Checklist

sebbo2002 commented 6 months ago

:tada: This PR is included in version 7.3.0-develop.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

sebbo2002 commented 5 months ago

:tada: This PR is included in version 7.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: