<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><blockquote type="cite" class="">Maybe a more useful config setting would be a way to limit the update<br class="">rate depending on the "cost" of the network connection.  The simple case<br class="">would just distinguish wifi or modem; there might also be justification to<br class="">treat particular SSIDs or GSM providers differently (e.g. treat mobile wifi<br class="">hotspot as "expensive", or a GSM provider with unlimited data as "cheap”).</blockquote><div class=""><br class=""></div>Seems reasonable, and easy to implement.<div class=""><br class=""></div><div class="">So long as there is some mechanism to keep the MQTT connection alive, there is no requirement to send data periodically. We do that purely to (a) keep the connection alive, (b) provide historical data for storage at the server, and (c) provide the App with a view of the last known state of the car (even if the car is disconnected).<br class=""><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">I then started musing about adding some way to be more selective about<br class="">which metrics are sent to the server in these cases, which made me<br class="">realise that the real problem is that the server (or "MQTT broker")<br class="">is in the wrong place: it should be on the module itself.</blockquote><div class=""><br class=""></div>While going without a server seems like a good idea (in the early days of OVMS that is what we tried), it has a fatal flaw; on the vast majority of cellular networks (if not all), you don’t get a public IP and certainly don’t get one that is Internet routable inbound. There is no way for the App to connect to the cellular module.</div><div class=""><br class=""></div><div class="">For example, this is what I get:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">OVMS# network</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Interface#2: pp2 (ifup=1 linkup=1)</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">  IPv4: 10.52.40.80/255.255.255.255 gateway 10.64.64.64</span></font></div></div></blockquote><div class=""><br class=""></div><div class="">A RFC1918 private IP address.</div><div class=""><br class=""></div><div class="">There are a bunch of ‘tricks’ around this, involving a broker in the cloud, UDP protocol, and relying on connection tracking idiosyncrasies. That would work for a custom protocol, but not for something like MQTT.</div><div class=""><br class=""></div><div class="">Regards, Mark.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 30 Aug 2018, at 5:57 PM, Robin O'Leary <<a href="mailto:ovmsdev@caederus.org" class="">ovmsdev@caederus.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I've been using the "MQTT Dash" Android app in preference to the old v2<br class="">app for the past month, and it's been great.  But one thing I have run in<br class="">to is that data usage to the v3 server has shot up compared with v2---so<br class="">much so, that I exceeded the free quota from Hologram (which had been<br class="">plenty when only using v2).<br class=""><br class="">I know I can increase the config value "server.v3.updatetime.idle", which<br class="">made me wonder what I lose by setting it really high: if no client is<br class="">connected, is there much point in sending updates at all?  I suppose it<br class="">makes sense if the server is logging it, but is that the case?  I found<br class="">old documentation for getting historical data from the v2 server, but<br class="">no mention of v3.<br class=""><br class="">Maybe a more useful config setting would be a way to limit the update<br class="">rate depending on the "cost" of the network connection.  The simple case<br class="">would just distinguish wifi or modem; there might also be justification to<br class="">treat particular SSIDs or GSM providers differently (e.g. treat mobile wifi<br class="">hotspot as "expensive", or a GSM provider with unlimited data as "cheap").<br class=""><br class="">I then started musing about adding some way to be more selective about<br class="">which metrics are sent to the server in these cases, which made me<br class="">realise that the real problem is that the server (or "MQTT broker")<br class="">is in the wrong place: it should be on the module itself.  This would<br class="">be especially useful for local clients, e.g. phone running MQTT app<br class="">connected to OVMS in "Access point" mode.  Remote clients would have<br class="">the additional problem of discovering the broker's address, but maybe<br class="">that could be solved some other way, e.g. DDNS, sshtunnel, VPN.  One down<br class="">side would be that multiple remote clients interested in the same metrics<br class="">would cause them to be sent multiple times, but maybe that is acceptable<br class="">for the gain in simplicity.<br class=""><br class="">It looks like mongoose can run as a broker (MG_ENABLE_MQTT_BROKER).<br class="">That's obviously a big change in architecture, which no doubt has<br class="">implications I haven't though of, but might that be a viable option?<br class="">_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.openvehicles.com" class="">OvmsDev@lists.openvehicles.com</a><br class="">http://lists.openvehicles.com/mailman/listinfo/ovmsdev<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>