MQTT sensor and variables in topics

With the following:


- platform: mqtt
  name: "lock_code_slot"
  state_topic: "OpenZWave/1/node/666/instance/1/commandclass/99/#"

How can I replace 666 with a variable?

Actually, I’m interesting in this too, because my sensors like this:

    - name: 'money_total_january'
      state_topic: "bills/total/{{ now().strftime('%Y') }}/01"

…is not working as I expected, can someone explaine it’s not possible? I can write value in topics like this, but I can’t get data in sensor back