SDEVICE-MIB DEFINITIONS ::= BEGIN

IMPORTS
    MODULE-COMPLIANCE, NOTIFICATION-GROUP, OBJECT-GROUP
        FROM SNMPv2-CONF
    Integer32, IpAddress, MODULE-IDENTITY, NOTIFICATION-TYPE,
    OBJECT-IDENTITY, OBJECT-TYPE, enterprises
        FROM SNMPv2-SMI
    DisplayString, MacAddress, TEXTUAL-CONVENTION
        FROM SNMPv2-TC
    ;

-- example usage:
-- 
-- snmpwalk -c public -m SDEVICE-MIB 192.168.1.200 inputmeasuresTable

schleifenbauer MODULE-IDENTITY
    LAST-UPDATED  "201504131700Z" -- April 13th, 2015
    ORGANIZATION
        "Schleifenbauer Engineering"
    CONTACT-INFO
        "Schleifenbauer Engineering
         Alain Schuermans
         Chief Technology Officer
         Turnhoutseweg 22
         5541 NX Reusel
         The Netherlands
         t. +31 73 5230256
         f. +31 73 5212383
         alain@schleifenbauer.eu
         www.schleifenbauer.eu"
    DESCRIPTION
        "This MIB describes the functions of the Schleifenbauer device
         family."
    ::= { enterprises 31034 }

ConfigurationEntry ::= SEQUENCE
{
    channelIndex2     Integer32,
    noPhases          Integer32,
    noOutletsTotal    Integer32,
    noSwitchedOutlets Integer32,
    noMeasuredOutlets Integer32,
    maximumLoad       Integer32,
    noTempSensors     Integer32,
    noEnvSensors      Integer32
}

DeciAmps ::= TEXTUAL-CONVENTION
    DISPLAY-HINT  "d-2"
    STATUS        current
    DESCRIPTION
        "Data type for reporting measurements and thresholds associated
         with current sensors. If the underlying hardware sensor
         indicates 1.1 amp, then the SNMP agent will report a value of
         11 DeciAmps.  The value is scaled in this manner as a way to
         deal with floating point types that SNMP does not currently
         support."
    SYNTAX        Integer32

DeciCelsius ::= TEXTUAL-CONVENTION
    DISPLAY-HINT  "d-2"
    STATUS        current
    DESCRIPTION
        "Data type for reporting sensor readings associated with
         temperature sensors. If the underlying hardware sensor
         indicates 20.1 degree Celsius, then the SNMP agent will report
         a value of 201  tenth degrees Celsius. The value is scaled in
         this manner as a way to deal with floating point types that
         SNMP does not currently support."
    SYNTAX        Integer32

DeciPowerFactor ::= TEXTUAL-CONVENTION
    DISPLAY-HINT  "d-2"
    STATUS        current
    DESCRIPTION
        "Data type for reporting measurements associated with power
         factor calculation. The power factor of an AC power system is
         defined as the ratio of the real or active power to the
         apparent power and is a number between 0 and 1.  A
         DeciPowerFactor value is calculated by taking this ratio and
         multiplying by 1000. A power factor of 98.3% will be reported
         as 983. The power factor is used to indicate how efficiently a
         particular load is utilizing energy."
    SYNTAX        Integer32

-- Textual Conventions

DeciValue ::= TEXTUAL-CONVENTION
    DISPLAY-HINT  "d-2"
    STATUS        current
    DESCRIPTION
        "Data type for reporting generic measurements associated with
         environmental sensors. If the underlying hardware sensor
         indicates 21.1 degree, then the SNMP agent will report a value
         of 211 DeciValue.  The value is scaled in this manner as a way
         to deal with floating point types that SNMP does not currently
         support."
    SYNTAX        Integer32

DeciVolts ::= TEXTUAL-CONVENTION
    DISPLAY-HINT  "d-2"
    STATUS        current
    DESCRIPTION
        "Data type for reporting measurements and thresholds associated
         with voltage sensors. If the underlying hardware sensor
         indicates 231.1 volts, then the SNMP agent will report a value
         of 2311 DeciVolts.  The value is scaled in this manner as a way
         to deal with floating point types that SNMP does not currently
         support."
    SYNTAX        Integer32

