New backup 2025-04-16 16:00:02
This commit is contained in:
parent
d946047f78
commit
a2c481e13c
2 changed files with 38 additions and 16 deletions
|
@ -1,25 +1,47 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
wttr_cache="${HOME}/.cache/wttr.json"
|
hass_weather_cache="${HOME}/.cache/hass_weather.json"
|
||||||
|
|
||||||
if [[ ! $(find "${wttr_cache}" -cmin -60 -print 2>/dev/null) ]]; then
|
if [[ ! $(find "${hass_weather_cache}" -cmin -60 -print 2>/dev/null) ]]; then
|
||||||
if ! ping -w 15 -c 1 wttr.in;then
|
if ! ping -w 15 -c 5 hass.pogmom.me;then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
wttr_json=$(curl --silent wttr.in/Eugene?format=j1)
|
|
||||||
if [ "" != "${wttr_json}" ]; then
|
condition="$(jq -r '.current_condition[0].weatherDesc[0].value' ${hass_weather_cache})"
|
||||||
echo "${wttr_json}" | tee "${wttr_cache}"
|
condition_code="$(jq -r '.current_condition[0].weatherCode' ${hass_weather_cache})"
|
||||||
|
current_temp="$(jq -r '.current_condition[0].temp_F' ${hass_weather_cache})"
|
||||||
|
feels_temp="$(jq -r '.current_condition[0].FeelsLikeF' ${hass_weather_cache})"
|
||||||
|
min_temp="$(jq -r '.weather[0].mintempF' ${hass_weather_cache})"
|
||||||
|
max_temp="$(jq -r '.weather[0].maxtempF' ${hass_weather_cache})"
|
||||||
|
humidity="$(jq -r '.current_condition[0].humidity' ${hass_weather_cache})"
|
||||||
|
updated="$(date -r ${hass_weather_cache} '+%Y-%m-%d, %H:%M')"
|
||||||
|
|
||||||
|
|
||||||
|
jq -n \
|
||||||
|
--arg condition "${condition}" \
|
||||||
|
--arg current_temp "${current_temp}" \
|
||||||
|
--arg feels_temp "${feels_temp}" \
|
||||||
|
--arg min_temp "${min_temp}" \
|
||||||
|
--arg max_temp "${max_temp}" \
|
||||||
|
--arg humidity "${humidity}" \
|
||||||
|
--arg icon "${condition_icon}" \
|
||||||
|
--arg updated "${updated}" \
|
||||||
|
'{condition: $condition,current_temp: $current_temp,feels_temp: $feels_temp,min_temp: $min_temp,max_temp: $max_temp,humidity: $humidity,icon: $icon,updated: $updated}'
|
||||||
|
|
||||||
|
# hass_weather_json=$(hass-cli)
|
||||||
|
if [ "" != "${hass_weather_json}" ]; then
|
||||||
|
echo "${hass_weather_json}" | tee "${hass_weather_cache}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
condition="$(jq -r '.current_condition[0].weatherDesc[0].value' ${wttr_cache})"
|
condition="$(jq -r '.current_condition[0].weatherDesc[0].value' ${hass_weather_cache})"
|
||||||
condition_code="$(jq -r '.current_condition[0].weatherCode' ${wttr_cache})"
|
condition_code="$(jq -r '.current_condition[0].weatherCode' ${hass_weather_cache})"
|
||||||
current_temp="$(jq -r '.current_condition[0].temp_F' ${wttr_cache})"
|
current_temp="$(jq -r '.current_condition[0].temp_F' ${hass_weather_cache})"
|
||||||
feels_temp="$(jq -r '.current_condition[0].FeelsLikeF' ${wttr_cache})"
|
feels_temp="$(jq -r '.current_condition[0].FeelsLikeF' ${hass_weather_cache})"
|
||||||
min_temp="$(jq -r '.weather[0].mintempF' ${wttr_cache})"
|
min_temp="$(jq -r '.weather[0].mintempF' ${hass_weather_cache})"
|
||||||
max_temp="$(jq -r '.weather[0].maxtempF' ${wttr_cache})"
|
max_temp="$(jq -r '.weather[0].maxtempF' ${hass_weather_cache})"
|
||||||
humidity="$(jq -r '.current_condition[0].humidity' ${wttr_cache})"
|
humidity="$(jq -r '.current_condition[0].humidity' ${hass_weather_cache})"
|
||||||
updated="$(date -r ${wttr_cache} '+%Y-%m-%d, %H:%M')"
|
updated="$(date -r ${hass_weather_cache} '+%Y-%m-%d, %H:%M')"
|
||||||
|
|
||||||
case "${condition_code}" in
|
case "${condition_code}" in
|
||||||
113)
|
113)
|
||||||
|
|
|
@ -168,8 +168,8 @@ SetEditor=false
|
||||||
[MainWindow]
|
[MainWindow]
|
||||||
1920x1200 screen: Height=532
|
1920x1200 screen: Height=532
|
||||||
1920x1200 screen: Width=613
|
1920x1200 screen: Width=613
|
||||||
2 screens: Height=488
|
2 screens: Height=1118
|
||||||
2 screens: Width=649
|
2 screens: Width=935
|
||||||
2048x1280 screen: Height=589
|
2048x1280 screen: Height=589
|
||||||
2048x1280 screen: Width=999
|
2048x1280 screen: Width=999
|
||||||
3 screens: Height=1358
|
3 screens: Height=1358
|
||||||
|
|
Loading…
Add table
Reference in a new issue