Speedtest Ping replacement sensor

Not quite. I want to calculate a percentage used (of the total) so it lines up with the days used, but that can wait until I get it working.

It can be slow updatingā€¦ can be up to 40 minutes behind. Tapping on the bar should refresh as wellā€¦ My rainmeter meter is similarly slow. ABB only update every 15 mins and then it isnā€™t available immediately

Ah ok. Iā€™ll keep an eye on it.

I think itā€™s because Iā€™m comparing a number with a stringā€¦ probably need to convert the var to a stringā€¦ and I need to add used to remaining to get the limit. Iā€™ll look at how to best fix this and let you know.

It is updating. Like you said, just not every 15 minutes.

Or maybe not:

2019-05-14 17:30:05 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `/bin/bash /config/abbusage/abbusage_ha.sh`, return code: 6
NoneType: None

If I were to remove this how do I remove the generated sensor?

did you use backticks? itā€™s a standard single quote. The sensor will disappear if you restart HAā€¦
I just have
abbusage: /bin/bash /config/abbusage/abbusage_ha.sh no quotes for the shell_command. Have not seen that errorā€¦ maybe if it does that it canā€™t connect. Are you on Hassbian or hass.io?

The error disappears if I use single quotes (not backticks). It appears when I remove the quotes and restart.

Hassio NUC image.

I just put the quotes back. All appears to be well (other than the plan limit).

Yeahā€¦ well Iā€™m comparing a number to a srting and canā€™t quite get that right yet but Iā€™ll solve that and let you know. I might even see if I can get the usage bar graph as well if you donā€™t beat me to it.

1 Like

hey guys,

Iā€™m used to do network monitoring for a living, and I may have a tip or two. I usually like to ping a few upstream routers to detect network problems. You can use traceroute (tracert on windows) to discover those routers. Like was said before 8.8.8.8 is what we call a ā€œanycastā€ address and may be used by different servers on the internet and the routing protocol (BGP) chooses the one ā€œnearā€ to you. You may (or not) see this using traceroute. It may completely change the path to reach it during the day.
One popular tool to graph ping latency/jitter is smoking.. Shouldnā€™t be too difficult to put it on docker and import the graphs.
Here in Brazil, the NIC.BR (our regional internet register) has a cool project called SIMET which is like a speedtest on steroids :). They have servers on various IX (Internet eXchange points) across the country. And they also have something called the ā€œsimet boxā€ which is a modified firmware for APs with the simet software built in. The box keeps measuring the quality of your internet. I ran one on a old TP-link and is very helpful to discover if your ISP is delivering what you contracted. I wonder if there are similar projects on US or Eu.

I beat you to it. Sort of. I created individual template sensors from your abb sensor attributes and a few extras. This is so I can see a history graph of some of the sensor attributes.

Itā€™s easy to see if Iā€™m going to go over my plan - I dont actually expect this to happen it should settle down in a couple of days - it was GoT day yeasterday :slight_smile:

I still have a bit of prettying up to do (icons and maybe hide a few less used stats with a fold.

The main problem I have is that your sensor attributes arenā€™t persistent through a restart. Leading to some divide by zero errors on restart and this sort of graph trouble:

This sensor is just:

- platform: template
  sensors:
    used_gb:
      friendly_name: Used
      entity_id: sensor.abb_usage
      value_template: "{{ ( state_attr('sensor.abb_usage', 'usedMb') | float / 1000 ) | round(2) }}"
      unit_of_measurement: "GB"

Is it possible to manually include your sensor so that it persists through restarts?

Divide by zero errors? I have not seen any errors at all. That is weird. Is it your template sensors causing that?

Iā€™ve never thought the history was that important - the sensor I create doesnā€™t even have a state (because that screws up the template card Iā€™m using (displays extraneous data)

Itā€™s possible to do it such that the script creates everything as an individual sensor but I was trying to avoid that as well as I didnā€™t want the history filling up with useless shit lolā€¦ Also, check your card title for a typo.

I was originally using MQTT to get the data inā€¦ it created the same sensor and attributesā€¦ itā€™s potentially persistent across reboots - itā€™s in the zip file in the repo but I have changed the script a lot since then and stripped out the config stuff as well. I can probably pretty easily do a script that uses a setup script as well if you think that would be useful? (Note: that wonā€™t work on HassOS as there is no access to mosquitto_pub in the HA container)

I am going to add a plan limit attribute today as that will solve the issue I found yesterday and itā€™s probably the best way to fix that - iā€™ll Let you know when I have a new script.

Yes my sensors are causing it. You wonā€™t see the errors. You are only using templates in the Lovelace card. By the time the system starts up and you can navigate to the card the abb sensor is initialised.

My template sensors on the other hand are relying on the abb sensor (and itā€™s attributes) being available right from start up. It is not available until a short time after start up.

Attributes all in the one sensor are fine. I just need the sensor to be permanent and not recreated every restart.

I looked at your MQTT option but noted you said it was not compatible with Hassio.

Yeah it was a rush job before bed time. Iā€™ll fix it up today if I get a chance.

1 Like

I know itā€™s being pedantic but itā€™s HassOS - it works fine with Hass.io just not if the base OS is HassOS because they donā€™t provide mosquitto-tools.

Is it possible to have a delay or a test in your sensor for a zero value and then try again? Something like. That? Did you try adding the entity_id in the sensor so it knows it needs the ABB sensor? (Like we do for other template sensors)?

I was going on memory of what I read. Apologies. The mix-up is one of my pet-peeves too.

Yes, I always add the entity_id to my template sensors. How would I add a delay in a template?

- platform: template
  sensors:
    used_gb:
      friendly_name: Used
      entity_id: sensor.abb_usage
      value_template: "{{ ( state_attr('sensor.abb_usage', 'usedMb') | float / 1000 ) | round(2) }}"
      unit_of_measurement: "GB"

No idea lolā€¦ What about testing if itā€™s zero?

I can prevent the error by applying a | max filter for the template denominators so that the minimum is never 0. However this still puts spikes in the history data on restart.

Iā€™ve got my card looking how I want:

Nice Tomā€¦ My lovelace card was only an example anyway although I do want to fix it so it puts the correct limit and will do that by adding an attribute for that today.

Thanks heaps for making the sensor David.

1 Like

Tom: if you wouldnā€™t mind, can you download the abbusage_ha.sh script again and run it and check that you now have an extra attribute allowanceMb in the sensor? And obviously that it correctly shows your Data Allowance in Mb please?