Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

192.168.0.xxx refused to connect. #948

Closed
Varkzor opened this issue Aug 26, 2022 · 72 comments
Closed

192.168.0.xxx refused to connect. #948

Varkzor opened this issue Aug 26, 2022 · 72 comments

Comments

@Varkzor
Copy link

Varkzor commented Aug 26, 2022

Hi everyone,

I tried to set-up a device for a home monitoring project.
I uploaded with success the software and followed the steps.
How-ever when i connect the device i get mixed results.
Sometimes after a reset (without any configuration done yet), it boots, triggers the 5 short red light flashes for wifi setup, and then 3 red flashes when connection was made. In such a case, it doesn't allow me to connect to the configuration website.

Sometimes after a reset (still without full config done), it boots, triggers 5 red flashes, triggers the camera-flashlight, and then 3 red flashes.
In this case i actually can connect to the website to do the configuration.

I can't re-enact when/how to make either case happen, it's pure coincidence it seems...

I will try to reflash the device again.
But if anyone would have any idea on this behavior, all help would be welcome!

Best regards
/A

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

Quick update, reflashing the device and reloading the data to the SD card as a 'fresh' install, didn't trigger the full availability of the web-page (and triggering the camera flash at first boot-up)...

@pos-ei-don
Copy link

Try a different Webbrowser, especially a mobile Browser works better, sometimes.

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

