Hi,
I am trying to query the toner level of an old HP laser printer using snmp via HA. I can retrieve the settings on a linux command line using the OIDs. For example:
snmpget -v2c -c public 192.168.157.15 .1.3.6.1.2.1.43.11.1.1.7.1.1
iso.3.6.1.2.1.43.11.1.1.7.1.1 = INTEGER: 13
After restarting HA, i cannot find any of the p2055dn entities listed in settings. When I try to query sensor.p2055dn_black_level (or the other two sensor entities) using a card, I get “entity not available”. I can ping the printer IP successfully directly from HA CLI.
Actually I tried it first without the initial dot. I added the dot because I’d seen it used by others and it does work both ways on linux CLI. So with or without the dot it doesn’t produce any entities. And no no error reports in the log.
Yes they are on the same subnet. HA is running on a Virtualbox VM on my linux machine. It has a bridged network adaptor and gets a DHCP (though static) address from the router. Everything is on the 192.168.157.0/24 subnet and as I say, I can ping the printer from the HA CLI.
Don’t know if this will help you but I beat my head against some SNMP sensors a week ago for hours. Same issue as you. The entities wouldn’t appear even though there were no configuration errors.
I remove all the single quotes wrapping name, version, etc. and suddenly it started working. Also remove the first period from the OID.
Without the single quotes and starting dot on the OID. This now works and produces an entity, so I tried replicating that with the printer entry, just using the same 6 tags and only with the single “black capacity” sensor. Commented everything else out. Weirdly, this doesn’t work. I double checked the IP & OID are correct, which they are & I can retrieve the value from linux CLI. Both IPs are pingable from HA.
Be sure you are hitting a value and not a directory.
Some commands will return the object in a directory and if there is only one, then it will look like a value, but HA needs the precise OID for the value
It is just a single integer value at the end of a branch. The WTI box however was outputting a string value, so thought I’d change the printer OID to one that was a string, to see if that made a difference. No change.
Ok, there have to be something in the logs.
Something that prevents the section or part of it to run, so if you can not find it in the logs, then post the entire configuration.yaml.
What network setup do you have?
Any VLANs or multiple routers in use?
And btw have you tried if the “HP Printer Integration” from HACS can access the information you need?
No need to waste energy on fighting a problem that might be an easy way around.
Ok so now I have it working! You reminded me that I had previously installed the HP Printer Integration from HACS, but discovered that it didn’t support my printer as it is fairly ancient. I removed that, but also by looking in System - Logs - Download Full Log, I discovered a complaint that I had used the “sensor” statement twice, which apparently it didn’t like. I removed the wti sensor which was just a test anyway and now I can see all 3 entities. Thanks for pointing this out.