Dynamic Tariff 2 MQTT
This is an Azure Function App that retrieves and stores Energy prices (from Enever.nl) and publish this to MQTT. Next to the prices it will publish statistics as well like:
- Current price
- Next hour price
- Average price
- Lowest price
- Highest price
- Hours above average
- and more..
This function app is written in PowerShell and does require the dll file 'M2Mqtt.Net.dll' in the modules folder. Downloadble from NuGet (nuget.exe install M2Mqtt -o c:\lib)
This function app does retrieve its data from enever.nl. You can easily request an API token to use the pricefeed that is listed there. https://enever.nl/prijzenfeeds/
- Enever.nl API token
- Docker-Compose (or docker)
- You need an Azure functions container. More info: Azure Functions Powershell
This function app will run the script every hour. Look at the docker-comopose.yml for the docker setup that contains:
- Azure Functions container
- Azureite (storage account emulator)
- Download the Function Apps folder to '/home/{USER}/Function Apps'
- Download the .env.azfunc file next to your docker-compose.yml file
- Update the .env.azfunc file with its environment variables (like Enever API token, MQTT server, etc)
- ElectricSupplier <If you want to apply a filter on energy supplier (ZP e.g.)>
- GasSupplier <If you want to apply a filter on energy supplier (ZP e.g.)>
- EnableLog
This script was not possible without the help of others. Especially about the MQTT part: https://jackgruber.github.io/2019-06-05-ps-mqtt/