JTK – Notes and Ramblings Things we have found …

1/25/2023

Mighty Mule and LaCrosse Update

Filed under: General,Home Automation,RTL-SDR — taing @ 4:45 pm

It turns out there is another Mighty Mule Driveway Alarm somewhere in the neighborhood so the config from our previous article needed to be updated. The other signal is weak but it triggers frequently and requires the config to be a bit more sophisticated. The first step was to update the rtl_433.conf file to send the MQTT messages as a JSON packet:

output json
output mqtt://broker_ip_address,events=rtl_433/garage[/model]

The result looks something like(after I prettied it up with a bit of formatting):

rtl_433/garage/MightyMule-FM231 {
	"time":"2023-01-24 18:37:05.994411",
	"model":"MightyMule-FM231",
	"count":1,
	"num_rows":1,
	"len":9,
	"data":"ff8",
	"battery_ok":"0",
	"id":15,
	"motion":"true",
	"mod":"ASK",
	"freq":433.89011,
	"rssi":-9.5411,
	"snr":12.69084,
	"noise":-22.2319
}

It’s all the same data but in one message. The Openhab config gets changed to have a String Channel for the MQTT JSON packet, an String Item linked to this and two additional String Items a new rule will manipulate. The rule checks the if the id matches our unit and then updates the appropriate items. The id is set on the transmitter and receiver with the dip switches. The rule is very basic but it does the job:

rule "Driveway Alarm" when
  Item Mighty_Mule_JSON received update
then
  var jsonval = Mighty_Mule_JSON.state.toString
  var id = transform("JSONPATH", "$.id", jsonval)
  var time = transform("JSONPATH", "$.time", jsonval)
  if (id == "5") {
    MightyMule_Driveway_Motion.postUpdate("ON")
    MightyMule_Driveway_Motion_Change.postUpdate(time)
  }
end

Changing the rtl_433 MQTT output to be JSON also required updating the channels for the LaCrosse Weather station. Previously the Generic MQTT Thing had channels for individual MQTT messages for temperature, humidity, wind speed and wind direction. Now the JSON messages from the weather station require the channel to have a JSONPATH transformation. The weather station will send two messages, one with temperature and humidity and one with wind speed and direction:

rtl_433/garage/LaCrosse-TX141W {
	"time":"2023-01-24 18:09:36.626950",
	"protocol":73,
	"model":"LaCrosse-TX141W",
	"id":149742,
	"channel":0,
	"battery_ok":1,
	"temperature_C":-0.8,
	"humidity":74,
	"test":0,
	"mic":"CRC",
	"mod":"ASK",
	"freq":433.87334,
	"rssi":-0.135693,
	"snr":22.09624,
	"noise":-22.2319
}

rtl_433/garage/LaCrosse-TX141W {
	"time":"2023-01-24 18:09:36.626950",
	"protocol":73,
	"model":"LaCrosse-TX141W",
	"id":149742,
	"channel":0,
	"battery_ok":1,
	"wind_avg_km_h":4.5,
	"wind_dir_deg":139,
	"test":0,
	"mic":"CRC",
	"mod":"ASK",
	"freq":433.87334,
	"rssi":-0.135693,
	"snr":22.09624,
	"noise":-22.2319
}

A MQTT channel with a topic of rtl_433/garage/LaCrosse-TX141W will receive both messages. The trick is in the JSONPATH transformation. To extract temperature, for example, use JSONPATH:$.temperature_C. This means there are four channels with the same MQTT topic and different JSONPATH transformations. The log file will get warnings that you can’t extract wind speed from the temp/humidity message or temp/humidity from the wind message.

NOTE: Our LaCrosse S81120-INT includes the LaCrosse TX145WSDTH which sends messages as LaCrosse-TX141W.

?

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress