canome | ||
canome_derive | ||
sml_parser | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE.md | ||
README.md |
CANome is a library that assists you in writing your own CAN based, fully distributed, smart home system.
A bus system provides many benefits over other system. Some of them are listed below:
- Energy Efficiency: Each device only needs to implement the fairly lightweight CAN stack. The bus cable can also transport the required power for the nodes, reducing the numbers of AC-DC-adapters.
- Reliability: A distributed system can handle the loss of nodes without impacting the complete system. Additionally, a wired channel is typically more reliable than a wireless one.
- Security: Embedded security is hard, using a bus doesn't make your application more secure, but you have a greatly reduced attack surface: An attacker needs physical access to your bus to even start to communicate with a node.
Many other smart home projects use a meta-configuration-language to configure the firmware on each device. A distributed system requires more logic on the nodes than a centralized one. A meta-configuration-language will always have missing features that are a core component of a regular programming language, like rust.
This project helps you in creating a distributed smart home system in rust by providing a library with the building blocks. You express the entire node logic as regular embedded rust code using this library to avoid writing extensive repeating code.
Protocol
This project uses a very simple protocol that is based on CAN. Each node can expose states. A state is a Rust type that can be encoded/decoded from a CAN frame. The format of a frame is implicitly transmitted by the CAN message identifier. When a state changes, the node broadcasts the new state on the bus.
Other nodes can "subscribe" to a CAN message identifier. They always store a copy of the state that is automatically updated when a new message with that CAN message identifier arrives. Additionally, a node can use a CAN remote frame to fetch the state from the source node.
Contributing
I'm happy about any contribution in any form. Feel free to submit feature requests and bug reports using a GitHub Issue. PR's are also appreciated.
License
The Sourcecode in this Library is licensed under LGPLv3.