MQTT rotary encoder volume control, Help needed

Hi all there,

I have some difficulties to get this to work. First my goal is to have volume control by MQTT with an rotary encoder.

My encoder puts out a number bij MQTT on this topic:

- platform: mqtt
  name: "Wemos Encoder"
  state_topic: "daaf84/panel/encoder"

And I want it to control the volume of my chomecast. (media_player.terras)

I’v tried to use this tutorial and changed some of the names, but it won’t work for me:
https://community.home-assistant.io/t/pi-zero-rotary-encoder-as-hass-volume-controller-play-pause-toggle-no-soldering-required/

I hope you cal help me out or give me a push in the right direction.