From dd3ce509680bf3b6a6feb5a3246b6c3c4bf44da6 Mon Sep 17 00:00:00 2001 From: CoreNion Date: Tue, 9 Jan 2024 15:24:24 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BB=E3=83=B3=E3=82=B5=E3=83=BC=E3=81=AB?= =?UTF-8?q?=E6=8E=A5=E7=B6=9A=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84=E3=81=AA?= =?UTF-8?q?=E3=81=84=E6=99=82=E3=81=AE=E3=81=BF=E6=B0=97=E8=B1=A1=E5=BA=81?= =?UTF-8?q?=E3=81=8B=E3=82=89=E6=B0=97=E5=9C=A7=E3=82=92=E5=8F=96=E5=BE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/clock.vue | 2 +- components/status.vue | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/components/clock.vue b/components/clock.vue index 935d4f2..5ce80dd 100644 --- a/components/clock.vue +++ b/components/clock.vue @@ -106,7 +106,7 @@ onMounted(() => { {{ dayjs(timeState).format('YYYY年MM月DD日(ddd)') }} - + * diff --git a/components/status.vue b/components/status.vue index a52482c..4eba982 100644 --- a/components/status.vue +++ b/components/status.vue @@ -139,6 +139,9 @@ onMounted(async () => { * 表示されている天気を更新する */ export async function refleshWeather() { + // センサーのソース + const sensorSourceState = sensorSource(); + // 現在の気圧 const pressureState = pressure(); // 現在の外気温 @@ -152,7 +155,7 @@ export async function refleshWeather() { const weatherOfficeNumberState = weatherOfficeNumber(); // 最新の気象データの時刻を取得 - const latestTime = dayjs(await $fetch < string > ('https://www.jma.go.jp/bosai/amedas/data/latest_time.txt')); + const latestTime = dayjs(await $fetch('https://www.jma.go.jp/bosai/amedas/data/latest_time.txt')); // 最新のJSONファイル名 (3時間ごとに別ファイル) const latestJsonName = `${latestTime.format("YYYYMMDD")}_${(Math.floor(latestTime.hour() / 3) * 3).toString().padStart(2, "0")}.json`; @@ -178,7 +181,9 @@ export async function refleshWeather() { // 最後にある最新の気象データを取得 const latestWeather = Object(Object.values(amedasData).pop()); outTmpState.value = latestWeather.temp[0]; - pressureState.value = latestWeather.pressure[0]; + + if (sensorSourceState.value === "serial" && !(useState('isSerialReady').value)) + pressureState.value = latestWeather.pressure[0]; /* 天気予報のデータの処理 */ const forecastData = Array(data[1]); @@ -213,12 +218,15 @@ export async function refleshWeather() { 接続設定が必要 -
{{ humidityState != null ? humidityState.toFixed(1) : "-" }} +
{{ humidityState != null ? humidityState.toFixed(1) : "-" + }}
-
気圧*
+
+ 気圧{{ sensorSourceState === 'serial' && !isSerialReady ? '*' : '' }} +
{{ pressureState != null ? pressureState.toFixed(1) : "-" }} hPa