/PyVbus-2

A simple way to read data from a Resol VBus/LAN adapter using Python 2/3

Primary LanguagePythonBSD 2-Clause "Simplified" LicenseBSD-2-Clause

PyVbus

Usage

import Vbus
con = Vbus.VBUSConnection(
    "HOST", password="ILikeCheese"
    # These are optional. This is the same as setting debugmode to DEBUG_ALL
#   ,debugmode = Vbus.DEBUG_HEXDUMP | Vbus.DEBUG_COMMAND | Vbus.DEBUG_PROTOCOL
)
con.connect()

# Use the default pre-defined payloadmap
data = con.data()
print data # Print the datamap

# Use a custom payloadmap
payloadmap = {
    # Offset, size, factor
    'temp1': (0, 2, 0.1),
    'temp2': (2, 2, 0.1),
    'temp3': (4, 2, 0.1),
    'temp4': (6, 2, 0.1),
    'temp5': (8, 2, 0.1),
    'pump1': (24, 1, 1),
    'pump2': (25, 1, 1)
}

data = con.data(payloadmap)
print data

Payloadmaps

If you do not know what the source map of your vbus device then enable DEBUG_PROTOCOL. This will make it print the source map identifier. You can look up how to implement your source map by just searching for the source map hex in this document.

Python support

PyVbus supports both Python3 as well as Python2. Please note what version you are using and mention it when creating an issue.

Screenshot

This screenshot was taken with all the debugmodes enabled. screenshot

Note: The small table at the bottom was a small bit of extra code this table was generated by just linking the data the con.data returns ti existing knowledge of what value in the payload corresponds to the correct value in my house.

License

Copyright (c) 2015
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.