I tried this setup via tibber (free account without energy contract), works pretty good!
Similar solution via bash script has already been mentioned above: