highlandtech-ch5hooks v1.0.11
Collection of React Hooks for Crestron CH5 Projects Tested with Crestron CRComLib : 2.11.0
Example usage:
Subscribe to single events:
const Mode = useSubscribeAnalog(50
); // analog join 50
const power = useSubscribeDigital(99
); // digital join 99
const Name = useSubscribeSerial(10
); // serial join 10
Subscribe to collections. Useful when you have a group of joins and may need to loop through the arrays
// Create the Collection Constants const display1Source, display2Source, display3Source, display4Source, display5Source, display6Source, display7Source, display8Source, = useSubscribeSerialCollection( // Assign the join numbers for the constants "300", "301", "302", "303", "304", "305", "306", "307", );
Publish Events:
---------------------------Analogs------------------------- Create a analog constant : const value = useSetAnalog("800"); Send analog join "800" a value of "300" : value("300")
---------------------------Digitals-------------------------
Pulse:
Create a digital constant: const requestHelp = usePulseDigital();
Pulse digital join "10" for .75 seconds : helpRequest(10
)
Set:
Create a digital constant: const lock = useSetDigital();
Set digital join to either true to false : lock(10
, true) : lock(10
, false)