[Ovmsdev] MQTT and Ovms Server v3
mark at webb-johnson.net
Mon Jul 16 13:49:21 HKT 2018
I’ve also committed (in client/ovms_v3shell.pl) a small demonstration command line client written in perl:
# ./ovms_v3shell.pl --username MYUSER --id MYCAR --server api.openvehicles.com <http://api.openvehicles.com/> --password TOPSECRET
Connecting to api.openvehicles.com:1883/MYUSER…
OVMS# metric list m.
m.hardware OVMS WIFI BLE BT cores=2 rev=ESP32/1
m.net.provider CSL Hologram
m.version 3.1.008-51-g960e1c3/ota_0/edge (build idf v3.1-dev-1583-g0fb2019 Jul 11 2018 00:00:34)
OVMS# module memory
Free 8-bit 140088/282736, 32-bit 7304/23560, SPIRAM 4068736/4194252
--Task-- Total DRAM D/IRAM IRAM SPIRAM +/- DRAM D/IRAM IRAM SPIRAM
main* 8704 0 0 8696 +8704 +0 +0 +8696
OVMS NetMan* 0 0 0 64 +0 +0 +0 +64
no task* 5376 0 0 0 +5376 +0 +0 +0
esp_timer 23884 0 644 44600 +23884 +0 +644 +44600
OVMS Events 67676 0 0 24000 +67676 +0 +0 +24000
ipc0 7776 0 0 0 +7776 +0 +0 +0
ipc1 12 0 0 0 +12 +0 +0 +0
Tmr Svc 88 0 0 0 +88 +0 +0 +0
tiT 700 0 0 5948 +700 +0 +0 +5948
OVMS SIMCOM 0 0 0 3888 +0 +0 +0 +3888
wifi 9496 0 0 2828 +9496 +0 +0 +2828
OVMS Vehicle 0 0 0 32 +0 +0 +0 +32
OVMS Console 0 0 0 20 +0 +0 +0 +20
mdns 104 0 0 4 +104 +0 +0 +4
OVMS NetMan 12584 0 15488 3472 +12584 +0 +15488 +3472
That sends commands to the car over MQTT (so works over cellular as well as wifi networks).
P.S. It is pretty rudimentary at the moment, and doesn’t catch errors that well, but is a good starting point. It does follow the OVMS v3 protocol conventions, and handles last will and testament, etc, correctly.
> On 16 Jul 2018, at 12:47 PM, Mark Webb-Johnson <mark at webb-johnson.net> wrote:
> Drupal authentication is done, and working against mosquitto now on the live api.openvehicles.com <http://api.openvehicles.com/> site. Plain text MQTT only at the moment (I still need to get mosquitto and OVMS module firmware supporting SSL).
> To configure OVMS v3 to use Server V3 protocol:
> config set:
> vehicle id <vehicleid>
> server.v3 server api.openvehicles.com <http://api.openvehicles.com/>
> server.v3 port 1883
> server.v3 user <openvehicles.com <http://openvehicles.com/> username>
> password server.v3 <openvehicles.com <http://openvehicles.com/> password>
> server v3 start
> Can also 'config set auto server.v3 yes’ to auto-start at boot
> If you have an MQTT client, you can connect to the same server to query the metrics, issue commands, etc. The default topic hierarchy is ovms/<username>/<vehicleid>.
> I think we are close now. Just need SSL support. And then Apps…
> Feedback appreciated.
> Regards, Mark.
>> On 10 Jul 2018, at 2:42 PM, Mark Webb-Johnson <mark at webb-johnson.net <mailto:mark at webb-johnson.net>> wrote:
>> I’ve just pushed the support for notifications in OVMS Server v3.
>> With that, the server v3 is functionally complete (at least on the car side). We can:
>> Handle lists of apps connecting/disconnecting
>> Send metrics
>> Send events
>> Send notifications (including info, error, alert, and historical data)
>> Receive commands, run them, and return the results
>> I’m still struggling against drupal authentication at the server side; once that is done we can open this up to wider testing.
>> Overall, I’m pretty happy with it. We need SSL/TLS support, but at least functionally now it works and is complete.
>> Regards, Mark
>>> On 6 Jul 2018, at 4:16 PM, Mark Webb-Johnson <mark at webb-johnson.net <mailto:mark at webb-johnson.net>> wrote:
>>>>>> I suppose the following topic names:
>>>>>> metrics: <prefix>/metric/#
>>>>>> events: <prefix>/event/#
>>>>>> notifications: <prefix>/notify/#
>>>>>> config: <prefix>/config/#
>>>>>> logs: <prefix>/log/<tag>
>>>>>> active: <prefix>/client/<clientid>/active
>>>>>> requests: <prefix>/client/<clientid>/request/#
>>>>>> commands: <prefix>/client/<clientid>/command/<command id>
>>>>>> cmd responses: <prefix>/client/<clientid>/response/<command id>
>>>>> All ok. I am fine with this, and looks clean. I will make the changes today, as I want to get this into some cars asap so we can get a feel for how it behaves.
>>> Ok. Now implemented, and tested:
>>> <prefix>/client/<clientid>/command/<command id>
>>> <prefix>/client/<clientid>/response/<command id>
>>> I don’t think config, logs, and requests are critical or urgent. So, I will try to finish events tonight (as that is relatively simple). Notifications over the weekend (more tricky, especially for historical data). It can go in my car with tonight’s nightly ota, for real world testing.
>>> I’m still trying to get the authentication working for drupal vs mosquitto. Once that is done, I can open up api.openvehicles.com <http://api.openvehicles.com/> MQTT for public use. If I can’t get it done within the next couple of days, I’ll try another broker (lua scripting, anyone?).
>>> P.S. Commands over MQTT are pretty cool:
>>> Regards, Mark.
>>> OvmsDev mailing list
>>> OvmsDev at lists.openvehicles.com <mailto: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 <mailto:OvmsDev at lists.openvehicles.com>
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OvmsDev