Custom component or automation configuration?

Last week I upgraded to v0.98 from an older version (<0.82).
On the older HA version, I made a custom component, copied from mqtt/light. It is for a light that is driven by switches as well as a motion sensor and a LED following the light. All devices communicate using MQTT.
The following rules do apply:

  • when the light is turned on by a switch, the motion sensor is ignored.
  • when the sun is up, the motion sensor is ignored.
  • when the sun is down and motion is detected by the motion sensor, the light is switched on for a configured time.
  • when light is on by switch, an optional LED must be switched on as well (steady on)
  • when light is on by motion detection, an optional LED must be switched on (blinking)
  • LED is instructed by a MQTT topic (see example light config below)

As I am not an expert in HA configuration, but used to be a software developer in the past, I decided to write a custom component for this by copying the mqtt/light component and adding the above features.

With the recent improvements in HA (manifest.json, init.py, etc) my custom component does not work anymore.
So, I am wondering whether I should upgrade my custom component or if there is maybe a better way to configure the same functionality with the standard components, automations, etc. In the latter case I will need some advise/help.
Could you put me in the right direction for such a configuration.

An extract of the light config for one of these lights:

  - platform: mqtt2
    name: 'Voordeur'
    state_topic: 'k8000/output/38/status'
    command_topic: 'k8000/output/38/set'
    optimistic: true
    motion_topic: 'k8000/analog/201/1'
    motion_payload_on: '1'
    motion_payload_off: '0'
    motion_timeout: 30
    led_topic: 'led/42/2/set'
    led_payload_on: '9'
    led_payload_off: '0'
    led_payload_motion: '1'
    use_sun: true
    sunset_offset: '-0:10:00'
    sunrise_offset: '0:00:00'
    payload_on: 1
    payload_off: 0