mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-10 02:29:19 +03:00
fix go2rtc homekit handling (#22346)
file needs to be blank if not using homekit, not {}
it seems like go2rtc is not parsing {} as yaml
This commit is contained in:
parent
41e290449e
commit
c4a5ac0e77
@ -55,7 +55,7 @@ function setup_homekit_config() {
|
|||||||
|
|
||||||
if [[ ! -f "${config_path}" ]]; then
|
if [[ ! -f "${config_path}" ]]; then
|
||||||
echo "[INFO] Creating empty config file for HomeKit..."
|
echo "[INFO] Creating empty config file for HomeKit..."
|
||||||
echo '{}' > "${config_path}"
|
: > "${config_path}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Convert YAML to JSON for jq processing
|
# Convert YAML to JSON for jq processing
|
||||||
@ -65,23 +65,25 @@ function setup_homekit_config() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use jq to filter and keep only the homekit section
|
# Use jq to extract the homekit section, if it exists
|
||||||
local cleaned_json="/tmp/cache/homekit_cleaned.json"
|
local homekit_json
|
||||||
jq '
|
homekit_json=$(jq '
|
||||||
# Keep only the homekit section if it exists, otherwise empty object
|
if has("homekit") then {homekit: .homekit} else null end
|
||||||
if has("homekit") then {homekit: .homekit} else {} end
|
' "${temp_json}" 2>/dev/null) || homekit_json="null"
|
||||||
' "${temp_json}" > "${cleaned_json}" 2>/dev/null || {
|
|
||||||
echo '{}' > "${cleaned_json}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Convert back to YAML and write to the config file
|
# If no homekit section, write an empty config file
|
||||||
yq eval -P "${cleaned_json}" > "${config_path}" 2>/dev/null || {
|
if [[ "${homekit_json}" == "null" ]]; then
|
||||||
echo "[WARNING] Failed to convert cleaned config to YAML, creating minimal config"
|
: > "${config_path}"
|
||||||
echo '{}' > "${config_path}"
|
else
|
||||||
}
|
# Convert homekit JSON back to YAML and write to the config file
|
||||||
|
echo "${homekit_json}" | yq eval -P - > "${config_path}" 2>/dev/null || {
|
||||||
|
echo "[WARNING] Failed to convert cleaned config to YAML, creating minimal config"
|
||||||
|
: > "${config_path}"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
# Clean up temp files
|
# Clean up temp files
|
||||||
rm -f "${temp_json}" "${cleaned_json}"
|
rm -f "${temp_json}"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_libva_version
|
set_libva_version
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user