Friday, December 12, 2025

 

It's been a while.

So. Where ya' been? What's new? Read any good books lately? It's been a while.


Indeed.




Let's pick on what's new in the RV.  It's on-line. Let's outline the major changes starting with the network.


The Raspberry Pi based access point that was providing the RV WiFi Network has been unplugged. 


A New Router

In its place is a Netgear N750 (WNDR4300) router running OpenWRT v24.10 and the Travelmate package to provide an access point. Having a dedicated router has made things easier, more capable and more reliable. 


Running OpenWRT means the router can send status and health messages over MQTT. As in:


{

   "dateTime":"2025-10-03T17:58:00",

   "router_hostname":"OpenWrt",

   "wifi_interfaces":[

      {

         "interface":"phy0-ap0",

         "essid":"C*****",

         "access_point":"28:***",

         "mode":"Master",

         "channel":1,

         "frequency_ghz":2.412,

         "hardware":"embedded [Atheros AR9340]",

...

         "phy_name":"yes"

      },

      {

         "interface":"phy1-ap0",

         "essid":"C*****",

         "access_point":"28:****",

         "mode":"Master",

         "channel":149,

         "frequency_ghz":5.745,

         "hardware":"168C:0033 168C:A120 [Atheros AR9580]",

         "phy_name":"yes"

      },

      {

         "interface":"phy1-sta0",

         "essid":"SG",

         "access_point":"2F",

         "mode":"Client",

         "channel":149,

         "frequency_ghz":5.745,

         "hardware":"168C:0033 168C:A120 [Atheros AR9580]",

         "phy_name":"yes"

      }

   ],

   "connected_clients":{

      "count":3,

      "clients":[

         {

            "mac":"a",

            "hostname":"foo",

            "ip":""

         },

         {

            "mac":"b",

            "hostname":"bar",

            "ip":""

         },

         {

            "mac":"c",

            "hostname":"too",

            "ip":""

         }

      ]

   }

}


[ Thank you ChatGPT, or Claude, for writing the 'ash' shell script that pulled the data from the router, crafted the JSON packet and sent it out. ]


At a glance I can tell how the router is working and if the expected clients are connected.


Travelmate provides an Access Point and uplink capability. Right now, I have the 2.4GHz radio in the router configured as the AP. The 5GHz radio in the router is the internet uplink. When the RV is parked, an old Samsung smartphone with a Tello data plan provides Internet access.  A 2GB/month, $6 plan is sufficient to support the data consumption.  So far, I seem to be using about 30-40MB per day.




When I'm in the RV, or camped and want to do system updates or other data intensive tasks, I can fire up Starlink or the hotspot on my phone (a 20G Mint Mobile plan).  





A great feature of Travelmate is that it will monitor all configured available uplinks/hotspots and connect to a higher priority one.  This means that all I have to do when I'm in the RV is enable the hotspot on my phone.  After a minute or so, the router switches from the 2GB Tello phone to my 20G Mint Mobile device. And I can do large data updates without consuming all of my Tello data. 



Power!

I had been hesitant to use a dedicated router because of my guess-timated power
consumption. But now that the RV has 200Ah of LiFePO4 battery there's sufficient power to run the systems for several days. 


I measured the current consumption of the router to be about 2.5A.  And it's powered by 12V DC. A simple buck converter was installed to ensure the 13-14V of battery power is pulled down to a consistent 12V DC. The router and Raspberry Pi can stay on all of the time without concerns about depleting the batteries.


The router, the Pi, the ESP32 and the phone are all connected to the Load Output on the EPEver MPPT controller. I can monitor the current.  When things are idling, the power consumption is very small.





Weather Now

The second big change is the 433MHz RF devices in the RV.  I found another Acurite 5-in-1 weather station on sale for $50.  It stays in the RV and gets pulled out and put up when we stop.  This station transmits all data on 433MHz. 


There are four other temperature and humidity sensors around the RV that also send on 433MHz.






433Mhz Reception


A dedicated ESP32 microcontroller with a 433MHz receiver running OpenMQTTGateway and a port of the RTL433 software provides protocol decoding.  

The binary data from the devices are intercepted, converted to JSON and sent over MQTT:


{"model":"Nexus-TH", "id":22, "channel":2, "battery_ok":0, "temperature_C":34.6, "humidity":22, "protocol":"Nexus, FreeTec NC-7345, NX-3980, Solight TE82S, TFA 30.3209 temperature/humidity sensor", "rssi":-50, "duration":731000}


