@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.
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.
Whilst this is a great idea and Iām going to do it just because, have you seen this sonWEB it will do what you want as an add on with UI for managing your sonoff devices aswell as OTA firmware.
Thanks! Never seen that one before. Iāll take a look.
They have changed the URL now slightly.
Correct code will now be
- platform: command_line
name: "Latest Tasmota"
command: "curl -s https://github.com/arendst/Tasmota/releases/latest | cut -d'\"' -f2 | rev | cut -d'/' -f1 | rev"
scan_interval: 600
Seems that something changed in the URL now again.
It redirects in the browser.
Any suggestion on how to fix this sensor?
Still seems unchanged to me.
Strange, for me the sensor became empty since this morning. Was working fine more then a year. No errors at all, it is just empty.
Have you tried visiting the URL in a browser. Still good here
Iām seeing the same - no errors, just an empty sensor. Iām also seeing the same thing with a similar sensor Iāve set up for the latest Valetudo version on GitHub.
It seems the ālatestā link no longer loads a redirect message, but just an empty page, before redirecting. Running the curl command from a command line without the -s (silent) parameter, and without the ācutā filter, now just produces an empty response. From memory, it used to show the redirect message.
The link itself obviously still redirects correctly in a web browser, but thatās not really the point surely? From my understanding, curl doesnāt redirect by default, and so just stays on the page with the redirect message, which is what we want - not the page it ends up on - so we can extract the latest version from the message using ācutā.
I wonder if youāre not seeing this yet due to some caching going on somewhere?
A bit of googling around produced this, which works from the command line:
curl -LsI -o /dev/null -w %{url_effective} https://github.com/arendst/Tasmota/releases/latest | rev | cut -d'/' -f1 | cut -d'v' -f1 | rev
Explanations as far as I can see:
-L - follows the redirect
-I - only downloads the headers of the destination page, not the body - seems to cut down the text that the command returns
-s - curl works silently
-o - output ā /dev/null - output result to null
-w - return the final url (which we need to work the cut magic on)
Because we are dealing with the url now, thereās no need to handle quotation marks or escape them, so we can drop the first cut action from the previous version.
Will see if this gets the sensor back up and running and report back.
EDIT: yep, seems to work fine for both the Tasmota and Valetudo sensors.
Solved the issue for me.
Thanks!
ok I worked it out. I am using the Github integration not curl. I have arendst/tasmota starred. It provides a sensor
and I use a template sensor to extract the tag
tasmota_firmware_version_available:
friendly_name: 'Tasmota Firmware Version Available'
value_template: "{{ state_attr('sensor.arendst_tasmota_latest_release', 'tag') }}"
IF I visit Release Tasmota v13.4.0 Quinta Ā· arendst/Tasmota Ā· GitHub the url in the original sensor above I see this though:
so I donāt understand why the original isnāt still working.