I expect this is probably really simple but i’m not very good at templating and would appreciate it if anyone can help me? I have a REST API command that works and returns a bunch of info (example of the returned data is below). My automation runs the rest command with the ‘response_variable’ option enabled (called ‘backup_status’). I need an if / then in the automation to continue if a value template matches the rest data’s ‘total’ value to ‘1’ or fail if the value is not ‘1’ or no value is returned. As a check i’ve tested with a notification with the following line in and it displays ‘1’ correctly so I know the rest command’s response variable is working in the automation:
Backups active: {{ backup_status.content.total }}
What should the line in my value template be to work correctly? Thanks for any help!
One more question. Obviously i’m able to use the ‘total’ value ok, but when I try to use one of the data: sub-values it doesn’t work. E.g. this doesn’t work:
That hyphen denotes that the stuff under data is an item in a list. So, you need to select the list item by its index first and use quotes appropriately so you are comparing to a string value…