{"topic":"WEATHER/CURRENT/ACURITE", "dateTime":"2025-10-03T18:13:21-06:00", "version":"1.0", "station":"2796", "channel":"A", "temperature":81, "humidity":46, "windSpeed":0, "windDirection":135, "rain":1.3}


One disappointment is that this setup is not able to receive and decode the transmissions from the TPMS sensors on all six RV wheels. I've made a number of attempts to decode and have not been successful. I've tried contacting the TPMS vendor, asking if they'd publicize their protocol details and they've refused.


Next up - It's Brian's Fault

Sunday, March 10, 2024

Staying out of the Ditch (Part II)

 

Staying Out of the Ditch

About four years ago, now, we had a helluva scare in Wyoming. A sudden gust of wind pushed us into the ditch. Emmy was driving; we had slowed down to about 45mph, thankfully.  

I'd like to try to avoid that again, if possible.

See Part I of this post where I cover off how I get the forecasted weather conditions for my current location.

A quick recap:

  • there's a GPS receiver on top of the RV that tells me my current location, as a latitude/longitude pair every minute
  • I'm calling the NOAA's weather API to get the weather forecast for my current location
  • I'm also calling the NOAA's Alerts API to pull any severe weather conditions that are around me.


"The World Needs More Lerts."

Just like I take my current latitude and longitude and get the hourly weather forecast for "here", I pass those coordinates into the NOAA Alerts API. The NOAA call returns a JSON packet with no alerts, or the ones issued for my area.



NOAA returns a ton of information. And, as before in the forecast return data, I only clip out the information I think is necessary to display.  That's

  • The Event (eg. Wind, Snow, Rain, Flood...)
  • Urgency (Immediate, Expected, Future, Past)
  • Certainty (Observed, Likely, Possible, Unlikely)
  • Severity (Extreme, Severe, Moderate, Minor)
  • SAME Code
  • Details

You can read the NOAA documentation for more information about the return values.   The first four are self-explanatory. The SAME code is a number that you can enter into a Weather Radio that supports such codes. Punch the SAME code into the weather radio, and it will watch for alerts in this area. A SAME code designates a geographic area (more or less).

The last column, details, is simply a constructed hyperlink to the details on this alert. Click it and it will retrieve the full alert data.

Here's an example:



We'll "start to end" Part II here.

Part III, when I get around to it, will go into the implementation details.  But before I end Part II, some thoughts on the "Why?"

Why Bother?

Isn't this "re-inventing the wheel"? Isn't this information -- and more -- already available from a number of apps on any phone in 2024?

Sure.

So why?

A couple of reasons, some selfish, some pragmatic:

  • The apps on a phone are "pull" in nature. I have to take action to get the information. I have to stop watching the road, and press buttons on my phone to request the data.  Pulling data in 2024 is insanely stupid, IMO. The computer(s) have all of the capability to push data to me.
  • The apps on a phone have a user-experience that appeals to their developers. That may or may not be the way I want to consume the data.
  • The apps on the phone have a UI that changes whenever the developer feels like it. That sometimes aggravates me. I just get the muscle-memory set to use the app with minimal thought, and the developer decides to change things.

I can continue to refine the experience to tailor the output to my needs.  Some of the things I've thought about for V2 are:

  • tailor the wind warnings for heightened alert if the direction will be broadside
  • play the Star Trek Red Alert sound when some urgent alert comes in
  • pull up alerts and forecasts for where I'm heading, instead of just where I am
  • add a NOAA radar screen so I can see a current radar

And so on. I'm sure I'll come up with some new ideas for the next revision. Even more so after I use this one in the RV for a while.









Staying out of the Ditch (Part I)

Staying Out of the Ditch

About four years ago, now, we had a helluva scare in Wyoming. A sudden gust of wind pushed us into the ditch. Emmy was driving; we had slowed down to about 45mph, thankfully.  

How she kept us upright is our best evidence of Divine Intervention to date.  Getting out and walking around our landing area, it was apparent that had we entered the ditch 20 feet sooner or later, the slope was much steeper, and we surely would have tipped over with a horrific outcome.

I'd like to try to avoid that again, if possible.

In the interim, I've kept two apps up and running on my phone: a NOAA weather radar and an app that displays Wind Speeds in the area.

But that meant I was glancing at the phone instead of the road.  I figured it was time to try to do one better.


Latitude and Longitude

