1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.57k stars 788 forks source link

MopekaGas Sensor Pro: Add x/y-Position #1656

Closed Joey-1970 closed 1 year ago

Joey-1970 commented 1 year ago

Hello!

Thank you very much for this great app.

Is it possible to add the x/x-Postion to the MQTT-String? MA MA HW BAT TEMP Q Q MAC MAC MAC XACEL YACEL 1 2 3 4 5 6 7 8 9 10 11 12 I mean the last two bytes of the data field...

It is wrote in TwosComplement...

Thank you

Joachim

DigiH commented 1 year ago

Hi @Joey-1970

Are you able to make your own test build in PlatformIO with an updated custom decoder branch?

Joey-1970 commented 1 year ago

Hello @DigiH,

thank you for your reply.

I think I'm not able to do it myself. If you show me the original code (I don't find it), maybe I can write something here with more details...

Joachim

DigiH commented 1 year ago

@Joey-1970 Nothing major - In the platformio.ini file, just change the current line 156

decoder = https://github.com/theengs/decoder.git

to

decoder = https://github.com/DigiH/decoder#mopeka

then rebuild and upload to your gateway.

Please let us know if it corresponds with the x and y position in the Mopeka app.

Thanks

P.S. Sorry, I didn't read the not before the able ;) my bad! We'll test it internally and once verified it will be available through the pre-built development binaries the next days and included in the next OpenMQTTGateway release.

Joey-1970 commented 1 year ago

...I find something here: https://github.com/DigiH/decoder/blob/development/src/devices/Mopeka_json.h ...my try:

x must be beginn at manufacturerdata 16, y at 18... "xacel":{ "decoder":["value_from_hex_data", "manufacturerdata", 16, 2, .... "post_proc":[twoscomplement...

"yacel":{ "decoder":["value_from_hex_data", "manufacturerdata", 18, 2, .... "post_proc":[twoscomplement...

I fear this ist not my program language...maybe some other can complete it and merge it? Sorry...

Joachim

DigiH commented 1 year ago

No worries, with the manufacturerdata including the leading two company ID octets at the beginning, there must be four indexes added to your suggestion, as I submitted it to the test decoder file

https://github.com/DigiH/decoder/blob/mopeka/src/devices/Mopeka_json.h#L53

and the twoscomplement is being defined with the booleans in the "decoder" section.

You can also have a look at the extended test cases in the PR to see if the raw data would match your results as well.

https://github.com/theengs/decoder/pull/340/files

with the actual data being defined at

https://github.com/DigiH/decoder/blob/mopeka/tests/BLE/test_ble.cpp#L404

Joey-1970 commented 1 year ago

THANK YOU VERY MUCH!

DigiH commented 1 year ago

@Joey-1970 You're welcome 😃

You can now download and install pre-built binaries of the latest OpenMQTTGateway development version, with the extended Mopeka decoder included, at

https://docs.openmqttgateway.com/dev/upload/web-install.html

DigiH commented 1 year ago

Hi @Joey-1970 were you able to test and confirm with the above test development builds?

If all is fine please close this issue.

Thanks

Joey-1970 commented 1 year ago

Hi DigiH,

I try but I maybe choise the wrong version (esp32dev-ble-mqtt-undecoded)? (I'm very new is this technic...) I get data, but not from the Mopeka sensor...

Joachim

DigiH commented 1 year ago

Hi Joachim,

Yes, esp32dev-ble-mqtt-undecoded only send data undecoded to be decoded by a central Theengs Gateway installation.

The binary you want for direct decoding and publishing to MQTT on your ESP32 is

esp32dev-ble

Let us know how you get on.

Thanks

Joey-1970 commented 1 year ago

Yes, yes, yes!!!

Look all good! :-)

31.05.2023, 21:11:14 | MQTT:RX:PUBLISH | Topic: home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/FD84BADB79C2, Payload: {"id":"FD:84:BA:DB:79:C2","rssi":-85,"brand":"Mopeka","model":"Pro Check Sensor","model_id":"M1017","type":"UNIQ","tempc":18,"tempf":64.4,"lvl_cm":8.571037,"lvl_in":3.374424,"sync":false,"volt":2.59375,"batt":60.57692,"quality":2,"accx":45,"accy":-46}

Many thanks!

DigiH commented 1 year ago

Thanks for the confirmation! Closing