Best Way to Configure Entity For RF Light using MQTT via Sonoff RF Bridge?

Tags: #<Tag:0x00007f326d4efba0> #<Tag:0x00007f326d4efa88>

Hey All,

I’ve recently picked up a Novostella Good Night Light (https://www.novostella.net/pages/good-night-light) for my young daughter, she frequently wakes up at some point in the night, and gets a little scared when traversing the landing to our bedroom in the dark.

It has an RF remote, so I figured I could use my Sonoff RF Bridge that has been flashed with the Portish firmware to grab the remote codes, and control it with Home Assitant via MQTT.

I’ve managed to grab all of the relevant remote codes, and confirmed them working via MQTT.

The next step was to attempt to bind these to an entity.

I quickly managed to get a basic Light ON/OFF entity in HA by using the MQTT Light integration, and only setting a command topic with the payload_on and payload_off attributes:

light:
  - platform: mqtt
    name: "Landing Night light"
    command_topic: "cmnd/SONOFF-RF-BRIDGE-1/Backlog"
    qos: 0
    payload_on: "RfRaw AA B0 21 03 08 01CC 0474 2F30 28181909081818190908181818190818181818181818181908 55; RfRaw 0"
    payload_off: "RfRaw AA B0 21 03 08 01CC 0474 2F30 28181909081818190908181818190818181818181818181908 55; RfRaw 0"
    optimistic: true
    retain: true

This covers turning on and off the light ok, but I’ve been unsure how I could go about utilising the rest of the functions of the light (brightness up/down and color cycle are the main ones I’d like).

I had a look at the rest of the available attributes when configuring an MQTT light, and couldn’t marry up the way HA expects those attributes to be configured to the MQTT/RF payloads I have available for each function.

I also took a look at the Template Light integration, as it should be possible to call the MQTT Service to send specific commands with that, but I reckon there’s probably quite a bit of boilerplate required to get it to work, along with a few number/boolean helpers (as the light will essentially be stateless) and I got a bit lost trying to visualise all the moving pieces.

Would anybody be able to give me a shove in the right direction and help me hit the ground running a bit?

For reference, here’s all the codes I managed to grab from the remote, they all publish to the same MQTT topic:

Novostella Good Night Light RF Commands
=======================================

MQTT Topic
------------------
cmnd/SONOFF-RF-BRIDGE-1/Backlog


Light On/Off
-------------
RfRaw AA B0 21 03 08 01CC 0474 2F30 28181909081818190908181818190818181818181818181908 55; RfRaw 0

Cycle Color
-------------
RfRaw AA B0 21 03 08 01CC 0474 2F1C 28181909081818190908181818190818181818181819081908 55; RfRaw 0

Brightness Down (There are 10 Levels of Brightness)
---------------
RfRaw AA B0 21 03 08 019A 04BA 2F30 28181909081818190908181818190818181818181819090908 55; RfRaw 0

Brightness Up (There are 10 Levels of Brightness)
-------------
RfRaw AA B0 21 03 08 019A 04B0 2F30 28181909081818190908181818190818181818181818190908 55; RfRaw 0


Music On/Off
-------------
RfRaw AA B0 21 03 08 01B8 0492 2F26 28181909081818190908181818190818181818181818190818 55; RfRaw 0

Music Prev
-------------
RfRaw AA B0 21 03 08 01CC 0474 2F26 28181909081818190908181818190818181818181908181818 55; RfRaw 0

Music Prev
-------------
RfRaw AA B0 21 03 08 019A 04A6 2F30 28181909081818190908181818190818181818181908181908 55; RfRaw 0

Volume Down
-------------
RfRaw AA B0 21 03 08 01CC 0474 2F26 28181909081818190908181818190818181818181819081818 55; RfRaw 0

Volume Up
-------------
RfRaw AA B0 21 03 08 01CC 0474 2F26 28181909081818190908181818190818181818181819090818 55; RfRaw 0

TIA!