In a previous topic@Burningstone wrote a sensor that counts device trackers in a list and returns an number saying how many of these device trackers that has the state “home”. A simple “count people at home”-template.
But let’s say I would rather like to count how many device.trackers in my HA-installation that has the state “home” except of those in the list. It is easy to refactor the template @Burningstone suggested?
What I would like to achieve is a counter that counts how many persons are connected to my wifi, but instead of listing the device i’d have to count, I’d rather count how many devices are connected except of those devices that are always connected, such as printers, TV etc.
By using this method instead, I could just add people to my wifi without having to edit the template each time someone new connects to my wifi.
If I understood your issue correctly, you should be able to just change the ‘in’ to ‘not in’ and replace the list of the samsungs phones with a list of all the devices you don’t want to count. This way it will count all device trackers that are ‘home’ and not in the list you provided.