There's already a GPS Receiver on top of the RV. I put it there. It's an inexpensive (<$10 USD) USB dongle with an older "ublox-7" GPS chip inside. While dated and likely not good enough for high precision needs, it consistently sends me my current location.

Like everything else in my RV, home and life, the data comes in as a MQTT message, JSON formatted. For example:

{"topic":"GPS","version":"2.0","dateTime":"2024-03-10T14:27:24-0600", "mode":"3D", "latitude":44.021032, "longitude":-125.088211, "altitude":5193.28, "speed":1.2, "track":-100.0, "climb":0.0, "GDOP":"GOOD", "HDOP":"MODERATE", "VDOP":"MODERATE", "distance":82.87}

[NB: the xDOP values are not great because the testing receiver I use is indoor. Outdoor, the xDOP values are typically 'EXCELLENT'. ]

So every minute, I know my location on the planet.

National Oceanic and Atmospheric Administration


Or NOAA, for short. NOAA has a weather department. That weather department has a public, free API that we can query for all sorts of fun weather data. In my case, I'm most interested in the Forecast and Alerts.

You can read more about the API; in my case I decided to ask the API for the hourly forecast data for my location. You pass in your lat/lon coordinates to the API and NOAA sends back a large JSON response with a ton of information.

I'll spare you the details here, I may go into them in a subsequent post. But I trim down the NOAA response to the data I'm interested in.

I'm only interested in the next four hours. The conditions, the forecasted temperature, wind speed and direction and the chance of precipitation.

If the wind speeds are forecasted to be above 10 MPH, then I'll color the data red:



My GPS receiver sends me my current location every minute. But I'm only calling the NOAA forecast API every 15 minutes.  (I doubt I could drive the RV fast enough to exit the current NOAA forecast bounding area to make more frequent updates worth the effort.)

A little implementation detail - every 'last' forecast data is cached. I'm using Node-Red to code a lot of the functionality here.  When this webpage is brought up, it asks for the last cached forecast.  That way there's relevant data to display immediately; the webpage does not have to wait 1..15 minutes for forecast data.


I'll end this post here. And cover the Weather Alerts section in the next post, Part II.


Tuesday, April 4, 2023


Freezing your you-know-whats off


Last winter, the prep work I did on the exposed RV plumbing worked well. Nothing froze. Well, almost nothing. The drain valve froze.  Annoying but not catastrophic. 

It's time to see if we can cobble something up to tackle that. There are commercial products available, but now that I have more time than sense, I thought I'd see if I could make something.

I found some 12V heating pads on Amazon. Four 20 watt pads, each about 6x2". Fifteen bucks.



When they arrived, I plugged them up to a 12V battery and was immediately shocked, figuratively not literally, by just how hot they got. Within minutes, they were over 200° F!  That's way too hot!  

Reducing The Heat

Rather than return them for something with lower wattage, I scrummaged around the parts drawer and found my DC-DC buck converters. I could use that to lower the wattage and measure the resulting temperatures.


Quick experimentation at 9V, 7.5V and 6V showed that the last one -- 6V -- gave the best (least plastic melting) temperatures. The pads maxed out at about 125° F. That should be safe.





On Only When Needed

Now came the issue of controlling the pads, I'd like them to come on near freezing and turn off when things are warm enough.  The scrummaging in the parts bin revealed that I had bought two W1209 Temperature Controlled Relays from Amazon. I had used one to turn on some additional fans in the RV's refrigde compartment when things got hot.

The W1209 Relays have a "cooling" and a "heating" mode. In the cooling mode, the relay turns on (energizes) when temperatures go above a Trigger temperature. In heating mode, the relay de-energizes at the trigger temp, but energize a temperatures below.

Note, figuring out the exact settings to get Heating Mode to work was a bit of a puzzle. In the end, you program the device: set the Trigger Temperature to the temperature to turn off. In my case, I picked 15° C. Then I set the P1 (hysterisis) value also to 15° C. This results in the relay energizing at 0° C. (Trigger Temp - P1 value = relay-on temp). 

So I have a relay which energizes at 32° F and turns off at about 60° F. 

The temperature probe accuracy is astonishing. Clearly within a tenth or two degrees C.

The Prototype

Here's the prototype:


The temperature probe is in ice water, and is reading -0.1° C. The W1209 relay has energized and is feeding 12V to the LM2596 buck converter which is dropping it down to 6V before sending it to the heating pads.

Note, each pad was consuming 0.84A at 6V.  Both pads, together, took 1.7A at 6V. Well below the rated 3A of the buck converter.

The results

