Closed spbrogan closed 2 years ago
Hi @spbrogan Thanks for your interest in the project! :)
RV-C has specific ways it represents different types of numeric data. The data representation depends on if the value is 8bit or 16bit, and what unit the data has ( percent, amps, volts etc ). The conversion is documented in the RVC Spec in table 5.3 starting on page 38. The convert_units function handles conversion from raw integer into the proper output base 10 value.
-- If there's a pressure designation in the RV-C spec, you could certainly add it in the convert_units
function, but otherwise, it wouldn't really be used. I suspect you'd really want to create your own converter function, similar to tempC2F
The MQTT to CAN functionality is currently commented out. By default, the code subscribes to RVC/transmit
and expects the MQTT message contents to be json formatted, something like { 'canid': 0x1234abc, 'payload': 0x351431 }
(not actual values, and even the commented line isn't properly formatted to handle this.. it's more of a left-over from another of my projects where I copied the MQTT code from ).
Parameterize_string function converts the fully spelled out parameter name into something easier for json parsing. e.g. it converts spaces, / and ()'s to underscore. ( for what it's worth, this function does have a decent comment above it explaining what it does.. :D )
Hope this helps!
thanks for the update.
I have a few more questions if you are willing. :)
It doesn't look like the spec yaml and processing loop have any concept of messages that are not simple DGNs. For example, information requests, NAK/ACK messages (rv-c 3.2.4.3 and 3.2.4.4)? Am I missing something?
I see some depreciated messages from the yaml. Is there something special about "ruamel.yaml". I have always used pyyaml but not really sure why it is important the parsed yaml has comments?
PendingDeprecationWarning: round_trip_load_all will be removed, use
yaml=YAML() yaml.load(...)
instead
Again - I appreciate the info. I may start a derivative project because i want to refactor a few things but i am really curious your plans and investments for this project.
Sure, always willing to help!
The status / control functions which were important to CoachProxy ( and Home-Assistant ) don't really need to worry with NAK/ACK messages. So, it never got much attention in code.
We opted to use ruamel.yaml
for the main reason that it can take On
, Off
, True
, False
, and make them a string for outputting into the JSON format. I found that there were decoding oddities that ended up being due to oddities in how the base yaml package handles booleans.
Re: Plans, see my reply in the other open issue. (Oh, and discussions are now enabled :D )
Thanks for the info. I'll close this and move future questions/discussions to the discussion forum.
Any chance the authors would be willing to document a little more of the code and process.
Thanks