garmin-empirbus-ts
v0.1.32
Published
Garmin EmpirBus TypeScript (Clean Architecture)
Readme
Garmin EmpirBus TypeScript (Clean Architecture)
Quickstart:
- cd garmin-empirbus-ts
- npm i
- npm run build
- EMPIRBUS_WS=ws://192.168.1.1:8888/ws npm run start
CLI prints channels and streams updates. Toggle and dim methods are available via repository for later command extensions.
wslog (Viewer)
- Live von WebSocket lesen oder bestehende Logdatei wie
tail -fverfolgen. - Filterbar nach Richtung (in/out) und Text.
- Optionales Mitschreiben in Datei.
Beispiele:
# Live ansehen
node dist/bin/wslog.js --ws ws://192.168.1.1:8888/ws
# Live ansehen und gleichzeitig mitschreiben
node dist/bin/wslog.js --ws ws://192.168.1.1:8888/ws --log traffic.ndjson
# Nur Datei ansehen (tail -f)
node dist/bin/wslog.js --file traffic.ndjsonTasten: F=Filter, I=In, O=Out, A=All, C=Clear, S=Save, Q=Quit
wstap (reiner Mitschreiber ohne UI)
node dist/bin/wstap.js --log traffic.ndjson --ws ws://192.168.1.1:8888/ws$env:EMPIRBUS_LOG="1"
Raw communication observation
EmpirBusClient and EmpirBusChannelRepository expose onCommunication(listener) for passive observation of all valid raw RX/TX EmpirBus telegrams, including heartbeats and system/subscription traffic. Each event contains direction, timestamp, and a copied message. Consumers are responsible for filtering; observation never changes protocol processing.
Target-state switch behavior
Channels learn their MFD control type from incoming MFD status messages (messagecmd 0 = pulse, 1 = momentary, 3 = dimmer, 5 = generic status). switch() uses that runtime information automatically:
- pulse channels receive an explicit ON/OFF command,
- momentary channels compare the requested target with
onOffStatusand send a 150 ms press/release only when the target differs, - unknown or unsupported types fail without sending.
The repository never optimistically changes the cached state after sending a momentary target-state command.
Dimmer scale
Dimmer values use the protocol-level range 0..1000, where 1000 represents 100%. Incoming MFD dimmer status messages are exposed with the raw value in Channel.rawValue and the percentage in Channel.decodedValue.
