Function: useSwitch()¶
useSwitch(
device,name,element):boolean|undefined
Subscribe to one switch, as a boolean. See useNumber.
Boolean rather than the "On"/"Off" token because that is what a checkbox
or a toggle wants; undefined still distinguishes "not there" from "off".
Parameters¶
device¶
string
The device name.
name¶
string
The property name.
element¶
string
The element name.
Returns¶
boolean | undefined
Whether the switch is On, or undefined when absent or of another kind.