Tried 2 browsers, now tried my phone also, it's really an issue with the the website not being accessible. The device does show up in my router with it's IP address.
However the IP gives strange results as described above.
So far in the last 12 hours roughly, I only managed to open the configuration web page 2 times, after numerous resets and 2 reinstalls... :-(

@Matzebhv
Copy link

Try a different SD-Card. I have 2 cards here which wont work. If the flashlight does not come up during boot the device is not fully startet. I recommend small sandisc.

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

Hmm i use a 2gb Samsung card.
Is there a way to know/see in logs what the issue could be?
(not sure how to connect to the logs of the device, and if i.e. this is possibla via OTA? like with ESPHOME?)

@Matzebhv
Copy link

This is the part fom the documantation:
Due to the limited availability of GPIOs (OV2640, Flash-Light, PSRAM & SD-Card) the communication mode to the SD card is limited to 1-line SD-Mode. It showed up, that this results in problems with very large SD-Cards (64GB, sometimes 32 GB) and some no name low cost SD-cards.

As flashing and configuring is absolut straight forward you seem to have a faulty esp or the esp can not read your sd-card. I have had simmilar problems with 2 cheap cards fom amazon. I recommend to try a different sd-card.

@Matzebhv
Copy link

You should check your powersupply also. If you have a ps wich is to weak and drops voltage during flashlight on, this wont work too.

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

maybe i made an issue with the cluster size? i used Rufus, set it to FAT32, but cluster size 32k cannot be selected.
Maybe that is the whole root-cause of the issue?

How do you assign the correct clustersize with the formatting event?

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

checked alternate powersupply by the way, no advance :(

@Matzebhv
Copy link

maybe i made an issue with the cluster size? i used Rufus, set it to FAT32, but cluster size 32k cannot be selected. Maybe that is the whole root-cause of the issue?

How do you assign the correct clustersize with the formatting event?

i have formatted the card under windows as fat32

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

Oh and abig thanks by the way for trying to help!!!
I found 1 more 32Gig card at home and will try with that one also.

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

Tried with 2nd SD card no luck, now trying to reflash the device with the 32G SD card.
Will load the files again after i re-format the SD card once again

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

Well, same result...
not sure what is wrong, but without debugging option this is a pretty lost cause.
With the smaller SD card it worked 2 times in about 4 hours or so, now it doesn't, no clear reason or pointer to why it is not working.
Anyone else who knows how to actually debug this thing to see what is the root cause so i can fix it?

@pos-ei-don
Copy link

Zum formatieren selbst kann ich nur
Diesen hier empfehlen.
Der hat sich quasi als Standard etabliert.
Er kann auch Partitons alignment, etc.

Ob er Das ergebnis verbessert, kann ich nicht einschätzen.

https://www.sdcard.org/downloads/formatter/

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

ich habe windows gebraucht, rufus, ich habe 2 karten gebraucht...

Ich bleibe dabei, bei die 1ste karte, hat das 2 mahl functioniert dass ich auf der website kam und die configuration starten könnte.
Weil das am buro war bin ich zu die garage gegehen und das wirktte nicht mehr.
Danach hab ich versucht alles wieder neu zu flashen fur einer frischer start, aber hat nur noch 1 mahl marchiert, zeitwegen nicht mehr...

Wifi marchiert, der software macht verbindung, aber der website offent nicht.
Auch hab ich gesehen dass er die 2 mahl dass er functioniert hat, dass die 2 mahl er nach 5 'flashen' die camera-led activiert hat, die andere mahlen hat der camera-flash niemahls activiert...

Niemand derr wiss wie man logs nachsehen kann?
via OTA? (over the air) vielleicht?

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

IP address

So the software does make connection with the wifi.
But why i can't access the web page is not clear and no idea how to debug what the issue is:

web page

@caco3
Copy link
Collaborator

caco3 commented Aug 26, 2022

A logfile can be accessed direcly throg the following URL: http://<IP>/fileserver/log/message/log_2022-08-26.txt.
Make sure to select the current date (or an older one).

How ever:

  • I am not sure if on your issue already a log file is available.
  • The device might not yet have the word time since the NTP client might not be up yet, not sure what date it then has.

Does the device respond to pings?

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

Good point, i didn't try that yet, but i did just now and the ping was successful:

image

I will try to see nw if i can access any logs

@Varkzor
Copy link
Author

Varkzor commented Aug 26, 2022

Tried to access the logfiles, but same issue as with configuration page access:

image

P.S. Thanks again for trying to help me with this, very much appreciated guys!!!
Have a good weekend!
Hopefully i can somehow get this to work in the coming 2 days 👍

@Varkzor
Copy link
Author

Varkzor commented Aug 27, 2022

@jomjol , any chance you might be able to help me?
Sorry for asking, but i'm totally lost, have no idea why it wouldn't work.
Certainly since out of the different installs it did connect to the web page, and the other 100s of times it didn't.

@Varkzor
Copy link
Author

Varkzor commented Aug 27, 2022

oh and @jomjol excellent project by the way, very very nicely done! :)

@pos-ei-don
Copy link

Maybe, someone can you sell a working esp with sd card, but I do not syany other possibility to help you.

Anyway, would try to reformat the sd card with my proposed Tool. Windows is known to not ideally Format sd cards. That exactly is the purpose of such a Tool.

@caco3
Copy link
Collaborator

caco3 commented Aug 27, 2022

I did not have problems with the standard Windows formating tool!

You also could check the system log through the UART, eg. using PUTTY.

Also, run ping with -n 99999 appended while you try to access the web interface.
When my Wifi connection was not good enough (only internal antenna used), the ping was fine until I started to try to reach the web interface.

@Varkzor
Copy link
Author

Varkzor commented Aug 27, 2022

Maybe, someone can you sell a working esp with sd card, but I do not syany other possibility to help you.

Anyway, would try to reformat the sd card with my proposed Tool. Windows is known to not ideally Format sd cards. That exactly is the purpose of such a Tool.

I really doubt it has to do with the SD card, it actually worked twice and it's i.e. reading the wifi config etc.

Yu still might be right, but in my mind this seems odd as an issue, then also i would have never been able to access the web interface at all before i would guess.

@pos-ei-don
Copy link

I did not have problems with the standard Windows formating tool!

It Depends, if the Partition and Cluster size is already correct before you format. If you had a different filesystem on the card (like ext4), it is probably not.

@Varkzor
Copy link
Author

Varkzor commented Aug 27, 2022

I did not have problems with the standard Windows formating tool!

You also could check the system log through the UART, eg. using PUTTY.

Also, run ping with -n 99999 appended while you try to access the web interface. When my Wifi connection was not good enough (only internal antenna used), the ping was fine until I started to try to reach the web interface.

Any info on how to access system log using Putty?

Ping still works even when i make web-calls

@Varkzor
Copy link
Author

Varkzor commented Aug 27, 2022

image

never going above 140ms - correction 1 time 163 - ping when refreshing the webpage. Seems still OK to me.

@caco3
Copy link
Collaborator

caco3 commented Aug 27, 2022

ping and connectivity seem to be ok.

I would need to check with putty this evening since I dont use windows myself and am away now.

@Varkzor
Copy link
Author

Varkzor commented Aug 27, 2022

The only thing which keeps catching my eye after analysis about the issue is that when resetting, the following options were visible:

2 times the website access worked:

Reset -> Quick red light blink -> 5 times longer blink for web initiation -> camera flashlight went on -> Website was accessible.

all other times i couldn't access the website:

Reset -> Quick red light blink -> 4 times blink -> quick red light blink -> 3 times blink
OR: Reset -> Quick red light blink -> 3 times blink -> quick red light blink -> 3 times blink
OR: Reset -> Quick red light blink -> 5 times blink -> quick red light blink -> 3 times blink

What I wonder now is if the 'quick red light blink' here means it's continuously re-initiating the whole set-up procedure and it's hanging there?
That would explain why it's not going 1 step further.
@jomjol if you would have an idea here, it might really help me figure out the potential issue.
Thanks in advance.

@Varkzor
Copy link
Author

Varkzor commented Aug 27, 2022

ping and connectivity seem to be ok.

I would need to check with putty this evening since I dont use windows myself and am away now.

Thanks in advance Caco3!
And again big thanks for trying to clear up my mystery :-D

@Varkzor
Copy link
Author

Varkzor commented Aug 28, 2022

Also 1 more question, is it possible to completely redo the initial reconfiguration from the web page?
I have to remount it now for testing, and will remount it when i am on-site in the remote location where it will end up in the future.

1 more thing, i'm not a very experienced user in ESP32, the biggest issue was the camera mounting on my side, i didn't follow a crucial step of opening the lid to put in the camera, i thought it was a slide-in connector, but it's actially some kind of 'open and clip down' connector.

Issue totally on my side, hard to prevent from programmer/development side.

@Matzebhv
Copy link

For initial configuration set

SetupMode = true

in your config.ini

@Varkzor
Copy link
Author

Varkzor commented Aug 28, 2022

Thanks guys,
Another additional question, is there a way to help the device to better learn the reference values?

Example - on my side it's totally off right now :)

image

Or does this go automatically?

@Matzebhv
Copy link

You should try out a 100 class training modell -> dig-class100*

I would also recommend to put some type of alignment marks on your meter. And it seems that your rois are to big and also not good aligned.

@Varkzor
Copy link
Author

Varkzor commented Aug 28, 2022

So change this:

[Digits]
Model = /config/dig-class11_1411_s2_q.tflite

to this:

[Digits]
Model = /config/dig-class100_s1d-md-v1.0_q.tflite

or
[Digits]
Model = /config/dig-class100_0120_s2_q.tflite

?

@Varkzor
Copy link
Author

Varkzor commented Aug 28, 2022

few hours later, seems to work better very suddenly:

image

@Matzebhv
Copy link

So change this:

[Digits] Model = /config/dig-class11_1411_s2_q.tflite

to this:

[Digits] Model = /config/dig-class100_s1d-md-v1.0_q.tflite

or [Digits] Model = /config/dig-class100_0120_s2_q.tflite

?

Yes, you can try both and look which one works better for you.
I also would move all rois one pixel to the left as they are slightly missaligned. And you should delete your analog roi, your meter has no analog digit.

@Varkzor
Copy link
Author

Varkzor commented Aug 28, 2022

i will try that thanks Matze.during config when deleting all 4 it said it would remove all of the dig and ana's..

@Matzebhv
Copy link

Uncheck this one, then delete all rois.

Screenshot 2022-08-28 171053

@jomjol
Copy link
Owner

jomjol commented Aug 28, 2022

Sure - what type of topics are suggested?
What is already present (see main.cpp)

  • Not enough PSRAM (< 4 MB)
  • Camera could not be initated

What else is recommeded?

  • SD-Card is not possible
  • Some info about the WLAN?

@friedpa
Copy link

friedpa commented Aug 28, 2022

Hallo Josef,
Deine Entscheidung :o) Aber ich denke, dass obere reicht für einen Quick Erstcheck und würde viele Stunden ersparen ....
Liebe Grüße
Paul

