@laf I was able to copy and strip down the includes/discovery/sensors/pre-cache/avtech.inc.php
I have created:
includes/discovery/sensors/pre-cache/esphome.inc.php
$data = trim(snmp_walk($device, '.1.3.9999', '-OQn'));
foreach (explode(PHP_EOL, $data) as $line) {
[$oid, $value] = explode(' =', $line);
$value = trim($value);
$pre_cache[$oid] = [[$oid => $value]];
}
unset($data);
With the addition of the above file, polling is working as expected using the following yaml:
includes/definitions/discovery/esphome.yaml
modules:
sensors:
dbm:
data:
-
oid: .1.3.9999.4.1.0
descr: 'RSSI of {{ $.1.3.9999.4.3.0 }} connected to {{ $.1.3.9999.4.2.0 }} with IP: {{ $.1.3.9999.4.4.0 }}'
group: 'WiFi'
num_oid: .1.3.9999.4.1.0
state:
data:
-
oid: .1.3.9999.2.1.0
descr: 'Chip Type'
num_oid: .1.3.9999.2.1.0
group: 'Chip'
#state_name: 'Chip Type'
states:
- { value: 32, generic: 0, graph: 0, descr: 'ESP32' }
- { value: 8266, generic: 0, graph: 0, descr: 'ESP8266' }
frequency:
data:
-
oid: .1.3.9999.2.2.0
descr: 'Chip Frequency'
num_oid: .1.3.9999.2.2.0
group: 'Chip'
multiplier: 1000000
That said, the php seems to just pre-cache the values. Unlike the avtech.inc.php
file, no virtual tables are constructed.
Other OS’s do pre-cache in the yaml like netgear.yaml
. Here is the pre-cache section:
sensors:
pre-cache:
data:
-
oid:
- boxServicesNormalTempRangeMin
- boxServicesNormalTempRangeMax
I tried creating the equivalent pre-cache section in the esphome.yaml
using both just the base OID and specific OID’s used in the sensors. Neither was successful.