RTL433 Owl CM180 to MQTT to Home Assistant - help with sensor creation needed

Hello

I have a RTL-433 USB which i’m using to collect data from my CM180 energy sensor.

This is a sample of the json output from RTL-433 (using rtl_433 -C si -M newmodel -F json) for testing:

{"time" : "2022-03-13 13:19:13", "brand" : "OS", "model" : "Oregon-CM180", "id" : 1104, "battery_ok" : 1, "power_W" : 2737, "sequence" : 2}
{"time" : "2022-03-13 13:19:25", "brand" : "OS", "model" : "Oregon-CM180", "id" : 1104, "battery_ok" : 1, "power_W" : 4459, "sequence" : 1}
{"time" : "2022-03-13 13:19:37", "brand" : "OS", "model" : "Oregon-CM180", "id" : 1104, "battery_ok" : 1, "power_W" : 4475, "energy_kWh" : 70.817, "sequence" : 0}
{"time" : "2022-03-13 13:19:49", "brand" : "OS", "model" : "Oregon-CM180", "id" : 1104, "battery_ok" : 1, "power_W" : 4363, "sequence" : 4}
{"time" : "2022-03-13 13:20:01", "brand" : "OS", "model" : "Oregon-CM180", "id" : 1104, "battery_ok" : 1, "power_W" : 4491, "sequence" : 3}
{"time" : "2022-03-13 13:20:13", "brand" : "OS", "model" : "Oregon-CM180", "id" : 1104, "battery_ok" : 1, "power_W" : 4347, "sequence" : 2}
{"time" : "2022-03-13 13:20:25", "brand" : "OS", "model" : "Oregon-CM180", "id" : 1104, "battery_ok" : 1, "power_W" : 4443, "sequence" : 1}
{"time" : "2022-03-13 13:20:37", "brand" : "OS", "model" : "Oregon-CM180", "id" : 1104, "battery_ok" : 1, "power_W" : 4314, "energy_kWh" : 70.889, "sequence" : 0}

In the MQTT within Home Assistant, i’m receiving the following MQTT traffic:

{
    "time": "2022-03-13 15:54:49",
    "brand": "OS",
    "model": "Oregon-CM180",
    "id": 1104,
    "battery_ok": 1,
    "power_W": 676,
    "sequence": 4
}
QoS: 0 - Retain: false
Message 6 received on rtl_433/Oregon-CM180/1104 at 15:54:
{
    "time": "2022-03-13 15:54:37",
    "brand": "OS",
    "model": "Oregon-CM180",
    "id": 1104,
    "battery_ok": 1,
    "power_W": 724,
    "energy_kWh": 73.96283,
    "sequence": 0
}

I’ve noticed that every 5th message has sequence ‘0’ and also includes the “energy_kWh” entry, which the other 4 messages do not.

Here is my sensor definitions from my yaml file:

 - platform: mqtt
   name: "house_power_now"
   state_topic: "rtl_433/Oregon-CM180/1104/power_W"
   value_template: "{{ value_json.power_W }}"
   unit_of_measurement: 'W'
   device_class: power
   state_class: measurement
   
 - platform: mqtt
   name: "house_energy_lifetime"
   state_topic: "rtl_433/Oregon-CM180/1104/energy_kWh"
   unit_of_measurement: 'kWh'
   value_template: "{{ value_json.energy_kWh }}"
   device_class: energy
   state_class: measurement

However, i’m not seeing any data (just ‘unknown’ for either of these 2 sensors when I go to Dev Tools → States within HA ??

What’s the best way to solve this?
Ideally I want the “power_W” values from all 5 messages if possible, but if not then just the ‘power_W’ and ‘energy_kWh’ entries from each message with sequence = 0 would be acceptable instead, if there is logic i can use to ignore the other 4 and just process those ones maybe ?

Thanks all.

Might have solved it, or at least made progress…

Realised my state_topic fields were wrong in my sensor definition, so changed (both) of them to the following:

state_topic: "rtl_433/Oregon-CM180/1104"

After doing this i’m now getting the values showing in the Dev Tools → States window, which is good.
It doesn’t seem to negatively impact things that 4 of the 5 updates don’t have the ‘energy_Kwh’ field, so i guess i don’t need to do any logic around that afterall.

Posting this here in case it helps others trying to do similar with Owl CM180’s also.

Cheers

1 Like