@jomjol
Copy link
Owner

jomjol commented Aug 28, 2022

Hallo Paul,

ergänze das gerne. Habe noch nicht verstanden, was du mit "das obere" meinst.

EDIT: habe jetzt mal vor jeden reboot (entweder automatisch oder manuell getriggert) eine erzwungene Info für das Logfile (auch wenn abgeschaltet sein sollte) implementiert. Geht gleich mit dem neuen Release (v11.2.0) heute noch raus.

@Varkzor
Copy link
Author

Varkzor commented Aug 28, 2022

Hey JomJol,
Einde idee dass ich noch denken kann zum beispiel ist andere signalen mit die roten led machen.
zum beispiel: 2 schnelle flashen = algemeine software config error (sd carte nicht gut, files nicht vorhanden, keine richtige interne configuration...)
3 schnelle flashen= algemeine hardware problemen: camera initialization nicht gut, Flash drive issues, ...

Nur eine idee. Gibt vielleicht mehrere optionene.

Und dann noch ein mahl, wass ein super tool dass du gemacht habe! Vielen dank, der wirkt jetzt supergut!

Mfg,
Alex

@friedpa
Copy link

friedpa commented Aug 28, 2022

Das "obere" meinte Deinen Vorschlag der 4 Punkte, denke mehr ist eigentlich nicht ntwendig.
Liebe Grüße
Paul

