User Tools

Site Tools


mosh:protocol_overview

This is an old revision of the document!


Architectural Overview

The following diagram illustrates the overall architecture of the MOSH library.

Element Manager

The Element Manager is the hardware-to-MOSH interface. It reads raw hardware data, and separates it into properties used by other MOSH elements. This separation allows an elements properties to reflect their intended use more clearly, and enables different properties from the same device to be routed independently. For example:

  • A basic switch's hardware state (0 or 1) is read by the Element Manager, and provides it to other MOSH elements as its logical state (e.g., On or Off).
  • A GPS module may provide multiple properties—location and time—that can be assigned to different Virtual Wires.

The Element Manager also maintains a list of element properties to be the used by the Virtual Wire Manager.

Virtual Wire Manager

Before an element can communicate with other elements, it must be placed on a Virtual Wire. A Virtual Wire in MOSH is a logical connection between two or more elements—similar to a physical wire that connects a switch to a light, but defined entirely in software. Virtual wires allow input elements (like buttons or sensors) to send signals to output elements (like LEDs or relays), regardless of where those elements reside on the network.

Virtual wires are transport-agnostic, meaning they can connect elements across different nodes, transports (e.g., ESP-NOW, Serial), or even across bridges.

Concept

Virtual wires are declared in element configuration using the `virtual_wire` parameter. When an input element triggers a status message (e.g., `PRESS`, `STATE_ON`), the virtual wire automatically forwards that message to all connected outputs.

This allows you to create automation logic without hard-coding behavior into individual element classes.

Runtime Behavior

Virtual wires transmit:

  Property change messages (e.g., state, event)
  Status messages (e.g., PRESS, LONG_PRESS)
  User-defined messages (e.g., USER_DEF1, etc.)

The Element Manager handles virtual wire delivery internally, ensuring messages are routed to all subscribed elements—locally or remotely.

Features

  • One-to-many routing supported
  • Elements can subscribe to multiple virtual wires
  • Cross-node and cross-transport compatible
  • Supports event-triggered or property-based messaging

Message Framer

The Message Framer is responsible for a variety of MOSH functions. Some of these functions include:

  • The final construction of MOSH Messages
  • Accepting message requests from the Virtual-Wire Manager
  • Accepting/Sending messages to/from the Transport Manager

Transport Manager

/var/www/wiki.moshnetworks.com/data/attic/mosh/protocol_overview.1751037603.txt.gz · Last modified: by mosh

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki