[Ovmsdev] Simple TCP client
Mark Webb-Johnson
mark at webb-johnson.net
Mon Aug 24 07:46:13 HKT 2020
The vehicle module is definitely the wrong place to do this.
If you really want to implement in C++, I suggest you look at the ovms_server_v3 module. You could use that as a template for what you need. It should periodically read from the metrics, and send what you need to your home automation.
You should also consider a javascript plugin to do this. That would probably be simpler and easier to update (without firmware changes). If it is a common home automation system, you could write it as a plugin and share for others with the same system.
Regards, Mark
> On 24 Aug 2020, at 12:00 AM, Soko <ovms at soko.cc> wrote:
>
> Hi Mark,
>
> I have my own home automation running at home. I want to push the current values (SoC, odometer, ...) once my car is in the driveway and OVMS is booked into my WiFi. My home automation has a TCP server running were I process the data further.
>
> I don't want to the OVMS Server functionality as I'm not a Linux guy, don't want the data in the internet and no SIM use on the OVMS.
>
> So does the canlog_tcpclient.cpp take care of the concurrency etc. correctly? I will do the same in my code. Or should I start a separate task from the vehicle task for every push?
>
> thx
> Soko
>
> On 23 August 2020 16:37:46 CEST, Mark Webb-Johnson <mark at webb-johnson.net> wrote:
> What are you trying to do?
>
> From a design point of view, it seems strange to have an outgoing tcp connection from a vehicle module. Those modules need to be very responsive and realtime.
>
> Mongoose is the correct approach. But take care, because most of the work is done in the network (not vehicle) task, so you need to deal with mutex and other concurrency issues.
>
> Regards, Mark
>
> On 23 Aug 2020, at 7:54 PM, Soko <ovms at soko.cc> wrote:
>
> Hey everyone,
>
> I'm trying to send a simple tcp msg to a remote tcp-server. I've looked into the FreeRTOS example (esp-idf\examples\protocols\sockets\tcp_client\) which works (kinda) but OVMS behaves weirdly when I do it like that.
>
> Thomas pointed me to mongoose...
>
> So is this the way to go? I would take canlog_tcpclient.cpp as a model...
>
> Ohh... and is it OK if I send my tcp msg in the vehcile task? Mongoose should take care of unforeseen errors so the task shouldn't block, right?
>
> thx
>
> Soko
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20200824/721b7416/attachment.htm>
More information about the OvmsDev
mailing list