-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This is a utility script to use VAHEAT via USB serial communication. A python script pyvaheat.py contains a Vaheat class which wraps serial class. It can be loaded from external script. And it also has interactive command line interface (CLI) program when it runs from a console.
If serial module hasn't been installed yet, install it by using pip.
pip install pyserial
Interactive CLI is useful to connect/disconnect, write and read data via USB serial communication with VAHEAT. Just run the script from console (Command prompt or terminal).
python pyvaheat.py
At least one VAHEAT controller should be connected to your PC. The port name is automatically detected.
[
]
- connect : Open serial connection.
- disconnect : Close serial connection.
- port : Change port name. Try to disconnect and connect
- baud_rate : Change baud rate. Try to disconnect and connect
- get_info : The get_info command will reply with information about your device.
- get_status : The get_status command will repoly with information about the status of your device.
- get_settings : The get_settings command will repoly with the settings stored on your device.
- get_streaming : get streaming command will reply with the streaming settings stored on your device.
- get_profile : Get profile specified with number(1-9) and step(1-20)
- start_heating : Start_heating with parameters in JSON
- stop_heating : Stop heating
- start_streaming : Start streaming with parameters in JSON
- stop_streaming : Stop streaming by setting mode to off
- do_reset : Do reset of controller !CAUTION! backup parameters before reset.
- set_keylock : Set keylock of controller (True to lock, False to unlock)
- set_settings : Set settings with parameters in JSON
- set_streaming : Set streaming settings in JSON
- set_mode : Set mode in JSON
- set_profile : Set profiles in JSON
- raw : Toggle on/off 'raw mode' to show raw reading/writing JSON string
- error : The latest error message
- read : Read a raw line from buffer
- read_all : Read all raw lines from buffer
- write : Write a raw line to device
- exit : Exit safe
- quit : Exit safe
- help : Show available commands or docstring of a command
When the script is loaded as module, you can use the wrapper class in your python script. Jupyter notebook would be a quick way to test and prototype your scripts.

The simplest way to start heating assuming pyvaheat.py is same folder of the script.:
from pyvaheat import Vaheat
import time
# Instantiate and connect to device.
vh = Vaheat()
vh.connect()
# Get info and status
print(vh.get_info())
print(vh.get_status())
# Define parameters as dict. The class will convert into JSON string to write.
conf = {"temperature":45}
# Keylock & start heating
vh.set_keylock(True) # Lock buttons of controller.
vh.start_heating(conf) # Start heating.
time.sleep(5)
# Unlock keys & stop heating.
vh.set_keylock(False) # Unlock buttons of controller.
vh.stop_heating()
vh.disconnect()
Check other commands are in section 6 in User manual of VAHEAT.