Skip to content

Commit

Permalink
fix: handle empty light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
janwo committed Sep 23, 2023
1 parent b57b52c commit 778b694
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
with:
args: |
--armhf \
--armv7 \
--amd64 \
--i386 \
--target smartblueberry
7 changes: 4 additions & 3 deletions smartblueberry/backend/plugins/homeassistant/modules/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,10 @@ async function getAreaLightMode(server: hapi.Server, areaId: string) {
return undefined
}

const lightModes = await server.plugins.storage.get<{
[key: string]: LightMode
}>('light/modes')
const lightModes =
(await server.plugins.storage.get<{
[key: string]: LightMode
}>('light/modes')) || []
const lightMode = Object.values(lightModes).find(
({ name }) => name == lightModeEntity?.state
)
Expand Down
1 change: 1 addition & 0 deletions smartblueberry/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"image": "janwo/smartblueberry-{arch}",
"arch": [
"armhf",
"armv7",
"amd64",
"i386"
],
Expand Down
2 changes: 1 addition & 1 deletion smartblueberry/frontend/src/app/setup/setup.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h2 i18n>Long-Lived Connection to Home Assistant</h2>
<div class="control">
<button
[disabled]="
!haService.isGloballyConnected() && haService.isSupervised()
!haService.isGloballyConnected() || haService.isSupervised()
"
i18n
type="submit"
Expand Down

0 comments on commit 778b694

Please sign in to comment.