@Varkzor
Copy link
Author

Varkzor commented Aug 29, 2022

Excellent guys :-)
image
Last hurdle on my side: i configured it to send to MQTT but it won't load into home assistant.
I guess it has to do with my configuration.yaml which i couldn't set-up properly.
Need to do some more digging...

By the way, is there a way to see if the message was sent successfully from the device to the MQTT broker?

BR
Alex

@Matzebhv
Copy link

Turn on debug -> logfile -> true.

2022-08-26T00:04:01: sent publish successful in MQTTPublish, msg_id=23855, wasserzaehler/connection, connected
2022-08-26T00:04:01: sent publish successful in MQTTPublish, msg_id=56266, wasserzaehler/uptime, 37308
2022-08-26T00:04:01: sent publish successful in MQTTPublish, msg_id=34278, wasserzaehler/freeMem, 3152867
2022-08-26T00:04:01: sent publish successful in MQTTPublish, msg_id=22098, wasserzaehler/wifiRSSI, -78
2022-08-26T00:04:01: sent publish successful in MQTTPublish, msg_id=34109, wasserzaehler/main/value, 704.529
2022-08-26T00:04:01: sent publish successful in MQTTPublish, msg_id=45903, wasserzaehler/main/error, no error
2022-08-26T00:04:01: sent publish successful in MQTTPublish, msg_id=58610, wasserzaehler/main/rate, 0.000000
2022-08-26T00:04:02: sent publish successful in MQTTPublish, msg_id=45803, wasserzaehler/main/changeabsolut, 0.000
2022-08-26T00:04:02: sent publish successful in MQTTPublish, msg_id=2895, wasserzaehler/main/raw, 00704.529
2022-08-26T00:04:02: sent publish successful in MQTTPublish, msg_id=41137, wasserzaehler/main/timestamp, 2022-08-26T00:03:18
2022-08-26T00:04:02: sent publish successful in MQTTPublish, msg_id=41115, wasserzaehler/main/json, {"value":704.529,"raw":"00704.529","error":"no error","rate":0.000000,"timestamp":"2022-08-26T00:03:18"}

@Varkzor
Copy link
Author

Varkzor commented Aug 29, 2022

Thanks Matze,
I do seem to get some issues towards my Home Assistant config:
issue Homassist config

@Matzebhv
Copy link

My plattform is iOBroker, so sorry i cant help you with home assistant. Maybe you should ask your question in some kind of ha facebookgroup or forum.

