Fix response_code 5 error due to firmware update
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8806a816ef
commit
66e91e2ecd
@ -53,7 +53,7 @@ class Yamaha:
|
|||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
raise ApiInvalidResponseError()
|
raise ApiInvalidResponseError()
|
||||||
|
|
||||||
if r_json['response_code'] != 0:
|
if r_json['response_code'] != 0 and r_json['response_code'] != 5:
|
||||||
raise ApiError(r.url, r_json['response_code'])
|
raise ApiError(r.url, r_json['response_code'])
|
||||||
return r_json
|
return r_json
|
||||||
|
|
||||||
@ -99,6 +99,8 @@ class Yamaha:
|
|||||||
self.request(Zone().set_volume('main', param, ''))
|
self.request(Zone().set_volume('main', param, ''))
|
||||||
|
|
||||||
r = self.request(Zone().get_status('main'))
|
r = self.request(Zone().get_status('main'))
|
||||||
|
if r['response_code'] != 0:
|
||||||
|
return
|
||||||
|
|
||||||
self._client.publish('yamaha/stat/volume', r['volume'])
|
self._client.publish('yamaha/stat/volume', r['volume'])
|
||||||
self._client.publish('yamaha/stat/volume/max', r['max_volume'])
|
self._client.publish('yamaha/stat/volume/max', r['max_volume'])
|
||||||
@ -113,6 +115,8 @@ class Yamaha:
|
|||||||
self.request(Zone().set_power('main', 'standby'))
|
self.request(Zone().set_power('main', 'standby'))
|
||||||
|
|
||||||
r = self.request(Zone().get_status('main'))
|
r = self.request(Zone().get_status('main'))
|
||||||
|
if r['response_code'] != 0:
|
||||||
|
return
|
||||||
state = r['power']
|
state = r['power']
|
||||||
state = 'off' if state == 'standby' else state
|
state = 'off' if state == 'standby' else state
|
||||||
self._client.publish('yamaha/stat/power', state)
|
self._client.publish('yamaha/stat/power', state)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user