In future please format your pasted config correctly https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16
There are problems with your configuration. There is no value: option listed here:
And the state: option does not support templates.