Icon for command line sensor?

I’m trying to make a sensor to monitor which ISP my internet is going thru (I have redundant ISPs)…I got the sensor working but it only shows with a generic “eyeball” icon. I’d like to use something like mdi:earth since it is the internet gateway.

I’ve tried icon: mdi:earth but it seems icon is not valid for command line sensors?

  - platform: command_line
    name: "ISP"
    command: 'dig -x $(curl --connect-timeout 5 -s http://checkip.dyndns.org | sed "s/.*<body>Current IP Address: //;s/<\/body>.*//") +short | awk -F ''.'' ''{ print $(NF-2) "." $(NF-1) }'' 2>/dev/null || echo "Unknown"'
    scan_interval: 20
    command_timeout: 15

How can I set the icon for this to something more appropriate to “internet”?

Use customize for integrations that don’t support an icon:

I’m apparently failing to do something…

Error:

2021-01-28 14:45:29 WARNING (MainThread) [homeassistant.config] Package network_monitoring contains invalid customize

Code:

sensor:

  - platform: command_line
    name: "Outbound Public IP"
    command: 'curl --connect-timeout 55 -s http://checkip.dyndns.org | sed "s/.*<body>Current IP Address: //;s/<\/body>.*//" 2>/dev/null || echo "Unknown"'
    scan_interval: 20
    command_timeout: 10

  - platform: command_line
    name: "ISP"
    command: 'dig -x $(curl --connect-timeout 5 -s http://checkip.dyndns.org | sed "s/.*<body>Current IP Address: //;s/<\/body>.*//") +short | awk -F ''.'' ''{ print $(NF-2) "." $(NF-1) }'' 2>/dev/null || echo "Unknown"'
    scan_interval: 20
    command_timeout: 15

homeassistant:
  customize:
    - sensor.outbound_public_ip:
        icon: mdi:earth
    - sensor.isp:
        icon: mdi:earth

Maybe someone else sees what it still doesn’t like?

It’s ok to have homessistant: in a package as well.
I think your sensor isn’ t a sensor.
Isn’t it command_line.outbound_public_ip etc?

Also I think your indenting is wrong. Here is one of mine:

    sensor.wan_ip_address:
      friendly_name: WAN IP Address
      icon: mdi:server-network

In developer tools I don’t have a command_line.outbound_public_ip but I do have a sensor.outbound_public_ip so I thought that was the thing to use?

image

ok that is right then. I don’t have any command line sensors…
You don’t need the - in front of the customize entries (at least I don’t have them in mine)

1 Like

YAY! It was the ‘-’ in front of the list entries.

image

1 Like