hkicko / CubeCell-GPS-Helium-Mapper

MIT License
31 stars 20 forks source link

integration with mydevices cayenne #1

Closed megabyte2010 closed 2 years ago

megabyte2010 commented 2 years ago

works well. there is any plans to integrate with cayenne? Maybe an option in the code to select mappers or cayenne format and a decoder. Thank you for your great work.

hkicko commented 2 years ago

Never heard of it. I will have to do some research.

megabyte2010 commented 2 years ago

In mydevices cayenne you can have a dashboard with displayed values sent by the device. they have android app that can display a map, and that is one of the reasons i ask for integration. The lora payload has to be sent in cayenneLPP format.

https://developers.mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload-examples-device-with-gps

hkicko commented 2 years ago

OK, so I ran some experiments. I'm guessing this can be done in a few ways. First - as you are asking - change the mapper to send it's data in CayenneLPP format. This one is easy and I don't like it because it allows very limited amount of data. If we do that, then we can't really use it as a mapper, we are limiting ourselves to only send long/lat and altitude. I am not a fan of this, but I can give you instructions how to do it if you want. Another possible way I guess is to use MQTT, keep our current data format and from Helium Console, instead of using the myDevices integration, we use the MQTT one and point it to myDevices. I haven't explored this one. So, if you want to do it by changing the format, you need to change method prepareTxFrame to this (I stole this from the code for the T-Beam mapper): bool prepareTxFrame(uint8_t port) {
int32_t lat = GPS.location.lat() 10000; int32_t lon = GPS.location.lng() 10000; int32_t alt = GPS.altitude.meters() * 100;

appDataSize = 0; appData[appDataSize++] = 0x01; appData[appDataSize++] = 0x88; appData[appDataSize++] = lat >> 16; appData[appDataSize++] = lat >> 8;
appData[appDataSize++] = lat; appData[appDataSize++] = lon >> 16; appData[appDataSize++] = lon >> 8; appData[appDataSize++] = lon; appData[appDataSize++] = alt >> 16; appData[appDataSize++] = alt >> 8; appData[appDataSize++] = alt;

return true; }

Then in Helium console, you add myDevices Cayenne integration, give it a name and save, then you add it to the flows and connect it directly to your device, bypassing any decoders. In myDevices you add a device, select LoRa, Helium, scroll down to CayenneLPP, give it a name, paste the DevEUI from Helium Console, save (leave "This device moves" selected or select it if not selected already).

megabyte2010 commented 2 years ago

I'm going to try the code change to see if it is what I'm looking for, but not yet because the helium gateways are far away from where I live, so no connection. I know this is a mapper but the idea was to have a tracker and a app that could show where the tracker is and where he was, in conclusion, to have some history, all in a simple app and with some privacy because we wasn't using the mappers. Thank you. By the way, the latest code update is working well. He is sending data to mappers like he should and the battery time is more or less the same.

hkicko commented 2 years ago

Check the new Tracker mode I added for you :)