IdentificationEntry ::= SEQUENCE
{
    channelIndex1    Integer32,
    spdmVersion      Integer32,
    firmwareVersion  Integer32,
    salesOrderNumber DisplayString,
    productId        DisplayString,
    serialNumber     DisplayString,
    hardwareAddress  DisplayString,
    unitAddress      Integer32,
    busPosition      Integer32
}

KiloWattHour ::= TEXTUAL-CONVENTION
    DISPLAY-HINT  "d"
    STATUS        current
    DESCRIPTION
        "Data type for reporting measurements associated with energy
         accumulation sensors. If the underlying hardware sensor
         indicates 1 kWh, then the SNMP agent will report a value of 1
         kWh. No scaling is performed for this type."
    SYNTAX        Integer32

MilliSeconds ::= TEXTUAL-CONVENTION
    DISPLAY-HINT  "d"
    STATUS        current
    DESCRIPTION
        "The unit of duration for some settings"
    SYNTAX        Integer32

Seconds ::= TEXTUAL-CONVENTION
    DISPLAY-HINT  "d"
    STATUS        current
    DESCRIPTION
        "The unit of duration for some settings"
    SYNTAX        Integer32

SystemstatusEntry ::= SEQUENCE
{
    channelIndex3      Integer32,
    deviceStatusCode   Integer32,
    temperatureAlert   Integer32,
    inputCurrentAlert  Integer32,
    outputCurrentAlert Integer32,
    inputVoltageAlert  Integer32,
    oCurrentDropAlert  Integer32,
    iCurrentDropAlert  Integer32
}

device0 OBJECT IDENTIFIER ::= { schleifenbauer 2 }

identification OBJECT IDENTIFIER ::= { device0 3 }

spdmVersion OBJECT-TYPE
    SYNTAX        Integer32 (0..9999)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Data model version, currently 1.10"
    ::= { identification 1 }

firmwareVersion OBJECT-TYPE
    SYNTAX        Integer32 (0..9999)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "The units firmware revision number."
    ::= { identification 2 }

buildNumber OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Date and time of latest build of the firmware."
    ::= { identification 3 }

salesOrderNumber OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "SP sales order number."
    ::= { identification 4 }

productId OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "SP product id."
    ::= { identification 5 }

serialNumber OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "SP serial number."
    ::= { identification 6 }

hardwareAddress OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Hardware serial number; cannot be changed. Can be used as
         backup unit address. format as 3 unsigned ints separated by
         dashes: int - int - int"
    ::= { identification 7 }

macAddress OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "The ethernet interfaces unique hardware address."
    ::= { identification 8 }

unitAddress OBJECT-TYPE
    SYNTAX        Integer32 (0..65535)
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "User defined address; this will be used for addressing the
         unit."
    ::= { identification 9 }

deviceName OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "User configurable device name or identifier."
    ::= { identification 10 }

deviceLocation OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "User configurable device location identifier."
    ::= { identification 11 }

vanityTag OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Characters to be displayed as vanity tekst in display."
    ::= { identification 12 }

configuration OBJECT IDENTIFIER ::= { device0 4 }

noPhases OBJECT-TYPE
    SYNTAX        Integer32 (0..3)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Either zero, one or three for no input metering, single or
         three  phase system"
    ::= { configuration 1 }

noOutletsTotal OBJECT-TYPE
    SYNTAX        Integer32 (0..99)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Total number of outlets, even hardwired without switch/measure
         modules."
    ::= { configuration 2 }

noSwitchedOutlets OBJECT-TYPE
    SYNTAX        Integer32 (0..48)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Number of switched outlets. If outlet numbering is
         non-contiguous: the highest outlet number."
    ::= { configuration 3 }

noMeasuredOutlets OBJECT-TYPE
    SYNTAX        Integer32 (0..48)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Number of measured outlets. If outlet numbering is
         non-contiguous: the highest outlet number."
    ::= { configuration 4 }

