MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / handler

Function handler

src/commands/locations/modes/setcurrent.ts:39–50  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

37 .epilog(buildEpilog({ command, apiDocs: 'changeMode' }))
38
39const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
40 const command = await apiCommand(argv)
41
42 const [modeId, locationId] = await chooseMode(command, argv.id, { locationId: argv.location })
43 await command.client.modes.setCurrent(modeId, locationId)
44
45 const mode = await command.client.modes.get(modeId, locationId)
46 const name = mode.label ?? mode.name ?? 'unnamed mode'
47 const location = await command.client.locations.get(locationId)
48
49 console.log(`current mode for ${location.name} (${location.locationId}) set to ${name} (${mode.id})`)
50}
51
52const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
53export default cmd

Callers

nothing calls this directly

Calls 2

apiCommandFunction · 0.85
chooseModeFunction · 0.85

Tested by

no test coverage detected