SNMP Switch


The snmp switch platform allows you to control SNMP-enabled equipment.

Currently, only SNMP OIDs that accept integer values are supported. SNMP v1, v2c and v3 are supported.

To use an SNMP switch in your installation:

# Example configuration.yaml entry:
switch:
  - platform: snmp
    host: 192.168.0.2
    baseoid: 1.3.6.1.4.1.19865.1.2.1.4.0

Configuration Variables

baseoid

(string)(Required)The SNMP BaseOID which to poll for the state of the switch.

command_oid

(string)(Optional)The SNMP OID which to set in order to turn the switch on and off, if different from baseoid.

host

(string)(Optional)The IP/host which to control.

Default value: localhost

port

(string)(Optional)The port on which to communicate.

Default value: 161

community

(string)(Optional)community string to use for authentication (SNMP v1 and v2c).

Default value: private

username

(string)(Optional)Username to use for authentication.

Default value:

auth_key

(string)(Optional)Authentication key to use for SNMP v3.

Default value: no key

auth_protocol

(string)(Optional)Authentication protocol to use for SNMP v3.

Default value: none

priv_key

(string)(Optional)Privacy key to use for SNMP v3.

Default value: no key

priv_protocol

(string)(Optional)Privacy protocol to use for SNMP v3.

Default value: none

version

(string)(Optional)SNMP version to use - either 1, 2c or 3.

Default value: 1

payload_on

(string)(Optional)What return value represents an On state for the switch. The same value is used in writes to turn on the switch if command_payload_on is not set.

Default value: 1

payload_off

(string)(Optional)What return value represents an Off state for the switch. The same value is used in writes to turn off the switch if command_payload_off is not set.

Default value: 0

command_payload_on

(string)(Optional)The value to write to turn on the switch, if different from payload_on.

command_payload_off

(string)(Optional)The value to write to turn off the switch, if different from payload_off.

You should check with your device’s vendor to find out the correct BaseOID and what values turn the switch on and off.

Valid values for auth_protocol:

  • none
  • hmac-md5
  • hmac-sha
  • hmac128-sha224
  • hmac192-sha256
  • hmac256-sha384
  • hmac384-sha512

Valid values for priv_protocol:

  • none
  • des
  • 3des-ede
  • aes-cfb-128
  • aes-cfb-192
  • aes-cfb-256

Complete examples:

switch:
  - platform: snmp
    name: SNMP v1 switch
    host: 192.168.0.2
    community: private
    baseoid: 1.3.6.1.4.1.19865.1.2.1.4.0
    payload_on: 1
    payload_off: 0

  - platform: snmp
    name: SNMP v3 switch
    host: 192.168.0.3
    version: '3'
    username: 'myusername'
    auth_key: 'myauthkey'
    auth_protocol: 'hmac-sha'
    priv_key: 'myprivkey'
    priv_protocol: 'aes-cfb-128'
    baseoid: 1.3.6.1.4.1.19865.1.2.1.4.0
    payload_on: 1
    payload_off: 0