Sonoff Tasmota latest firmware sensor?

Then probably that narrowed down to the difference between hassbian vs hassio in handling the command in command-line sensor which is beyond me.

Thanks. It’s just weird it works from the command line and also in the terminal

Does anyone on the day shift have any idea about this?

mosquitto_sub is not available in the hass.io docker container.
When you ssh to hassio, you’re in a terminal of the host, not the container.

So is there any other way I can do this?

Played a little with curl and cut.
This works in hassio on a ubuntu 16.04 server.

  - platform: command_line
    name: "Latest Tasmota"
    command: "curl -s https://github.com/arendst/Sonoff-Tasmota/releases/latest | cut -d'\"' -f2 | rev | cut -d'/' -f1 | rev"
    scan_interval: 600

Don’t know if this works in the future.

Wow! Well that works for now anyway. Thanks. Hopefully they don’t change the URL.

Tried this on my Pi just running stretch to try and understand the command (also so if the path changes or something like that I can try and fix it myself if I understand it - I’m a linux noob for the most part) and it does not like the cut -d’"’ - says the cut -d can only have 1 character. cut -d’"’ works though.

Also tried it from ssh on resinos (hassio) Pi and same error.

Just curious why it works when I put it in the command as you show it here?

So I found out that Hassio strips the \ out.

Not sure, was trial and error. :slightly_smiling_face:
The backslash in the command_line sensor was because of the doublequotes at the beginning and the end.

Yeah all good. I ended up putting it in a script and was able to take out the . When I ran the command from SSH it didn’t like it (invalid for cut) but it worked in HomeAssistant as it apparently strips out the \ according to @Tinkerer and @Syssi

@DavidFW1960 if this is an actual destination for your home, please edit and remove all instances of the location ( http://sonoff.maddox.co.uk:1883). You will need to get cooperation from other posters to remove your information or delete your original post.
You should never post identifiable information on a public forum. At this point, the Internet (everyone in the world) knows where you are and what platform is exposed. Any vulnerability in the OS, HA or ?? could / can be exploited. If you think you aren’t exposing anything, do understand, thousands and thousands of break-in attempts happen to your IP address every day. Knowing anything about your specific situation makes things so much easier.

http://sonoff.maddox.co.uk is a publically available and published MQTT server for the precise purpose of getting the Tasmota version by MQTT. It’s published on the Sonoff-Tasmota github. There is no reason not to have it here.

I also don’t need or appreciate the lecture.

1 Like

You got the lecture anyway. It might not apply to your situation but it is always worth posting.

@DavidFW1960 I tried to follow this through tot he conclusion but I couldn’t work out what the final answer was to doing this in hassio?

Also, and yes I know generally always keep up with the latest firmware, but is there benefit to upgrading all my sonoffs? I understand that from now on they all have to be physically re-flashed. Or am I wrong about that too?

Thanks

The answer is here:

is there benefit to upgrading all my sonoffs?
I think it’s a good practice to do so…

I understand that from now on they all have to be physically re-flashed. >>Or am I wrong about that too?

You’re wrong about that. Once you have Tasmota on them you can flash the latest over the air. I started with 5.12 and flashed 5.14 OTA. Only thing is you need to do it in 2 steps as the firmware is too large to fit in one hit so you flash with 5.14 minimal and then flash with 5.14 Reason is the 5.14 is larger in size than 1/2 the available ram on the Sonoff so it can’t hold both firmwares simultaneously so flashing the minimal firmware frees up enough space for the full version.

One challenge is keeping track of which firmware each device has installed etc and then update individual device configurations etc. Has anyone started tracking their sonoff device firmware and OTA upgrades within HA ?

@DavidFW1960 Thanks - I saw that answer but the following comments confused me into thinking you had found a better one!!

Thanks again for the other answers too.

Do a search for TasmoAdmin

Well kinda…

I’m using a script instead of having the command in configuration.yaml. So in my config yaml I have this:

# Sonoff Firmware Version
  - platform: command_line
    name: Sonoff Firmware Version
    command: /config/versionsonoffhtml.sh
    scan_interval: 21600

And the versionsonoffhtml.sh looks like this:

#!/bin/bash
curl -s https://github.com/arendst/Sonoff-Tasmota/releases/latest | cut -d\" -f2 | rev | cut -d/ -f1 | rev 2>/config/versionsonoffhtml.err

Which works fine.

I originally wanted to use the MQTT command but in the process of that I discovered that when Home Assistant runs a command from configuration.yaml, it runs it in the host container and the host does not have the mosquitto_sub installed hence the error. When you run it from ssh, that home assistant container DOES have the mosquitto_sub so it works. So the only way is to use the HTML way as above.

I also discovered that yaml strips that / off the HTML command and you’ll see that if you run the command @VDRainer gave me from ssh it will give you an error about the cut command not allowing 2 characters but when it was run from the yaml file it worked.

Anyway it was an interesting exercise and I learnt a lot which is 90% of my objective.

I only have 2 Sonoff devices so keeping track of them and their firmware version isn’t really an issue for me but if I had a lot I can see I’d use a spreadsheet or something like that and tick them off as I update them. I pretty much like to keep everything up-to-date as I’m less prone to get caught by breaking changes and if something breaks you can always roll back pretty easily.