HTTP JSONPATH migration

I found some old code from the previous http binding which I haven’t migrated to the new http binding:

# Tasmota Release Status (cached twice a day)
tasmotaRelease.url=https://api.github.com/repos/arendst/Sonoff-Tasmota/tags
tasmotaRelease.updateInterval=43200

I created the following thing and item:

Thing http:url:tasmotaversion "Tasmota latest version" [
	baseURL="https://api.github.com/repos/arendst/Sonoff-Tasmota/tags",
	refresh=43200] {
		Channels:
			Type string : text "Text" [ stateTransformation="JSONPATH:$.name" ]
}

String Tasmota_Current_FW_Available "Current Releasee [%s]" <settings> {channel="http:url:tasmotaversion:text"}

But no matter what value I enter in stateTransformation, I get the entire page of https://api.github.com/repos/arendst/Sonoff-Tasmota/tags in my item.

Could someone point me in the right direction?

But there is not a single name - which one would you like? Hint, the JSON is an array and you select array elements like [0]

1 Like

Initially I thought it would be:

stateTransformation="JSONPATH:$.0.name"

But that didn’t do the trick.

Reading can be difficult from time to time :sweat_smile:

stateTransformation="JSONPATH:$.[0].name" did the trick.