noSensors OBJECT-TYPE
    SYNTAX        Integer32 (0..4)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "The number of external, digital environmental sensors: 0 for
         none, 1 to 16 depending on number of reported sensors"
    ::= { configuration 5 }

maximumLoad OBJECT-TYPE
    SYNTAX        Integer32 (0..32)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Maximum rated load of device per phase, usually either 16 or
         32 A."
    ::= { configuration 6 }

systemstatus OBJECT IDENTIFIER ::= { device0 5 }

deviceStatusCode OBJECT-TYPE
    SYNTAX        Integer32 (0..255)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Returns an internal status or error code. 0 = OK, 16 =
         watchdog timer caused reset, 128 = slave module was reset, 144
         = both previous."
    ::= { systemstatus 1 }

temperatureAlert OBJECT-TYPE
    SYNTAX        Integer32 (0..2)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "An alert has been raised due to temperature exceeding
         treshhold; 0= no alert; 1= internal unit temp, 2= external
         sensor."
    ::= { systemstatus 2 }

inputCurrentAlert OBJECT-TYPE
    SYNTAX        Integer32 (0..3)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "An alert has been raised due to current exceeding treshhold;
         0=no alert; 1-3 for input phase."
    ::= { systemstatus 3 }

outputCurrentAlert OBJECT-TYPE
    SYNTAX        Integer32 (0..48)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "An alert has been raised due to current exceeding treshhold;
         0=no alert; 1-48 for outlet."
    ::= { systemstatus 4 }

inputVoltageAlert OBJECT-TYPE
    SYNTAX        Integer32 (0..3)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "An alert has been raised due to a voltage dip; 0=no alert; 1-3
         for input phase."
    ::= { systemstatus 5 }

oCurrentDropAlert OBJECT-TYPE
    SYNTAX        Integer32 (0..103)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "An alert has been raised due to the current of a measured
         outlet suddenly dropping to near zero, possibly indicating a
         blown fuse; 0=no alert; 1-48 for outlet."
    ::= { systemstatus 6 }

iCurrentDropAlert OBJECT-TYPE
    SYNTAX        Integer32 (0..3)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "An alert has been raised due to the current of a measured
         input suddenly dropping to near zero, possibly indicating a
         blown fuse; 0=no alert; 1-3 for phase."
    ::= { systemstatus 7 }

reset OBJECT IDENTIFIER ::= { device0 6 }

rebootDevice OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Warm reboot/reset of device; note: this will have no effect on
         outlet status!"
    ::= { reset 1 }

resetAlerts OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Reset all alert signals."
    ::= { reset 2 }

zeroInputKWhSubtotal OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Reset of input kWh subtotal counters to zero."
    ::= { reset 3 }

zeroOutKWhSubtotal OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Reset of outlet kWh subtotal counter to zero."
    ::= { reset 4 }

resetPeakValues OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Reset all peak values to zero, as well input as output
         metering, voltages dips, current peaks and temperatures."
    ::= { reset 5 }

settings OBJECT IDENTIFIER ::= { device0 7 }

general OBJECT IDENTIFIER ::= { settings 1 }

peakDuration OBJECT-TYPE
    SYNTAX        MilliSeconds
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "A current peak should last at least [stpkdr] MilliSeconds
         before an alert is raised; max about a minute."
    ::= { general 4 }

fixedOutletDelay OBJECT-TYPE
    SYNTAX        MilliSeconds
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Minimal delay between two successive relay switches in
         milliseconds. Minimal delay is 100 ms. Will always be
         respected!"
    ::= { general 5 }

powerSaverMode OBJECT-TYPE
    SYNTAX        Seconds
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Set backlight on time in seconds; 0 keeps display always on.
         Note that keeping the backlight on may decrease luminosity over
         time. Setting this to other values than 10, 60, 120 or 240 is
         incompatible with the gateway!"
    ::= { general 6 }

outletPowerupMode OBJECT-TYPE
    SYNTAX        Integer32 (0..2)
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Behaviour of outlet on power-up: 0=off; 1=same state as at
         power down; 2=same state, but delayed by individual delay
         timer."
    ::= { general 7 }

