diff --git a/.github/workflows/publish-latest.yml b/.github/workflows/publish-latest.yml new file mode 100644 index 0000000..123711b --- /dev/null +++ b/.github/workflows/publish-latest.yml @@ -0,0 +1,37 @@ +name: Publish Docker image + +on: + push: + branches: + - main + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: yusijs + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: yusijs/homely-mqtt + tags: | + type=sha + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }},yusijs/homely-mqtt:dev + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/config/local.yml b/config/local.yml index 77a51e3..1dfa77f 100644 --- a/config/local.yml +++ b/config/local.yml @@ -12,7 +12,7 @@ database: mqtt: # Set to false to disable mqtt. This will log all messages to the console. # Useful for testing the setup. - enabled: true + enabled: false qos: 1 host: mqtt://192.168.86.38:1883 user: homely diff --git a/index.ts b/index.ts index dde3eef..501ac1e 100644 --- a/index.ts +++ b/index.ts @@ -83,11 +83,16 @@ async function updateAndCreateEntities(homeData: Home) { await init(); const homes = await locations(); logger.info(`Loaded ${homes.length} homes`); + logger.debug(homes); - for (const location of homes) { - const homeData = await home(location.locationId); - await updateAndCreateEntities(homeData); - await pollHomely(location.locationId); - await listenToSocket(location.locationId); + try { + for (const location of homes) { + const homeData = await home(location.locationId); + await updateAndCreateEntities(homeData); + await pollHomely(location.locationId); + await listenToSocket(location.locationId); + } + } catch (ex) { + logger.fatal(ex); } })();