Integration for rest api sensor

Hi,

I’m running 3 FreshTomato routers in my house and I’m thinking about monitoring some of their operating conditions. I already managed to send the values of interest to Home Assistant. To do this I modified a bash script which I found online and execute it from the router at a given interval. E.g. it could look like this:

#!/bin/sh
source variables.sh

clients=`arp -an | grep -v vlan2 | wc -l`
curl -X POST -H 'Authorization: Bearer '$iftoken -H 'Content-Type: application/json' -d '{"state":"'$clients'", "attributes": {"friendly_name": "Client count"}}' 'http://'$ifserver':'$ifport'/api/states/sensor.'$prefix'_client_count'

All the variables are defined in variables.sh and thanks to the prefix the resulting entities are kind of grouped. But I’d prefer having all of them assigned to a device.

As I’m rather new with Home Assistant I’m not sure what’s the best and easiest way to achieve this. As I’ve 3 routers three devices would be desired of course, each with a unique prefix. Can somebody point me into a direction and has maybe even an example at hand?

Thanks in advance
Michael

Solved by switching to MQTT. See GitHub - pikim/tomato-mqtt.