dgtlmoon/changedetection.io

[feature] Notify on value smaller/greater than x

Opened this issue · 3 comments

nvllz commented

Version and OS
0.47.06 on linux/docker

Is your feature request related to a problem? Please describe.
When trying to monitor for prices (i find this price calculator thing not work most of the times), or let's say currency prices, I can't get set notifications to be sent only when bigger/lower than x. For example: notify when btc price is > 100000 when using this api output https://blockchain.info/ticker, or just use simpler tool for scraping prices as the solution you recently introduced doesn't work for Amazon and requires you to apply the service to other providers. This way users could handle things on their own.

Describe the solution you'd like
I'd like the "Trigger/wait for text" to be expanded with handling expressions such as greater, greater or equal, etc..

Describe the use-case and give concrete real-world examples
In this case users would be notified only when btc usd price is bigger for 100k USD. Now you can only get the current value, which fluctates every 15m, making value change notifications pointless.

Maybe also "when a new low number" or "when a new highest number" in history is reached

Considering the link just returns json would it not be best to use something other than a full page render to identify the btc price. Would a better feature request here be to allow parsing and monitoring of json-like objects without using a full browser session to do it?

That said though, if you add this javascript to one of your steps after the page loads it will update the content of the page to show if the last USD price was over/under 100000:

fetch('https://blockchain.info/ticker').then(res => res.json()).then(data => document.body.innerText = data.USD?.last ? (data.USD.last > 100000 ? 'OVER' : 'UNDER') : 'UNKNOWN').catch(() => document.body.innerText = 'UNKNOWN');

I couldn't get this to work on https://blockchain.info/ticker as my CD gets a 403 when browsing to it but if I set my watch url to https://www.example.com/ and add the javascript as a browser step it works (example.com is very useful as a launch page to run hand written javascript).

image

Guys, in this case (that you are parsing JSON directly) just use the jq: filter

( I actually just pasted the JSON into ChatGPT and asked it for a JQ filter, took 20 seconds )

image

jq:.USD | select(.["15m"] > 98000)| .["15m"]