I tried many different ways but didn’t found a way to do following
loop over sensors:
get sensor.id
mqtt publish
topic: this/is/the/topic/sensor.friendly_name
payload: sensor.payload
this looping seems not to be a valid list item in actions…
action mqtt.publish with single topic and payload works pretty nice
It makes it much easier for us to offer constructive answers if you follow Community Guidelines #9 & 11 by supplying a properly formatted configuration for the automation that you have attempted.
The Repeat for Each action will accept a template that returns a list of simple objects. If that is the method you are using, make sure your list is not returning full state objects as those contain complex objects, like datetime objects, that Repeat for Each cannot handle.