danielwippermann / resol-vbus

A JavaScript library for processing RESOL VBus data
MIT License
67 stars 34 forks source link

Use RS232/RS486 USB Adapter #28

Closed craggyh closed 5 years ago

craggyh commented 5 years ago

How can I use resol-vbus to decode data from a USB Serial adapter like RS232/485? I have the raw data being logged in Resol Service Center but was hoping to use this software to decode it?

danielwippermann commented 5 years ago

Hi @craigueh,

you can basically start with the vbustouch-proxy example. That example can be configured to use a serial connection instead of the TCP one that is configured by default.

Just follow the installation instructions and after copying the config.js.example to config.js replace the connectionClassName and connectionOptions with the following values:

    /**
     * Name of the Connection class to use to connect.
     */
    connectionClassName: 'SerialConnection',

    /**
     * Options for the Connection instance.
     */
    connectionOptions: {
        path: '...',  // FIXME: whatever your serial port is called
    },

After making and saving those changes, start the example using node index.js. It should then decode the received data and store them in a binary format for conversion at a later time.

Does that cover your request?

craggyh commented 5 years ago

Ok, I made those changes and started node index.js and it starts a webserver at x.x.x.x:3000

However, if I try access that webpage I get "Cannot GET /" Is there a fix for this?

Where does the data get stored so I can take a look and see if the data is good?

Thanks

danielwippermann commented 5 years ago

You can configure the storage location using the loggingPath and textLoggingPath config properties. They default to the cache and the log directories respectively.

danielwippermann commented 5 years ago

The webserver's primary use is to support the VBusTouch iOS app. It provides a subset of the /dlx/download/download webservice endpoint that a RESOL DL2 provides.

You can manually test the endpoint by visiting http://IP:PORT/dlx/download/download?source=current&outputType=json.

craggyh commented 5 years ago

Hmm, it looks like i'm not getting data in, the log file shows nothing but time stamps:

Date / Time 09/04/2019 21:01:26 09/04/2019 21:01:26 09/04/2019 21:01:26 09/04/2019 21:01:26 09/04/2019 21:01:26

danielwippermann commented 5 years ago

There are multiple possible reasons for that:

The last bullet could be checked if you send me the *.vbus file from the cache folder to daniel.wippermann@gmail.com . If the third case is applicable, that file would store the VBus data in binary form regardless whether the device and its payload is known.

danielwippermann commented 5 years ago

The file you sent me only contains timestamps as well, but no payload.

Output from my formatter tool:

$ target/debug/formatter stats ..../10000_20190904202910001.vbus
Min. timestamp: 2019-09-04T20:29:10.001+00:00
Max. timestamp: 2019-09-04T20:43:20.001+00:00
Data set count: 86
Data count: 0
Data IDs:

"Data count: 0" is the indicator here... So the third bullet can be ruled out...

What OS are you using and what did you specify as the path for your serial port?

Does the RSC show any data in the right part of the "raw protocol" page while connected to the serialport?

craggyh commented 5 years ago

I'm using Ubuntu 18 and /dev/ttyUSB0 for the serial port. (Prolific USB to Serial Adapter)

When I view the raw data coming in I see this:

cat /dev/ttyUSB0 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt```````@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@Z@

Not sure what all that is but when I connected the same serial interface to my pc with Resol System Controller the raw data came as what looked like good HEX data and a burst of it comes about every second so i would have expexted the same data to be coming in here to resol-vbus on the linux box. Doesn't seem to be the case though.

craggyh commented 5 years ago

When I disconnect the RX line from the Resol Controller the data stream completely stops so it's definitely pulling in something from the controller over the serial port.

craggyh commented 5 years ago

I have an alternate option, an RS232/485 to Ethernet adapter that can present the serial data as a HTTP GET/POST feed as well as virtual serial port (which I don't know how to get Ubuntu to connect to) but again, when I present this data feed to my PC running the Resol software the raw data shows loads of clean HEX data which I then need to decode.

Is there a way for resol-vbus to take it's data feed from the http get/post on this module?

My end goal here is to present the resol sensors to HomeAssistant via MQTT or similar.

craggyh commented 5 years ago

"Does the RSC show any data in the right part of the "raw protocol" page while connected to the serialport?"

No, the raw protocol sections remains empty even though the hex data continues to flow.

danielwippermann commented 5 years ago

Does the RSC show any data in the right part of the "raw protocol" page while connected to the serialport?"

No, the raw protocol sections remains empty even though the hex data continues to flow.

Ok, then the received data is already not confirming to the RESOL VBus protocol specification. I assume that your adapter is not compatible with the RESOL VBus.

craggyh commented 5 years ago

Indeed you were correct.

I tries the USB RS232, an RS232 to Ethernet and a colleagues RS485 and all produced the same garbaged data. So I quickly built this small circuit from here https://groups.google.com/forum/#!topic/resol-vbus/3CjZffK53ig and connected it to a spare pi3. Now I see the following:

debug: Connecting to VBus... debug: Connection state changed to CONNECTING debug: Connection state changed to CONNECTED debug: Connected to VBus... debug: Starting web server... debug: Starting HeaderSetConsolidator timer... debug: Starting MQTT logging debug: Starting text logging debug: Started web server at: debug: - http://0.0.0.0:3000/ (internal) debug: - http://127.0.0.1:3000/ (internal) debug: - http://10.10.50.31:3000/ debug: 00_0010_4720_10_0100_004_2_0: Temperature sensor 1 00_0010_4720_10_0100_006_2_0: Temperature sensor 2 00_0010_4720_10_0100_008_2_0: Temperature sensor 3 00_0010_4720_10_0100_016_1_0: Pump speed relay 1 00_0010_4720_10_0100_020_4_0: Heat quantity 00_0010_4720_10_0100_024_2_0: SW Version 00_0010_4720_10_0100_028_4_0: Operating hours relay 1 00_0010_4720_10_0100_068_4_0: Error mask

If I open the logged .csv file I now see the following

DeltaSol BS/2 HE                            

Date / Time Temperature sensor 1 [ °C] Temperature sensor 2 [ °C] Temperature sensor 3 [ °C] Pump speed relay 1 [%] Heat quantity [ Wh] SW Version Operating hours relay 1 [ h] Error mask 09/05/2019 13:36:59 63.5 51.5 888.8 30 0 1.00 2931 0 09/05/2019 13:37:09 63.5 51.5 888.8 30 0 1.00 2931 0 09/05/2019 13:37:19 63.5 51.5 888.8 30 0 1.00 2931 0

Looks good :-)

Now I just need to get MQTT working with Homeassistant.