huizebruin / s0tool

S0 & watermeter mesure tool from huizebruin.nl and s0tool.nl . Be sure to šŸŒŸ this repository for updates! Its a hobby project . Flash it go to the link below.
https://s0tool.nl/
MIT License
81 stars 25 forks source link

stream pointer vanished / http_request error #234

Open bert1111 opened 1 day ago

bert1111 commented 1 day ago

*Describe the bug I had some wifi issues (broken antenna) which were resolved but suddenly the s0 meter vanished from my network. I installed the latest update through the website with a usb cable. I can set the network and then after a few seconds I see stream pointer vanished. And device connection is lost again. I did find that there is a bug somewhere with esp home but not yet solved. Is there a workaround? Strange thing is that it has worked for two months before the wifi problem.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

huizebruin commented 1 day ago

Do you see a ssid with the name S0tool*** with your mobile? Than its not connected to your wifi network.

And than you must connect it again to your network. you can connect to the s0tool ssid. and go to 192.168.4.1 and there you can connect to your wifi network again.

bert1111 commented 1 day ago

no that ssid doesn't appear anymore. it has something to do with this issue. https://github.com/esphome/issues/issues/5949. I don't know if you're aware of this. afbeelding

huizebruin commented 1 day ago

What i heart it was fixed an little time ago. But it doesn't when i see this. i will contact some of my other Dutch users on my discord if they also have the same error after the update or flashing the s0tool.

What version of Home assistant and ESPHome are you using?

bert1111 commented 1 day ago

Firmware: 3.6.2 (ESPHome 2024.9.1) Versie | core-2024.9.3 Installation type | Home Assistant OS What does appear to work is not finish the flashing by skipping the search for wifi networks. Than the s0tool network appears. Go to the url you mentioned above. Set the wifi there. The watermeter is now connected for a few minutes were it previously disconnected after a few seconds with mentioned error.

bert1111 commented 1 day ago

Nope. It's gone again. Same error [http_request.arduino:137] Stream pointer vanished!

huizebruin commented 1 day ago

When u use the same esp it stores the ssid and password in his esp. That's why you don't see the selecting ssid (wifi) list.

bert1111 commented 1 day ago

I think I'm not explaining it good enough. Or I don't understand it enough. I'll try again but be clearer of the steps I'm taking.

So the watersensor was working fine up until last night with version 3.6.1. Today I saw in HA that all watermeter sensors were not available. I reinstalled via the webpage to version 3.6.2. And from the moment I select my wifi network I lose connection with error http_request.arduino:137] Stream pointer vanished!

The last thing I tried was reinstalling via the website and skipping the set wifi part. Then the s0*** network appears. I chose that network and set the wifi via 192.168.4.1 like you said. Then the s0 network disappears because it is connected to my home wifi. So I do see my ssid to connect with in the list.

After that, it is connected and is visible again on my network until it starts giving the http_request.arduino:137] Stream pointer vanished! error. This was the case first after a few seconds with the first way. And with the skipping the set wifi part, but setting through the 192.168.4.1 after a few minutes.

bert1111 commented 1 day ago

This is the log after succesfully connecting to my wifi. And after this it even appears the device crashes after waiting a while. Page does not respond

`[I][safe_mode:041]: Boot seems successful; resetting boot loop counter [I][captive_portal:032]: Captive Portal Requested WiFi Settings Change:

[W][component:157]: Component wifi set Warning flag: scanning for networks [I][wifi:540]: - 'xxxxxxx [I][wifi:313]: WiFi Connecting to 'xxxxx'... [I][wifi:617]: WiFi Connected! [W][component:170]: Component wifi cleared Warning flag [W][component:170]: Component api cleared Warning flag `

huizebruin commented 1 day ago

I will look if i can remove the http sensor for now

scns commented 1 day ago

I hope that Will fix the issue.

When there is a fix i Will test The fix first thing tomorrow

bjornpri commented 1 day ago

Identical problem here on a Wemos D1 Mini V4.0.0 Type-C USB. Has been working fine for a long time. Until 3.6.2: Works after install, stops working with same issue explained in this thred after power recycle.

huizebruin commented 1 day ago

i'm pushing now a version online without the ota update and http update . https://github.com/huizebruin/s0tool/actions/runs/11085402377

huizebruin commented 1 day ago

https://github.com/huizebruin/s0tool/actions/runs/11085452651 this looking better

huizebruin commented 1 day ago

@bjornpri and @bert1111 Would you try it out to flash it from https://s0tool.nl

I uploaded the changes.

https://github.com/huizebruin/s0tool/actions/runs/11085452651/job/30801987513

bjornpri commented 1 day ago

I tried twice. No change. Is there a visual change I can look for so we know I have the new version?

huizebruin commented 1 day ago

I named the version inside of the basis file 3.6.3

bjornpri commented 1 day ago

Is still says 3.6.2 every where. I tried a third time. No change. After install i visit the device and it looks good. Then without removing power i press the restart link in the web UI and it comes up with the same issue.

I do not connect it to ESPHome I just restart it right after flashing.

scns commented 1 day ago

The release build is not yet started. @huizebruin, van you publish 3.6.3?

scns commented 1 day ago

I named the version inside of the basis file 3.6.3

I think that is not working because The firmware on the website is not updated on The site.

huizebruin commented 1 day ago

Its building right now https://github.com/huizebruin/s0tool/actions/runs/11085685338

scns commented 1 day ago

Build is done!

scns commented 1 day ago

@bjornpri @bert1111 can you try again?

huizebruin commented 1 day ago