@Varkzor
Copy link
Author

Varkzor commented Aug 29, 2022

Hmm,
think my config is ok, however i don't see mqtt connecting in the logs like it does with you Matze:

2022-08-29T22:48:58: Time zone set to CET-1CEST,M3.5.0,M10.5.0/3
2022-08-29T22:48:58: =============================================================================================
2022-08-29T22:48:58: =================================== Main Started ============================================
2022-08-29T22:48:58: =============================================================================================
2022-08-29T22:49:02: Time zone set to CET-1CEST,M3.5.0,M10.5.0/3
2022-08-29T22:49:03: task_autodoFlow - next round - Round #1
2022-08-29T22:49:03: FlowControll.doFlow - ClassFlowMakeImage
2022-08-29T22:49:11: FlowControll.doFlow - ClassFlowAlignment
2022-08-29T22:50:04: FlowControll.doFlow - ClassFlowCNNGeneral
2022-08-29T22:50:07: FlowControll.doFlow - ClassFlowCNNGeneral
2022-08-29T22:50:07: Cannot load model
2022-08-29T22:50:07: FlowControll.doFlow - ClassFlowPostProcessing
2022-08-29T22:50:07: FlowControll.doFlow - ClassFlowMQTT
2022-08-29T22:50:08: task_autodoFlow - round done
2022-08-29T22:50:08: CPU Temperature: 62.2
2022-08-29T22:51:34: handler_wasserzaehler - Start
2022-08-29T22:51:34: handler_wasserzaehler - Start
2022-08-29T22:51:34: handler_wasserzaehler - Start
2022-08-29T22:51:34: handler_wasserzaehler - Start
2022-08-29T22:51:34: handler_prevalue - Start
2022-08-29T22:51:34: handler_prevalue - Start
2022-08-29T22:51:34: info_get_handler
2022-08-29T22:51:36: handler_prevalue - Start
2022-08-29T22:51:36: handler_prevalue - Start
2022-08-29T22:51:38: download_get_handler
2022-08-29T22:51:40: download_get_handler

@Varkzor
Copy link
Author

Varkzor commented Aug 29, 2022

Device doesn't seem to trigger the MQTT part, although it's activated in the config.
Nothing received on the MQTT side either.

[MQTT]
Uri = mqtt://core-mosquitto:1883
MainTopic = watermeter
ClientID = water
user = ******
password = ******
SetRetainFlag = true

@Varkzor
Copy link
Author

Varkzor commented Aug 29, 2022

maybe it won't work because i never seem to get a "value"?
The raw readings are excellent for what i need though:
image

@Matzebhv
Copy link

The system sends mqtt messages at every intervall. Have you seen this issue?
#953

And, you have set your "MaxRateValue" and your "DecimalShift" wrong. The reading should be 1996.618

@Matzebhv
Copy link

I see you have posted in the other issue also.
Uri = mqtt://core-mosquitto:1883 is wrong, you have to use the ip of your mosquitto instaed.

@Varkzor
Copy link
Author

Varkzor commented Aug 30, 2022

Thanks for the info Matze, before i used the IP, didn't work either.

I will test the IP setup again.

@Matzebhv
Copy link

I think the problem is at your mqtt backend. Perhaps you can try this tool to test your mqtt server -> http://mqtt-explorer.com/

To clarify @jomjol : does your software only log successfull mqtt transmissions? As in the provided log i can not even see the attempt to send any messages.

@jomjol
Copy link
Owner

jomjol commented Aug 30, 2022

If the mqtt could not connect during startup, it will be deactivated and not try to send anything.

@Varkzor
Copy link
Author

Varkzor commented Aug 30, 2022

Yeah it worked, i was unfortnately using a wrong IP address, now it's sending data.
It's not being received in the Home Assistant side, but i guess it has to do with the set-up configuration on that end for some reason..

I hope to figure it further out.
Big thanks again to everyone for helping to make this work.

Very interesting and useful project.

@jomjol
Copy link
Owner

jomjol commented Aug 31, 2022

Then I close this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants