Cannot define any - platform statement behind sensor:

The Solution tag is assigned to the first, or best, post that resolves the problems originally presented. Refer to guideline 21 in the FAQ.