Some temperature measurements with the prototype.
Time    Pad 1        Pad 2
T0        68° F        68° F 
T1        95° F        105° F 
T2        106° F      114° F 
T3        112° F      123° F 
T4        119° F      124° F 
T5        120° F      126° F 
T10      126° F      129° F 

After five minutes they both leveled off at around 120-125° F.

Next up, a case to hold the electronics and installation on the RV.



Tuesday, October 18, 2022

(#44) It's all about the weather this time

Let's make this one short. 

We're still pumping data from legacy sensors into Home Assistant. This time it's data from the two weather stations here.  The long-employed LaCrosse WS2308. Jeez this thing has to be over ten years old by now.  And a newer Acurite 5n1 station.

Both systems use the 433MHz spectrum to send data from their outside sensors to their base stations. Both 433MHz protocols are recognized and decoded by the "rtl_433" open source software.

Rtl_433 can output the intercepted data as JSON payloads which, in turn, can be pumped right into our MQTT (mosquitto) broker.


Those JSON payloads aren't immediately edible by Home Assistant. 

Or, if they are, they require an expertise in programming Home Assistant, that I don't have. So, I've stuck something in the middle.

Something easy. 

Something that subscribes to the RTL JSON payloads and republishes out new JSON payloads in the MQTT Device Discovery Format that Home Assistant understands.

A lesson learned from the previous success was to treat each sensor separately. The Acurite 5n1 sends over: temperature, humidity, wind speed, wind direction and rain totals.  

That's five separate sensors, five different MQTT Device Discovery Configuration Messages.

MQTT Data Payloads

The Acurite 5n1 sends this sensor data across two different JSON payloads via rtl_433. We break out the data to five sensors. It's similar for the WS2308 station (which is labeled as WS2310 by rtl_433). The sensor data for four sensors are scattered across three MQTT messages.

Here's the rtl_433 output for the WS2308 (aka WS2310) station:

{"time" : "2022-10-18T13:47:05", "protocol" : 34, "model" : "LaCrosse-WS2310", "id" : 28, "humidity" : 35, "mod" : "ASK", "freq" : 434.020, "rssi" : -6.215, "snr" : 31.158, "noise" : -37.373}

{"time" : "2022-10-18T13:47:05", "protocol" : 34, "model" : "LaCrosse-WS2310", "id" : 28, "wind_avg_m_s" : 0.000, "wind_dir_deg" : 22.500, "mod" : "ASK", "freq" : 434.019, "rssi" : -6.265, "snr" : 31.108, "noise" : -37.373}

{"time" : "2022-10-18T13:47:06", "protocol" : 34, "model" : "LaCrosse-WS2310", "id" : 28, "temperature_F" : 65.480, "mod" : "ASK", "freq" : 434.020, "rssi" : -6.238, "snr" : 29.886, "noise" : -36.124}

MQTT Device Discovery Configuration Messages

And here's a code snippet to create the configuration MQTT topic and message.



For each station, create the configuration messages for each sensor in that station.

Forward Station Data to Home Assistant

With the configuration messages created and sent to Home Assistant, now just forward the data packets from the weather stations to the new topics specificed in the configuration messages:

Topic: 

home/LaCrosse-WS2310-28/temperature 

Payload:

{"time" : "2022-10-18T14:53:17", "protocol" : 34, "model" : "LaCrosse-WS2310", "id" : 28, "temperature_F" : 66.200, "mod" : "ASK", "freq" : 434.020, "rssi" : -6.537, "snr" : 29.587, "noise" : -36.124}

And don't forget the state message.

Topic:

home/LaCrosse-WS2310-28/state 

Payload: 

{"state":"online"}


The sensors now all show up in Home Assistant!






Tuesday, October 4, 2022

(#43) Home Assistant Legacy Sensors - Part 3

It's working. Mostly.


With success from hooking the Tuya Air Quality Monitor (non-Zigbee) WiFi up to Home Assistant using the MQTT Device Discovery Protocol, it was not a lot of work to get the Eaton Home Heartbeat (HHB) sensors added.

As mentioned before, the HHB sensors are Zigbee based but I'm unable to quickly see how to unpair them from the Eaton base station and see if they'll re-pair to my Sonoff Zigbee dongle.

So, since the code that reads the HHB sensor data by polling the base station has been up and running for eight years, I made the decision to just add in the MQTT packets to support MQTT Device Discovery. And see if the sensors will appear in Home Assistant.

For the impatient, yes it works. The HHB sensors are now showing up in Home Assistant. The HHB Open/Close sensors, the Tilt Sensor, the Power Sensor, the Wet/Dry Sensor and the Motion sensors all are reporting their status in Home Assistant.


The only downside that I've discovered so far is the lag between a change in a sensor's status and when Home Assistant reflects the state change. That's because the old HHB code polls the gateway for sensor status changes.  So there's a couple of seconds of delay between a state change and the UI reflecting the state change.

No biggie. I can live with that.

Implementation - Summarized

The details are irrelevant; they're specific to my original code from 2013. And you can't buy these sensors anymore.

Nonetheless, for the curious, here's a brief summary:

- original code 'discovered' all of the HHB sensors at startup, by polling the gateway

- new Home Assistant (HA) code, added a call to "HA_CreateConfigurationMessage( HHB_Device )" as each sensor was discovered

Configuration messages were type "binary sensor". Here's the one for the HHB Open/Close Sensor:

 const   char *configTemplate_OpenCloseSensor = 
        "{\"availability\":[{\"topic\":\"%s\",\"value_template\":\"{{ value_json.state }}\"}],"       
        "\"device\":{\"identifiers\": [ \"%s\"],"                                                     
        "\"manufacturer\":\"Eaton\",\"model\":\"HHB OpenClose\",\"name\":\"%s\",\"via_device\": \"HHB\" },"  
        "\"device_class\":\"door\",\"enabled_by_default\":true,\"expire_after\" : 3600,\"force_update\" : true," 
        "\"name\":\"%s [%s] OpenClose\","               
        "\"state_topic\":\"HHB/%s\","                   
        "\"unique_id\":\"%s_OpenClose\","           
        "\"payload_on\":\"OPEN\", \"payload_off\":\"CLOSED\","   
        "\"value_template\":\"{{ value_json.state }}\"}";

The "%s" string substitutions were the MAC address for each sensor.

And then published to an MQTT Topic like:

homeassistant/binary_sensor/%s/config

Again, where the subsitution was the device MAC address.

Most of the sensors (all but the Power Sensor) also had a battery configuration message sent.
// The Eaton HHB battery levels are binary - either OK or not
    const   char *configTemplate_Battery = 
        "{\"availability\":[{\"topic\":\"%s\",\"value_template\":\"{{ value_json.state }}\"}],"       
        "\"device\":{\"identifiers\": [ \"%s\"],"                                                     
        "\"manufacturer\":\"Eaton\",\"model\":\"HHB OpenClose\",\"name\":\"%s\",\"via_device\": \"HHB\" },"  
        "\"device_class\":\"battery\",\"enabled_by_default\":true,\"expire_after\" : 3600,\"force_update\" : true," 
        "\"name\":\"%s [%s] Battery\","               
        "\"state_topic\":\"HHB/%s\","                   
        "\"unique_id\":\"%s_Battery\","           
        "\"payload_on\":\"LOW BATTERY\", \"payload_off\":\"BATTERY OK\","   
        "\"value_template\":\"{{ value_json.battery }}\"}";


To a topic of:

homeassistant/binary_sensor/%s/battery/config

That took care of telling Home Assistant to expect new sensors. Then it was a small addition to publish the unchanged data payload to a new MQTT topic.

Data Payloads still look like:

{"topic" : "HHB/STATUS",  "dateTime" : "2022-10-04T13:37:31-0600" , "deviceType" : 23 , "type" : "MOTION SENSOR" , "name" : "Dining Room Motion" , "state" : "MOTION" , "duration" : 60 , "setAlarmAction" : "ALARM ON MOTION" , "unsetAlarmAction" : "NO ALARM ON NO MOTION" , "setCallAction" : "DO NOT CALL ON MOTION" , "unsetCallAction" : "CALL ON NO MOTION" , "online" : "ONLINE" , "battery" : "BATTERY OK" , "triggered" : "TRIGGERED" , "MACAddress" : "0000093BF5" }

And published to a topic like:

HHB/0000093BF5 


There's a new payload to indicate sensor state. I think I could have told HA to parse state from the existing payload, but since this approach worked for the Tuya sensor, I just added it here.

{"state":"online"}

HHB/0000093BF5/STATE 


And that's about it. Like I said - the original code is from 2013 and updated a personal web page. So that's unique to me. And you can't buy these HHB sensors any more.  There's no sense going into more detail.

It's working.

I salvaged the existing sensors and have them integrated with Home Assistant. 




That's good enough for me, for today.