mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2026-09-21 17:23:20 +02:00
fix: update jq parsing for new alexaHistoryRecords response structure
New API response uses: - alexaHistoryRecords (was customerHistoryRecords) - activityKey (was recordKey) - deviceInfo.deviceName (was device.deviceName) - recordType == "utterance" filter for device-specific lastcommand Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015a9UxV6q6eG4bpn3JH3PJX
This commit is contained in:
@@ -1160,7 +1160,7 @@ get_history()
|
|||||||
last_alexa()
|
last_alexa()
|
||||||
{
|
{
|
||||||
get_history
|
get_history
|
||||||
${JQ} -r '.customerHistoryRecords | sort_by(.timestamp) | reverse | .[0] | .recordKey' ${TMP}/.alexa.activity.json | cut -d'#' -f4 | xargs -i grep -m 1 {} ${DEVLIST}.txt
|
${JQ} -r '.alexaHistoryRecords | sort_by(.timestamp) | reverse | .[0] | .activityKey' ${TMP}/.alexa.activity.json | cut -d'#' -f4 | xargs -i grep -m 1 {} ${DEVLIST}.txt
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# last command or last command of a specific device
|
# last command or last command of a specific device
|
||||||
@@ -1170,9 +1170,9 @@ last_command()
|
|||||||
get_history
|
get_history
|
||||||
|
|
||||||
if [ -z "$DEVICE" ] ; then
|
if [ -z "$DEVICE" ] ; then
|
||||||
${JQ} -r --arg device "$DEVICE" '.customerHistoryRecords | sort_by(.timestamp) | reverse | .[0] | .voiceHistoryRecordItems | map({key: .recordItemType, value: .transcriptText})' ${TMP}/.alexa.activity.json
|
${JQ} -r '.alexaHistoryRecords | sort_by(.timestamp) | reverse | .[0] | .voiceHistoryRecordItems | map({key: .recordItemType, value: .transcriptText})' ${TMP}/.alexa.activity.json
|
||||||
else
|
else
|
||||||
${JQ} -r --arg device "$DEVICE" '[ .customerHistoryRecords | sort_by(.timestamp) | reverse | .[] | select( .device.deviceName == $device) ][0] | .voiceHistoryRecordItems | map({key: .recordItemType, value: .transcriptText})' ${TMP}/.alexa.activity.json
|
${JQ} -r --arg device "$DEVICE" '[ .alexaHistoryRecords | sort_by(.timestamp) | reverse | .[] | select(.recordType == "utterance" and .deviceInfo.deviceName == $device) ][0] | .voiceHistoryRecordItems | map({key: .recordItemType, value: .transcriptText})' ${TMP}/.alexa.activity.json
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user