Read the statement by Michael Teeuw here.
Volvo on Call
-
@mz-ber Oh I guess I understand. If the function is not getting the right details than ->
eif everything is okay than ->sdo -
@mz-ber exec(“voc list”, (e, sdo, sde)=
execs the command “voc list”
and the exec function returns
error (e)
stdout (sdo)
and stderr(sde)so if no error (e is null)
it sends the command output to the listResults function
-
@sdetweil Thank you for the explanation. Is the function executing
voc listin the terminal? If I’m doing manuallyvoc listI’m getting a result.Is there a way to see what the script is getting back in detail?
Again, thank you very much!
-
@mz-ber yes executing just like on console
nothing built in to show results.
but you could add a
console.log(sdo)
before the call to listResults()
and see it where u start mm
npm startit should be the same outout
-
@sdetweil Alright, I added the console.log before the call
listResult()and it is getting the details from my car. I feel sooo close to get this running but I dont know where it is stuck. :anguished_face:
Is maybe the regex search not getting the details viewed?
listResult: function(output) { var re = /^([^ ]+)\s\(([^\)]+)\)\s([^ ]+)$/gm -
@mz-ber so the regular expression isn’t finding your text
/^([^ ]+)\s\(([^\)]+)\)\s([^ ]+)$/gmI use this for building and testing rejects
-
@sdetweil Yes, I also checked that with regex101. Can I just parse in the details I have?
listResult: function(output) { var re = B-PY 186 (V90) XVASS123345 -
@mz-ber the regex returns an array of matched things
-
@mz-ber i think the regex is not expecting the 186
try ths one
/^([^ ]+)\s.*\(([^\/]+)\/([^\)]+)\)$/gmstart of string ^
capture up to the 1st space ([^ ]+)
skip everything to (and including) the open paren \s.*(
get the two things in the parens, separated by /, not including the parens
capture up to the slash ([^/]+)
skip the slash /
capture up to the close pareen ([^)]+)
skip the close paren )
end of string $ -
@sdetweil Your one is not working. Here are the details I try to get:
B-PY 186 (V90/2019) YV1PWAKUDK1XXXXXXI also played a bit with the expression and removed the white space:
before:
listResult: function(output) { var re = /^([^ ]+)\s\(([^\)]+)\)\s([^ ]+)$/gmafter:
listResult: function(output) { var re = /^([^]+)\s\(([^\)]+)\)\s([^]+)$/gmThat is working based on regex101 and I dont get the error anymore. But nothing is loaded into the MM
-
@mz-ber the regex has to return 3 items
-
@sdetweil Right! And I guess it is doing so? Or am I wrong?

-
@mz-ber i do not know what the module is expecting or its process
it also does a voc dashboard…
and parses that… -
@sdetweil Yes, I guess
voc listshould work. But really quick tovoc dashboardThat is the list I’m getting
B-PY 186 Position : (52.55352783203125, 13.4XXXXXXXXXX6, '2022-03-06 20:20:32+01:00', None, None) B-PY 186 Door lock : Locked B-PY 186 Heater : Off B-PY 186 Odometer : 34484 km B-PY 186 Trip meter 1 : 131 km B-PY 186 Trip meter 2 : 1 km B-PY 186 Fuel amount : 40 L B-PY 186 Fuel level : 72 % B-PY 186 Fuel consumption : 9.9 L/100 km B-PY 186 Range : 440 km B-PY 186 Average speed : 31 km/h B-PY 186 Last trip : 2022-03-06 20:20:32+01:00 B-PY 186 Engine : On B-PY 186 Door lock : On B-PY 186 Hood : Closed B-PY 186 Tailgate : Closed B-PY 186 Front left door : Closed B-PY 186 Front right door : Closed B-PY 186 Rear left door : Closed B-PY 186 Rear right door : Closed B-PY 186 Front left window : Closed B-PY 186 Front right window : Closed B-PY 186 Rear left window : Closed B-PY 186 Rear right window : Closed B-PY 186 Front right tyre : OK B-PY 186 Front left tyre : OK B-PY 186 Rear right tyre : OK B-PY 186 Rear left tyre : OK B-PY 186 Washer fluid : OK B-PY 186 Brake Fluid : OK B-PY 186 Service : OK B-PY 186 Bulbs : OK B-PY 186 Doors : Closed B-PY 186 Windows : ClosedWith the regular expression
/^([^\s]+)\s([\w\s]+)\:\s(.+)$/gmit is not perfectly matching the groups:
B-PY 186should be always in group 1. Do you have an idea to adjust the expression? -
I got it to work! Finally.
The whole problem was my licence plate. The regular expression wasn’t able to grab the right groups. Thank you @sdetweil for helping me to investigate.
-
@mz-ber how did u fix the regex?
i would change the 1st capture to
in the list^([^\(]+)\s =capture up to but not including (in the scan = capture 1st 8 chars
how long is a license number? always 8?^(.{8})\s -
@sdetweil said in Volvo on Call:
German Number Plates can have the following format:
ABC-D 123 ABC-DE 12 AB-C 123 A-BC 1234I’m using this regex to get the variations:
^([A-Z]{1,3}-[A-Z]{1,2}\s[0-9]{1,4})\s([\w\s]+)\:\s(.+)$ -
@mz-ber you are missing some german number plates:
AB-CD 123Eelectric vehiclesAB-CD 123Holdtimer, but probably not relevant because they do not have the digital information :DThe other exceptions are not relevant for private vehicles.
-
@strawberry-3-141 True! Good catch! So I guess every variation can also have an
Eat the end. Do you know if there is a whitespace between the last digit and the E? If it is without a space, this will work:^([A-Z]{1,3}-[A-Z]{1,2}\s[0-9,E]{1,5})\s([\w\s]+)\:\s(.+)$ -
@mz-ber officially there is no space in between the numbers and the suffix, but I work for a provider of a mobility platform and I can tell you that users frequently come up with their own formats like
AB-CD123(no space) orAB-CD 123 E(extra space).Your regex works, but it would also cover some invalid plates like the following in case you want a challenge to improve your regex:
-
AB-CD 0E5E8 -
The number can’t start with a 0
-
The E can only be in the end not mixed with the numbers
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
