I’m wanting to log (most for some debugging) what states are when certain actions happen, so after an action … Say a light is powered off I want to log the states of certain things to make sure that what I’m wanting is happening. I am testing this out in a very simple scenario and not getting what I need - See below. The “message” line has the template that I want, but it will not start with that line. Anyone know how I can use a template in a logbook entry?
(Removing the template and using dummy words in the “message” works btw. So I can only assume it is my template causing the startup problem.)
Using the developer tools and logbook.log with the following payload works, so I assume it is possible and I’m not constructing my action properly! {"name":"Upstairs Temp ","message":"{{states.sensor.main_floor_temperature.state}}"}
Spent most of last night trying to figure this out and finally gave up and I came across a page that had the answer… One that I had missed several times! Here is the working way!
Your code is missing the data section and also does not have a message to log. The following is working for me. It’s a script but the service call syntax is the same as for an automation…