esphome / esphome/feature-requests

add support for XL-MaxSonar-WR/WRC MaxBotix sensors

Open
#1,913 1 comment 0 reactions 0 assignees View on GitHub
Type: Distance
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Hello Community =)

**Describe the problem you have/What new integration you would like**

ESPHome already supports the high resolution (hr) versions of the maxbotix distance sensors, but it would be nice to also support other models. Specifically, the XL-MaxSonar-WR series with model numbers MB70XX and MB71XX as given in this datasheet: https://www.maxbotix.com/documents/XL-MaxSonar-WR_Datasheet.pdf

**Please describe your use case for this integration and alternatives you've tried:**

Got my hands on a MB7052 and using a MAX232 converter to convert RS232 to TTL. It all works, the esp8266 receives bytes without a problem, but the provided sensor platform for hrxl_maxsonar_wr will only log "Invalid data read from sensor: %s"

I found a workaround using a text sensor to read the bytes and convert them to int in HA downstream, but this solution lacks nice features like filters and throttling (which are very much desired at a publishing frequency of 6.6 Hz).

**Additional context**

Looking at the source code, I found that the control flow requires a buffer length of 6 for values to get published. However, the lower precision versions will only send bytes with a total length of 5, e.g. 'R012\r' and not 'R0123\r'. As a result, the values are never published because the if condition never evaluates to true.

I tried to tweak the hrxl_maxbotix_wr.cpp file, but couldn't find it. Simply replacing the value in line 17 would suffice, I guess.
`static const int MAX_DATA_LENGTH_BYTES = 5; // priviously 6`
Since this would also help my situation, I'd be grateful for advice on how to locate esphome source files in my HA installation.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with hrxl_maxbotix_wr.cpp and inspect the data-length check mentioned in the issue. Verify the MB7052's five-byte readings are accepted and published, then check that filters and throttling still work at the requested frequency; the issue does not name a test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.