How to create new component with platforms?

The documentation is really basic. From my understanding you need a toplevel component in custom_components (call it motion_trigger) that loads platforms in custom_components/motion_trigger.

The basic example does not show how to do any of this.

DOMAIN = 'hello_state'

def setup(hass, config):
    hass.states.set('hello.world', 'Paulus')

    return True

I checked the source for some domains and platforms but they are so complex it is difficult to figure out how a platform is setup and how the corresponding component should work.
Any advise?

I am trying to set up this sort of configuration:

motion_trigger:
  - platform: mqtt_payload_processor
    topic: /rf/all
    callback_script: script.buzz_short
    entities: !include rf_codes.yaml
    event: True

@jwelter rocky road ahead. I’m a developer, but the documentation isn’t giving me much joy. Incredibly powerful framework once the basics are understood.