SNMP Sensor fails with `'pysnmp.proto.rfc1905.NoSuchInstance'` errors

I am adding SNMP sensors for some equipment in my rack, specifically an APC network management card and a Geist environmental monitor.

It seems that for the OID’s I use I get empty strings returned, and 'pysnmp.proto.rfc1905.NoSuchInstance' reported by snmp.

In any sensor where I use value_template and coorce to types I do not get sensor errors, but for sensors where I just use default_value I get errors that the empty string cannot be parsed, as if the default_value is getting ignored.

The bigger issue is that the OID’s appear to not be read.

E.g.

2024-09-27 12:33:23.016 DEBUG (MainThread) [homeassistant.components.snmp.sensor] SNMP OID 1.3.6.1.4.1.318.1.1.1.3.3.1 received type=<class 'pysnmp.proto.rfc1905.NoSuchInstance'> and data 
2024-09-27 12:33:23.019 DEBUG (MainThread) [homeassistant.components.snmp.sensor] SNMP OID 1.3.6.1.4.1.318.1.1.1.4.3.1 received type=<class 'pysnmp.proto.rfc1905.NoSuchInstance'> and data 
2024-09-27 12:33:23.025 DEBUG (MainThread) [homeassistant.components.snmp.sensor] SNMP OID 1.3.6.1.4.1.318.1.1.1.4.3.4 received type=<class 'pysnmp.proto.rfc1905.NoSuchInstance'> and data 
2024-09-27 12:33:23.032 DEBUG (MainThread) [homeassistant.components.snmp.sensor] SNMP OID 1.3.6.1.4.1.318.1.1.1.4.2.9 received type=<class 'pysnmp.proto.rfc1905.NoSuchInstance'> and data 
2024-09-27 12:33:23.032 ERROR (MainThread) [homeassistant.components.sensor] Error adding entity sensor.smartups_stairs_output_power for domain sensor with platform snmp
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/homeassistant/components/sensor/__init__.py", line 657, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

Config:

# Output Apparent Power
# .upsOutput.upsAdvOutput.upsAdvOutputApparentPower.0
# .1.3.6.1.4.1.318.1.1.1.4.2.9
- platform: snmp
  name: "SmartUPS-Stairs Output Power"
  unique_id: smartups_stairs_output_power
  host: 192.168.1.11
  accept_errors: true
  version: 2c
  community: public
  baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.9
  unit_of_measurement: "W"
  device_class: power
  default_value: 0

# Output Current
# .upsOutput.upsHighPrecOutput.upsHighPrecOutputCurrent.0
# .1.3.6.1.4.1.318.1.1.1.4.3.4
- platform: snmp
  name: "SmartUPS-Stairs Output Current"
  unique_id: smartups_stairs_output_current
  host: 192.168.1.11
  accept_errors: true
  version: 2c
  community: public
  baseoid: 1.3.6.1.4.1.318.1.1.1.4.3.4
  unit_of_measurement: "A"
  device_class: current
  value_template: "{{value|float(0) / 10}}"
  default_value: 0

Using snmpwalk all seems well:

$ snmpwalk -v 2c -c public smartups-stairs 1.3.6.1.4.1.318.1.1.1.3.3.1
SNMPv2-SMI::enterprises.318.1.1.1.3.3.1.0 = Gauge32: 1216

Any ideas how to fix this?

Ok, I write a little python test app using pysnmp, and found the OID must include the scalar index, while GUI tools and snmpwalk figures it out.

E.g. 1.3.6.1.4.1.318.1.1.1.3.3.1.0 vs. just 1.3.6.1.4.1.318.1.1.1.3.3.1

Still not sure why default_value does not kick in and I am required to use a default value for type conversion?