maximumTemperature OBJECT-TYPE
    SYNTAX        Integer32 (0..99)
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "An alert should be generated whenever the temperature of the
         first connected T sensor is above this value. Zero means
         disabled."
    ::= { general 8 }

displayOrientation OBJECT-TYPE
    SYNTAX        Integer32 (0..4)
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "0 no display; display off; 1 vertical, display on top; 2
         vertical, upside down; 3 horizontal, display at left; 4
         horizontal, display at right"
    ::= { general 9 }

localAlertReset OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Allow alerts to be reset locally on device by pushing one of
         the buttons. [replaces dipDuration]"
    ::= { general 10 }

currentDropDetection OBJECT-TYPE
    SYNTAX        Integer32 (0..3)
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Enables the current drop detection function. 0 = always off
         (default), 1 = input (s) only, 2 = output(s) only, 3 = both
         inputs and outputs."
    ::= { general 11 }

wirelessDisplayPower OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Controls the transit power of the wireless display transciever
         (if installed). Set to zero to completely disable the module."
    ::= { general 12 }

-- number of channels depends on noPhases

inputmeasuresTable OBJECT-TYPE
    SYNTAX        SEQUENCE OF InputmeasuresEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "This table contains all measures related to the measured
         inputs of the DEVICE. Note: either 1 or 3 channels, depending
         on number of phases measured."
    ::= { device0 8 }

inputmeasuresEntry OBJECT-TYPE
    SYNTAX        InputmeasuresEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The record containing the registers for the channel selected
         by channelIndex."
    INDEX
        { channelIndex6 }
    ::= { inputmeasuresTable 1 }

InputmeasuresEntry ::= SEQUENCE
{
    channelIndex6  Integer32,
    kWhTotalI      KiloWattHour,
    kWhSubtotalI   KiloWattHour,
    powerFactorI   DeciPowerFactor,
    actualCurrentI DeciAmps,
    peakCurrentI   DeciAmps,
    actualVoltageI DeciVolts,
    minVoltageI    DeciVolts,
    powerVAI       Integer32,
    powerWattI     Integer32,
    maxInletAmps   DeciAmps,
    inputCTratio   Integer32,
    inputName      DisplayString
}

channelIndex6 OBJECT-TYPE
    SYNTAX        Integer32 (1..48)
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The channel. Its value ranges between 1 and 48, depending on
         the number of channels, usually 1."
    ::= { inputmeasuresEntry 1 }

kWhTotalI OBJECT-TYPE
    SYNTAX        KiloWattHour
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Either the only phase in a single phase measurement; or one of
         the three phases in a multiphase measurement."
    ::= { inputmeasuresEntry 2 }

kWhSubtotalI OBJECT-TYPE
    SYNTAX        KiloWattHour
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "kWh subtotal register of the only phase in a single phase
         measurement; or one of three phases in a multiphase
         measurement. Reset to zero with [rsimks]."
    ::= { inputmeasuresEntry 3 }

powerFactorI OBJECT-TYPE
    SYNTAX        DeciPowerFactor
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "The effective power factor in percent."
    ::= { inputmeasuresEntry 4 }

actualCurrentI OBJECT-TYPE
    SYNTAX        DeciAmps
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Actual apparent, RMS current."
    ::= { inputmeasuresEntry 5 }

peakCurrentI OBJECT-TYPE
    SYNTAX        DeciAmps
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Peak apparent, RMS current; highest value since last reset of
         the alerts."
    ::= { inputmeasuresEntry 6 }

actualVoltageI OBJECT-TYPE
    SYNTAX        DeciVolts
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "The actual voltage."
    ::= { inputmeasuresEntry 7 }

minVoltageI OBJECT-TYPE
    SYNTAX        DeciVolts
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "RMS voltage dip; lowest value since reset of alerts."
    ::= { inputmeasuresEntry 8 }

powerVAI OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Power value calculated, not in data model of device."
    ::= { inputmeasuresEntry 9 }

powerWattI OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Power value calculated by the gateway, not in data model of
         device."
    ::= { inputmeasuresEntry 10 }