It should now be online, i flasht a spare part one now from the website to 3.6.3.

bjornpri commented 1 day ago

Almost. It survives all kinds of resets. but... I can not add it to ESP Home:

INFO ESPHome 2024.9.1 INFO Reading configuration /config/esphome/s0tool-watermeter-202f4c.yaml... INFO Updating https://github.com/huizebruin/s0tool/@main INFO Detected timezone 'Europe/Oslo' Failed config

update.http_request: [source /data/packages/b59da29a/esphome/components/s0tool-watermeter-update.yml:2]

Component update.http_request requires 'platform: http_request' in component 'ota'. platform: http_request name: Firmware Update id: update_http_request source: https://s0tool.nl/s0tool-watermeter/manifest.json

scns commented 1 day ago

Almost. It survives all kinds of resets. but... I can not add it to ESP Home:

INFO ESPHome 2024.9.1

INFO Reading configuration /config/esphome/s0tool-watermeter-202f4c.yaml...

INFO Updating https://github.com/huizebruin/s0tool/@main

INFO Detected timezone 'Europe/Oslo'

Failed config

update.http_request: [source /data/packages/b59da29a/esphome/components/s0tool-watermeter-update.yml:2]

Component update.http_request requires 'platform: http_request' in component 'ota'.

platform: http_request

name: Firmware Update

id: update_http_request

source: https://s0tool.nl/s0tool-watermeter/manifest.json

@bjornpri Did you remove your old entry in esphome?

huizebruin commented 1 day ago

im adding it to my beta machine. image

bjornpri commented 1 day ago

It failed while verifying the yml file with the error: Component update.http_request requires 'platform: http_request' in component 'ota'.

I added it in ESPHome and I broke it again. I'll try once more deleting old stuff and restarting HA.....

It autodiscovers and I can 'adopt' it... I adopt it and I get this during install:

Skjermbilde_28-9-2024_20833_5tm9f4r0u5o245ga9vsegd5retwbjalo ui nabu casa

huizebruin commented 1 day ago

I've been testing it now a couple of times. But it's working here now good and no losses that the device is going offline.

huizebruin commented 1 day ago

Adopt first to ESPHome and after that to Home assistant.

But did you delete it from your esphome dashboard also?

scns commented 1 day ago

I think The repo needs to be refreshed on your'e instance.

In the worst case you have to wait till tomorrow. (24 hrs)

I had with my own projects The same.

Sounds weird but sometimes you have to wait. The device in the integration is still working if it has the same name

bjornpri commented 1 day ago

Adopt first to ESPHome and after that to Home assistant.

But did you delete it from your esphome dashboard also?

That is what I did. Deleted every thing i HA and ESPHome. It fails validating the yaml while adopting in ESPHome. I states it is missing OTA.

bjornpri commented 1 day ago

im adding it to my beta machine. image

ESPHome 2024.8.1? Im using 2024.9.1.

huizebruin commented 1 day ago

image or try clean build files , then validate , then install

bjornpri commented 1 day ago

While selecting "Clean Build Files":

Skjermbilde_28-9-2024_202720_5tm9f4r0u5o245ga9vsegd5retwbjalo ui nabu casa

scns commented 1 day ago

Just wait at least 24 Hours šŸ˜…

bjornpri commented 1 day ago

It seems that ESPHome 2024.9.1 requires the platform: http_request to be able to properly adopt the device. I can controll it by setting new values and restart it from HA but the enteties in HA will not update. The API wil probably not work without he API encryption key...? Yes?

And when I add it (the OTA: -plattform: http_request) ESPHome is happy and starts updating the device, and when its done, it is broken, back to this original issue.

scns commented 1 day ago

I Will test tomorrow.

bjornpri commented 1 day ago

I Will test tomorrow.

Thanks

huizebruin commented 1 day ago

Me to and hopefully we find a solution for the problem.

scns commented 1 day ago

image image image image

I flashed this morning my production S0 tool. And everyrhing worked fine.

Import in ESPhome, no problem. And the device came online in HA. I Will monitor of the device stay's online.

bjornpri commented 1 day ago

Im testing this morning. Same issue.

image

My tool's yaml file seems to be missing platform: http_request' in component 'ota'. @scns does your tools yaml file contain the ota component?

image

huizebruin commented 1 day ago

@bjornpri at at line 4 after yaml@main maybe is that it.

bjornpri commented 1 day ago

@huizebruin What at line 4? Where? Line 4 in the yaml file there is no ..@main In the output log there is the timezone on both @scns and mine after ...@main.

If i put in: ota:

the device validates and updates but brakes after update, with the original issue.

huizebruin commented 1 day ago

Do you flash it by this link https://s0tool.nl/Installation.html ? or do you hit the install button inside the esphome dashboard ?

remove the s0tool out of your esphome dashboard and than flash it .

JGeeforce commented 1 day ago

Yesterday at 23:23 S0tool was suddenly available. Long story short, this morning I clean build files, deleted the device in ESPhome and did a new install by connecting it to the USB port. It's back again.

bjornpri commented 1 day ago

Yes. I use this: image

bjornpri commented 1 day ago

Do you flash it by this link https://s0tool.nl/Installation.html ? or do you hit the install button inside the esphome dashboard ?

remove the s0tool out of your esphome dashboard and than flash it .

Done this 3 times now. No sucsess

huizebruin commented 1 day ago

image im testing that one at his moment too

bjornpri commented 1 day ago

The flash is good. Works fine. Does not breake the device. Stands reboots. All fine so far.

bjornpri commented 1 day ago

@huizebruin Does your ESPHome yaml file for your device include:

ota: