mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-26 13:48:49 +08:00
Account for devices which are not commanders
This commit is contained in:
parent
be963f989c
commit
f1e94b5a1a
@ -25,8 +25,10 @@ func NewJSONDevice(device Device) *JSONDevice {
|
||||
if device.Connection() != nil {
|
||||
jsonDevice.Connection = device.Connection().Name()
|
||||
}
|
||||
for command := range device.(Commander).Commands() {
|
||||
jsonDevice.Commands = append(jsonDevice.Commands, command)
|
||||
if commander, ok := device.(Commander); ok {
|
||||
for command := range commander.Commands() {
|
||||
jsonDevice.Commands = append(jsonDevice.Commands, command)
|
||||
}
|
||||
}
|
||||
return jsonDevice
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user