maxInletAmps OBJECT-TYPE
    SYNTAX        DeciAmps
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Maximum current per input phase in A; should last at least
         [stpkdr] MilliSeconds before triggering an alert."
    ::= { inputmeasuresEntry 11 }

inputCTratio OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "The multiplier to use in case of use of /5 current
         transformers. Defaults to 1."
    ::= { inputmeasuresEntry 12 }

inputName OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "User configurable naming of inputs or phases. Useful if
         channels are used to measure branches.."
    ::= { inputmeasuresEntry 13 }

-- number of channels depends on noOutletsTotal

outletsTable OBJECT-TYPE
    SYNTAX        SEQUENCE OF OutletsEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "This table contains the customer specific settings,
         determining toutlestablehe behaviour of the DEVICE."
    ::= { device0 9 }

outletsEntry OBJECT-TYPE
    SYNTAX        OutletsEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The record containing the registers forthe channel selected by
         channelIndex."
    INDEX
        { channelIndex4 }
    ::= { outletsTable 1 }

OutletsEntry ::= SEQUENCE
{
    channelIndex4 Integer32,
    outletName    DisplayString
}

channelIndex4 OBJECT-TYPE
    SYNTAX        Integer32 (1..48)
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The channel. Its value ranges between 1 and 48, depending on
         the number of channels, usually 1."
    ::= { outletsEntry 1 }

outletName OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "User configurable naming of individual outlets. Useful to
         distinguish outlets based on customer or device name."
    ::= { outletsEntry 2 }

-- number of channels depends on noMeasuredOutlets

outputmeasuresTable OBJECT-TYPE
    SYNTAX        SEQUENCE OF OutputmeasuresEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "This table contains all measures related to the measured
         outputs of the DEVICE. Note: up to 48 channels, depending on
         number of measured outlets."
    ::= { device0 10 }

outputmeasuresEntry OBJECT-TYPE
    SYNTAX        OutputmeasuresEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The record containing the registers for the channel selected
         by channelIndex."
    INDEX
        { channelIndex7 }
    ::= { outputmeasuresTable 1 }

OutputmeasuresEntry ::= SEQUENCE
{
    channelIndex7  Integer32,
    kWhTotalO      KiloWattHour,
    kWhSubtotalO   KiloWattHour,
    powerFactorO   DeciPowerFactor,
    actualCurrentO DeciAmps,
    peakCurrentO   DeciAmps,
    actualVoltageO DeciVolts,
    maxOutletAmps  DeciAmps,
    outputCTratio  Integer32
}

channelIndex7 OBJECT-TYPE
    SYNTAX        Integer32 (1..48)
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The channel. Its value ranges between 1 and 48, depending on
         the number of channels, usually 1."
    ::= { outputmeasuresEntry 1 }

kWhTotalO OBJECT-TYPE
    SYNTAX        KiloWattHour
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Total kWh of selected output."
    ::= { outputmeasuresEntry 2 }

kWhSubtotalO OBJECT-TYPE
    SYNTAX        KiloWattHour
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "kWh subtotal register of selected output. Reset to zero with
         [rsomks]."
    ::= { outputmeasuresEntry 3 }

powerFactorO OBJECT-TYPE
    SYNTAX        DeciPowerFactor
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Power factor of output."
    ::= { outputmeasuresEntry 4 }

actualCurrentO OBJECT-TYPE
    SYNTAX        DeciAmps
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Actual apparent, RMS current."
    ::= { outputmeasuresEntry 5 }

peakCurrentO OBJECT-TYPE
    SYNTAX        DeciAmps
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Peak apparent, RMS current; highest value since last reset of
         alerts."
    ::= { outputmeasuresEntry 6 }

actualVoltageO OBJECT-TYPE
    SYNTAX        DeciVolts
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Actual voltage on output."
    ::= { outputmeasuresEntry 7 }

maxOutletAmps OBJECT-TYPE
    SYNTAX        DeciAmps
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Maximum current per outlet in A; should last at least [stpkdr]
         MilliSeconds before triggering an alert."
    ::= { outputmeasuresEntry 8 }

