diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..80afbc0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,53 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: 'main' + +jobs: + build_site: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./frontend + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + run: npm install + + - name: build + env: + BASE_PATH: '/${{ github.event.repository.name }}' + run: | + npm run build + + - name: Upload Artifacts + uses: actions/upload-pages-artifact@v3 + with: + path: 'frontend/dist/' + + deploy: + needs: build_site + runs-on: ubuntu-latest + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index a903f6c..48ddaeb 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -13,7 +13,9 @@ const apiUrl = host == "localhost" || host == "127.0.0.1" ? "http://fritzgate/api/" - : "/api/"; + : host == "vnau.github.io" + ? "/FritzGate/api/" + : "/api/"; //const apiUrl = "/api/"; let data: StatusData; let busy = false; diff --git a/frontend/src/public/api/status b/frontend/src/public/api/status new file mode 100644 index 0000000..f1cdee4 --- /dev/null +++ b/frontend/src/public/api/status @@ -0,0 +1,163 @@ +{ + "sensors": [ + { + "name": "Govee H5075 01CB", + "id": "GVH5075_01CB", + "model": "H5075", + "serial": "01CB", + "battery": 100, + "rssi": -94, + "humidity": 43.4, + "temperature": 22.1, + "temperatureAvg": 22.3, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600 + }, + { + "name": "ThermoPro TP35X/393 B1AB", + "id": "GVH5075_B1AB", + "model": "H5075", + "serial": "B1AB", + "battery": 100, + "rssi": -84, + "humidity": 47.6, + "temperature": 21.8, + "temperatureAvg": 21.8, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600 + }, + { + "name": "SwitchBot THX1/W230150X 34EF", + "id": "GVH5075_34EF", + "model": "H5075", + "serial": "34EF", + "battery": 100, + "rssi": -64, + "humidity": 45.1, + "temperature": 22.4, + "temperatureAvg": 22.4, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600 + }, + { + "name": "Govee H5100 4683", + "id": "GVH5075_4683", + "model": "H5075", + "serial": "4683", + "battery": 100, + "rssi": -78, + "humidity": 51.4, + "temperature": 21.7, + "temperatureAvg": 21.8, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600 + } + ], + "thermostats": [ + { + "name": "Kitchen", + "id": "16", + "model": "FRITZ!DECT 301", + "serial": "23515 0707001", + "battery": 10, + "rssi": 0, + "humidity": 0, + "temperature": 23.5, + "temperatureAvg": 0, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600, + "externalTemperatureSensorId": "tochoose", + "temperatureSensor": "own", + "offset": 1, + "offsetTimestamp": 0, + "targetTemperature": 22, + "targetTemperatureHigh": 22, + "targetTemperatureLow": 19, + "referenceSensor": "GVH5075_4683" + }, + { + "name": "Living room", + "id": "17", + "model": "FRITZ!DECT 301", + "serial": "23515 0707002", + "battery": 30, + "rssi": 0, + "humidity": 0, + "temperature": 23.5, + "temperatureAvg": 0, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600, + "externalTemperatureSensorId": "tochoose", + "temperatureSensor": "own", + "offset": 0, + "offsetTimestamp": 0, + "targetTemperature": 22, + "targetTemperatureHigh": 22, + "targetTemperatureLow": 19, + "referenceSensor": "GVH5075_34EF" + }, + { + "name": "Bedroom", + "id": "18", + "model": "FRITZ!DECT 301", + "serial": "23515 0707003", + "battery": 50, + "rssi": 0, + "humidity": 0, + "temperature": 23, + "temperatureAvg": 0, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600, + "externalTemperatureSensorId": "tochoose", + "temperatureSensor": "own", + "offset": -2.5, + "offsetTimestamp": 1704063600, + "targetTemperature": 22, + "targetTemperatureHigh": 22, + "targetTemperatureLow": 19, + "referenceSensor": "GVH5075_01CB" + }, + { + "name": "Child's room", + "id": "19", + "model": "FRITZ!DECT 301", + "serial": "23515 0707004", + "battery": 70, + "rssi": 0, + "humidity": 0, + "temperature": 22, + "temperatureAvg": 0, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600, + "externalTemperatureSensorId": "tochoose", + "temperatureSensor": "own", + "offset": -2.5, + "offsetTimestamp": 1704063600, + "targetTemperature": 22, + "targetTemperatureHigh": 22, + "targetTemperatureLow": 19, + "referenceSensor": "GVH5075_B1AB" + }, + { + "name": "Bathroom", + "id": "20", + "model": "FRITZ!DECT 301", + "serial": "23515 0707005", + "battery": 90, + "rssi": 0, + "humidity": 0, + "temperature": 20.5, + "temperatureAvg": 0, + "seriesTimestamp": 1704063600, + "timestamp": 1704063600, + "externalTemperatureSensorId": "tochoose", + "temperatureSensor": "own", + "offset": 0, + "offsetTimestamp": 0, + "targetTemperature": 22, + "targetTemperatureHigh": 22, + "targetTemperatureLow": 19, + "referenceSensor": "" + } + ] +} \ No newline at end of file