Project

General

Profile

Sending notifications using TVH api

Added by Patrick Aldag over 2 years ago

Hi there,
i use Openhab to send notifications about finished recordings through Telegram

rule "aufnahmen"
when
Item TVH_Aufnahme received command
then
var String tvheadendapi = sendHttpGetRequest("http://tvhname::9981/api/dvr/entry/grid_finished?limit=1")
var String aufnahmename = transform("JSONPATH", "$.entries.*.title.ger", tvheadendapi)
var String kanal = transform("JSONPATH", "$.entries.*.channelname", tvheadendapi)
switch TVH_Aufnahme.state {
case OFF: {
sendTelegram("Botname", "Hallo, die Aufnahme " + aufnahmename + " auf " + kanal + " wurde gerade abgeschlossen.")
}
}
end

It used to work fine.

but since some weeks i always get the same message reporting an old recording not the latest.

Please let me know what informations you need for fixing this issue. As i don't have any ideas.

Regards
Patrick


Replies (2)

RE: Sending notifications using TVH api - Added by Joe User over 2 years ago

You should use:

?limit=1&sort=stop_real&dir=desc

to ensure you get the most recent.

Or better yet, why not just pass the values you want to a "Post-processor command" script???

RE: Sending notifications using TVH api - Added by Patrick Aldag over 2 years ago

Thanks a lot!
Seems to work.

    (1-2/2)