outputCTratio OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "The multiplier to use in case of use of /5 current
         transformers. Defaults to 1."
    ::= { outputmeasuresEntry 9 }

-- number of channels depends on noSwitchedOutlets

switchedoutletsTable OBJECT-TYPE
    SYNTAX        SEQUENCE OF SwitchedoutletsEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "This table contains the current status of switchable
         DEVICE's."
    ::= { device0 11 }

switchedoutletsEntry OBJECT-TYPE
    SYNTAX        SwitchedoutletsEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The record containing the registers for the channel selected
         by channelIndex."
    INDEX
        { channelIndex5 }
    ::= { switchedoutletsTable 1 }

SwitchedoutletsEntry ::= SEQUENCE
{
    channelIndex5         Integer32,
    currentState          Integer32,
    scheduled             Integer32,
    unlock                Integer32,
    individualOutletDelay Seconds
}

channelIndex5 OBJECT-TYPE
    SYNTAX        Integer32 (1..48)
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The channel. Its value ranges between 1 and 48, depending on
         the number of channels, usually 1."
    ::= { switchedoutletsEntry 1 }

currentState OBJECT-TYPE
    SYNTAX        Integer32 (0..1)
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "The actual state of the outlet relays. The hardware will
         contain max 48 outlets. Writing is only effective after setting
         [swounl]."
    ::= { switchedoutletsEntry 2 }

scheduled OBJECT-TYPE
    SYNTAX        Integer32 (0..1)
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "A one indicates pending activity; the switch delay has not yet
         expired."
    ::= { switchedoutletsEntry 3 }

unlock OBJECT-TYPE
    SYNTAX        Integer32
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Setting the value to one will release the safety for this
         outlet for a couple seconds; switching and rebooting are then
         temporarily enabled."
    ::= { switchedoutletsEntry 4 }

individualOutletDelay OBJECT-TYPE
    SYNTAX        Seconds
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "Delay before an individual outlet switches on at power-up in
         Seconds."
    ::= { switchedoutletsEntry 5 }

-- number of channels depends on noEnvSensors

sensorTable OBJECT-TYPE
    SYNTAX        SEQUENCE OF SensorEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "This table contains the environmental measurements. As well
         internal temperature as external temperature probes."
    ::= { device0 12 }

sensorEntry OBJECT-TYPE
    SYNTAX        SensorEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The record containing the registers for the channel selected
         by channelIndex."
    INDEX
        { channelIndex8 }
    ::= { sensorTable 1 }

SensorEntry ::= SEQUENCE
{
    channelIndex8 Integer32,
    sensorType    DisplayString,
    sensorValue   DeciValue,
    sensorName    DisplayString
}

channelIndex8 OBJECT-TYPE
    SYNTAX        Integer32 (1..48)
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "The channel. Its value ranges between 1 and 48, depending on
         the number of channels, usually 1."
    ::= { sensorEntry 1 }

sensorType OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Type of connected sensor, either T, H or I for respectively
         Temperature (C), Humidity (%) or dry switch contact"
    ::= { sensorEntry 2 }

sensorValue OBJECT-TYPE
    SYNTAX        DeciValue
    MAX-ACCESS    read-only
    STATUS        current
    DESCRIPTION
        "Value of connected sensor"
    ::= { sensorEntry 3 }

sensorName OBJECT-TYPE
    SYNTAX        DisplayString
    MAX-ACCESS    read-write
    STATUS        current
    DESCRIPTION
        "User definable name for sensors."
    ::= { sensorEntry 4 }

conformance OBJECT IDENTIFIER ::= { schleifenbauer 99 }

-- conformance information

compliances OBJECT IDENTIFIER ::= { conformance 1 }

-- compliance statements

