Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added WiPhone LoRa support #1458

Merged
merged 3 commits into from
Mar 12, 2023
Merged

Conversation

xopr
Copy link
Contributor

@xopr xopr commented Feb 14, 2023

Description:

This PR enables decoding WiPhone LoRa packets.
WiPhone uses the RadioHead library which adds some extra bytes to the header, but is currently unused (as per default 0xFFFF0000).

The format is as followed:

  uint8_t rh_to; // currently 0xff
  uint8_t rh_from; // currently 0xff
  uint8_t rh_id; // currently 0x00
  uint8_t rh_flags; // currently 0x00
  uint16_t magic; // always 0x6c6d
  uint32_t to; // ESP ChipID or 0x00000000 for "broadcast"
  uint32_t from; // ESP ChipID
  char message[230];

I modified the LoRa to support more devices in the future, but I would like to see a mechanism similar as used in the rtl_433_ESP library;
Then again, this library does support the sx127x chipset (that also does LoRa) already, it only doesn't support the RFM9xW.

Sending a message would be as simple as:
mosquitto_pub -h 127.0.0.1 -t "home/OpenMQTTGateway_ESP32_LORA/commands/MQTTtoLORA" -m '{"type":"WiPhone","from":"C0FFEE","to":"0","message":"Hello from OMG"}'

Incoming messages will look like:
home/OpenMQTTGateway_ESP32_LORA/LORAtoMQTT {"rssi":-113,"snr":5.5,"pferror":18748,"packetSize":34,"from":"123456","to":"000000","message":"hi from wiphone","type":"WiPhone"}

Checklist:

  • The pull request is done against the latest development branch
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • I accept the DCO.

Notes:

To be honest, I'm not sure if people want to have the LoRa library extended to support decoding different payloads, but I thought it was the right thing to do (I came across this library which had all the fantastic features I needed, except LoRa payload decode support).

Also:

  • When non-ascii data arrives, it converts to hex and will put the data in LORAdata["hex"] (and the other way around)
  • I used the conversion methods from Taken from main/ZgatewaySRFB.ino, but it might be better to have a helper class that one could use to do these conversions.
  • I also added invertIQ support for downstream/multiple gateway support

Let me know what you think.
Cheers.

@1technophile
Copy link
Owner

That's great. Thanks for pushing this. I did not know about the WiPhone, it seems very interesting.

@xopr
Copy link
Contributor Author

xopr commented Feb 14, 2023

Oops, I see that I messed up on the linting part.
I have to admit that PlatformIO support on VSCodium (which I use) is a bit flaky.

Is there something I could do? I noticed that it seems to reformat the code but the check still failed.

By the way, WiPhone also has a GitHub repo, but their firmware source is still in the process of being developed and prepared for a first public release: https://github.com/ESP32-WiPhone

@1technophile
Copy link
Owner

1technophile commented Feb 14, 2023

Is there something I could do? I noticed that it seems to reformat the code but the check still failed.

You should be able to format automatically by a right click on the document from VSC, and click "Format document"

@xopr
Copy link
Contributor Author

xopr commented Feb 14, 2023

You should be able to format automatically by a right click on the document from VSC, and click "Format document"

Thanks, that worked better than I'd expect from my setup :)

@1technophile
Copy link
Owner

@kamaradclimber would you be interested in reviewing this PR as you were the previous commiter of this module

@xopr
Copy link
Contributor Author

xopr commented Mar 3, 2023

@kamaradclimber let me know if you have any concerns regarding this PR; I don't want to break or hijack your code :)

I'm currently using it as a hub for my WiPhone and also monitoring binary messages in my neighbourhood.
I can probably poke a friend for testing the new features as well.

Thanks / merci

@kamaradclimber
Copy link
Contributor

I'm fine, if any issue I'll fix them on my side ;)

@xopr
Copy link
Contributor Author

xopr commented Mar 11, 2023

@1technophile is this PR something you could approve / merge?

@1technophile
Copy link
Owner

Thanks

@1technophile 1technophile merged commit 504463c into 1technophile:development Mar 12, 2023
@xopr
Copy link
Contributor Author

xopr commented Mar 12, 2023

Thanks for the quick response!

xopr added a commit to xopr/OpenMQTTGateway that referenced this pull request Mar 12, 2023
xopr added a commit to xopr/OpenMQTTGateway that referenced this pull request Mar 12, 2023
xopr added a commit to xopr/OpenMQTTGateway that referenced this pull request Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants