Docs BETA
/

Channels

Get and set the channel planogram


The channels planogram stores the state of all machine channels. We automatically check every channel when the machine is booted up or the door is opened and closed, any channel that was out of stock that is still connected is reset to an in stock state.

Channels and shelves are zero based indices, listed from bottom left to top left. For example a channel plugged into the furthest point left on the bottom most shelf is channel 0 shelf 0.

There are 3 states a channel can be in, listed below. These can only be changed by accessing the hardware. For example a channel is set to O (Out of stock) automatically when the machine has attempted to vend from that channel and nothing has been dispensed. There is no way of resetting that channel to C (Connected) programmatically. The door must be opened and closed for that channel to be accessible again.

CodeTitleDescription
CConnectedConnected and not marked as out of stock
OOut of stockConnected and marked as out of stock
DDisconnectedChannel not connected

Note that "Connected" doesn't necessarily mean that there is stock on that channel. See The Machines for more information on this.

Get

Get the current planogram outlining the status of all channels on the machine.

OS.Machine.channels.get.then(channels => {
  console.log(channels)
})

Example response

[
    // Shelf 0 - At the bottom of the machine
    { channel: 0, status: 'D', pid: null },
    { channel: 1, status: 'O', pid: 123 },
    { channel: 2, status: 'D', pid: null },
    { channel: 3, status: 'D', pid: null },
    { channel: 4, status: 'O', pid: 123 },
    { channel: 5, status: 'D', pid: null },
    { channel: 6, status: 'D', pid: null },
    { channel: 7, status: 'C', pid: 123 },
    { channel: 8, status: 'D', pid: null },
    { channel: 9, status: 'D', pid: null },

    // Shelf 1
    { channel: 10, status: 'D', pid: null },
    { channel: 11, status: 'D', pid: null },
    { channel: 12, status: 'C', pid: 235 },
    { channel: 13, status: 'D', pid: null },
    { channel: 14, status: 'D', pid: null },
    { channel: 15, status: 'D', pid: null },
    { channel: 16, status: 'C', pid: 234 },
    { channel: 17, status: 'D', pid: null },
    { channel: 18, status: 'D', pid: null },
    { channel: 19, status: 'D', pid: null },

    // Shelf 2
    { channel: 20, status: 'D', pid: null },
    { channel: 21, status: 'D', pid: null },
    { channel: 22, status: 'O', pid: 567 },
    { channel: 23, status: 'D', pid: null },
    { channel: 24, status: 'D', pid: null },
    { channel: 25, status: 'D', pid: null },
    { channel: 26, status: 'D', pid: null },
    { channel: 27, status: 'C', pid: 890 },
    { channel: 28, status: 'O', pid: 890 },
    { channel: 29, status: 'D', pid: null },

    // Shelf 3
    { channel: 30, status: 'D', pid: null },
    { channel: 31, status: 'D', pid: null },
    { channel: 32, status: 'O', pid: null },
    { channel: 33, status: 'D', pid: null },
    { channel: 34, status: 'D', pid: null },
    { channel: 35, status: 'C', pid: null },
    { channel: 36, status: 'D', pid: null },
    { channel: 37, status: 'D', pid: null },
    { channel: 38, status: 'D', pid: null },
    { channel: 39, status: 'D', pid: null },

    // Shelf 4
    { channel: 40, status: 'D', pid: null },
    { channel: 41, status: 'D', pid: null },
    { channel: 42, status: 'D', pid: null },
    { channel: 43, status: 'D', pid: null },
    { channel: 44, status: 'D', pid: null },
    { channel: 45, status: 'D', pid: null },
    { channel: 46, status: 'D', pid: null },
    { channel: 47, status: 'D', pid: null },
    { channel: 48, status: 'D', pid: null },
    { channel: 49, status: 'D', pid: null },

    // Shelf 5
    { channel: 50, status: 'D', pid: null },
    { channel: 51, status: 'D', pid: null },
    { channel: 52, status: 'D', pid: null },
    { channel: 53, status: 'D', pid: null },
    { channel: 54, status: 'D', pid: null },
    { channel: 55, status: 'D', pid: null },
    { channel: 56, status: 'D', pid: null },
    { channel: 57, status: 'D', pid: null },
    { channel: 58, status: 'D', pid: null },
    { channel: 59, status: 'D', pid: null },

    // Shelf 6
    { channel: 60, status: 'D', pid: null },
    { channel: 61, status: 'D', pid: null },
    { channel: 62, status: 'D', pid: null },
    { channel: 63, status: 'D', pid: null },
    { channel: 64, status: 'D', pid: null },
    { channel: 65, status: 'D', pid: null },
    { channel: 66, status: 'D', pid: null },
    { channel: 67, status: 'D', pid: null },
    { channel: 68, status: 'D', pid: null },
    { channel: 69, status: 'D', pid: null },

    // Shelf 7 - At the top of the machine
    { channel: 70, status: 'D', pid: null },
    { channel: 71, status: 'D', pid: null },
    { channel: 72, status: 'D', pid: null },
    { channel: 73, status: 'D', pid: null },
    { channel: 74, status: 'D', pid: null },
    { channel: 75, status: 'D', pid: null },
    { channel: 76, status: 'D', pid: null },
    { channel: 77, status: 'D', pid: null },
    { channel: 78, status: 'D', pid: null },
    { channel: 79, status: 'D', pid: null },
]