This project contains a custom Python library designed for interacting with CAN devices via a serial connection, mainly designed to be a POC(Proof Of Concept) in the topic:
- control_lights.py: Sends commands to control connected CAN device.
- read_inputs.py: Reads and parses input states from a CAN device.
- visualize_floorplan.py: Visualizes a home with smart devices.
- temperature_controller.py: An example file for Node-RED https communication, used to send a random temperature value to a custom HTTP end-point.
As a proof of concept project, the scripts currently uses hard coded default values for BIT and BAUD-RATE settings, also using the COM3 port.
- Bits per second: 115200
- Baud-Rate: 125k
- Send CAN messages to control devices.
- Parse and display input states received from the CAN device.
- View the state of connected devices using a matplotlib visualization
- Flexible and customizable for different CAN setups.
- Navigate to the root folder of the project using your preferred terminal
- Install requirements using pip install -r requirements.txt
- Install the library using pip install . (the . is part of the command too)
- Python 3.6 or later with pip
- Hardware to communicate with, my setup insisted of a CANUSB device, a CANopen GCAN4032 with two switches as input dummies and a power supply.
After installation, the following commands can be executed from your preferred terminal:
- control_devices arg:command Use this command to control connected devices. Example: control_devices t20220000
- read_data Reads the DI states on the GCAN device
- visualize_floorplan Using the read_data commmand, visualizes the input states using a dummy matplotlib home visualization.
- set_temp Sends a dummy value for Node-RED https communication, used to send a random temperature value to a custom HTTP end-point.