In this case the map() filter is used two different ways. The first | map(attribute='attributes.bateria_baixa'), is used to define which attribute is output. The second, | map('int', 0), is used to convert those values to integers. The second might not have been necessary, but you did not say what data type the attribute was, so I included it to cover the bases.
The two best sources for information on Home Assistant templating are:
However, even combined, they do not cover all the methods, functions, and “tricks” that are available. There isn’t a single source that covers all of those… they are sprinkled throughout this forum.
Correct, it triggers only on the change where the count go from 0 to any value above 0… if you need something that triggers with every additional change you could use something similar to for a template sensor then use a State trigger and template condition to trigger on every increasing state change.