A little addition
The following loggger setting will remove the +1 caused by the first command which is failing and will give you the proper count
if you can live with those http log setting
logger:
default: critical
logs:
homeassistant.components.http: warning