compliance MODULE-COMPLIANCE
    STATUS         current
    DESCRIPTION
        "The requirements for conformance to the SPGW-MIB."
    MODULE         SDEVICE-MIB
        GROUP          sensorsGroup
        DESCRIPTION
            "The sensors group."
        GROUP          outputMeasuresGroup
        DESCRIPTION
            "The outputMeasures group."
        GROUP          inputMeasuresGroup
        DESCRIPTION
            "The inputMeasures group."
        GROUP          switchedOutletsGroup
        DESCRIPTION
            "The switchedOutlets group."
        GROUP          settingsGroup
        DESCRIPTION
            "The settings group."
        GROUP          systemStatusGroup
        DESCRIPTION
            "The systemStatus group."
        GROUP          configurationGroup
        DESCRIPTION
            "The configuration group."
        GROUP          identificationGroup
        DESCRIPTION
            "The identification group."
        GROUP          resetGroup
        DESCRIPTION
            "resettable attributes in device"
    ::= { compliances 1 }

groups OBJECT IDENTIFIER ::= { conformance 2 }

-- units of conformance note: volatile, not part of spdm

identificationGroup OBJECT-GROUP
    OBJECTS
        { spdmVersion, firmwareVersion, salesOrderNumber, productId,
        serialNumber, hardwareAddress, unitAddress, deviceName,
        deviceLocation, vanityTag, macAddress, buildNumber }
    STATUS        current
    DESCRIPTION
        "A collection of objects providing identification information
         about the device."
    ::= { groups 1 }

configurationGroup OBJECT-GROUP
    OBJECTS
        { noPhases, noOutletsTotal, noSwitchedOutlets,
        noMeasuredOutlets, maximumLoad, noSensors }
    STATUS        current
    DESCRIPTION
        "A collection of objects providing configuration information
         about the device."
    ::= { groups 2 }

systemStatusGroup OBJECT-GROUP
    OBJECTS
        { deviceStatusCode, temperatureAlert, inputCurrentAlert,
        outputCurrentAlert, inputVoltageAlert, oCurrentDropAlert,
        iCurrentDropAlert }
    STATUS        current
    DESCRIPTION
        "A collection of objects providing status information about the
         device."
    ::= { groups 3 }

resetGroup OBJECT-GROUP
    OBJECTS
        { resetAlerts, resetPeakValues, rebootDevice,
        zeroInputKWhSubtotal, zeroOutKWhSubtotal }
    STATUS        current
    DESCRIPTION
        "Groups resettable attributes op the device."
    ::= { groups 4 }

settingsGroup OBJECT-GROUP
    OBJECTS
        { peakDuration, localAlertReset, fixedOutletDelay,
        powerSaverMode, outletPowerupMode, maximumTemperature,
        displayOrientation, maxInletAmps, maxOutletAmps, outputCTratio,
        inputCTratio, inputName, outletName, individualOutletDelay,
        currentDropDetection, wirelessDisplayPower }
    STATUS        current
    DESCRIPTION
        "A collection of objects providing the actual settings about
         the device."
    ::= { groups 5 }

switchedOutletsGroup OBJECT-GROUP
    OBJECTS
        { currentState, scheduled, individualOutletDelay, unlock }
    STATUS        current
    DESCRIPTION
        "A collection of objects providing the actual outlet status of
         the device."
    ::= { groups 6 }

inputMeasuresGroup OBJECT-GROUP
    OBJECTS
        { kWhTotalI, kWhSubtotalI, powerFactorI, actualCurrentI,
        peakCurrentI, actualVoltageI, minVoltageI, powerWattI, powerVAI,
        maxInletAmps, inputCTratio, inputName }
    STATUS        current
    DESCRIPTION
        "A collection of objects providing the actual input
         measurements of the device."
    ::= { groups 7 }

outputMeasuresGroup OBJECT-GROUP
    OBJECTS
        { kWhTotalO, kWhSubtotalO, powerFactorO, actualCurrentO,
        peakCurrentO, actualVoltageO, maxOutletAmps, outputCTratio }
    STATUS        current
    DESCRIPTION
        "A collection of objects providing the actual output
         measurements of the device."
    ::= { groups 8 }

sensorsGroup OBJECT-GROUP
    OBJECTS
        { sensorType, sensorValue, sensorName }
    STATUS        current
    DESCRIPTION
        "A collection of objects providing the actual environmental
         measurements of the device."
    ::= { groups 9 }

END

