Fix Bravia TV options flow when device is off (#81644)

* Fix options flow when tv is off

* abort with message
pull/81784/head
Artem Draft 2022-11-06 23:26:40 +03:00 committed by Franck Nijhof
parent f861137de4
commit 63afb30f57
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
3 changed files with 11 additions and 1 deletions

View File

@ -262,7 +262,11 @@ class BraviaTVOptionsFlowHandler(config_entries.OptionsFlow):
self.config_entry.entry_id
]
await coordinator.async_update_sources()
try:
await coordinator.async_update_sources()
except BraviaTVError:
return self.async_abort(reason="failed_update")
sources = coordinator.source_map.values()
self.source_list = [item["title"] for item in sources]
return await self.async_step_user()

View File

@ -48,6 +48,9 @@
"ignored_sources": "List of ignored sources"
}
}
},
"abort": {
"failed_update": "An error occurred while updating the list of sources.\n\n Ensure that your TV is turned on before trying to set it up."
}
}
}

View File

@ -41,6 +41,9 @@
}
},
"options": {
"abort": {
"failed_update": "An error occurred while updating the list of sources.\n\n Ensure that your TV is turned on before trying to set it up."
},
"step": {
"user": {
"data": {