[SOLVED] Control ESP8266 via Iphone hotspot / must also be running fine without wifi

Hi!

Okay, here is my setup.

I build machines that do something for clubs/pubs. These machine cool glasses with CO2 or prepare a drink, or let some puppets dance after you put in a coin. Usually i use the ESP8266, particularly on a NodeMCU Lua board. And those are running fine.

now i have a customer that doesnt want to pay the bill, has excuses for everything and so on. well that is bad.

i am thinking: have blynk on the ESP8266, let it have the ssid and credentials of my iphone hotspot. as soon as a connection is made to my phone i call blynk.run(); and have some switches to cripple the thing if i want to until they pay the bill.

now here are my questions:

i dont want to interrupt the state machine which controls “the puppet dance” or “the glass cooling”. all steampunk style. so if in idle state and if wifi is connected (to my phone when i am there and with enabled hotspot) then i call blynk.run(); to let it do the magic.

will this have any effect if blynk.run() is only called that few times?

will blynk make the processor crash when blynk.run() is not called for a while?

or can i just stop blynk when wifi is not connected?

henning

In general terms, no Blynk.run() no Blynk… it is what keeps everything working in the background - Introduction - Blynk Documentation

As for your No Pay, No Play, issue… perhaps code in a net 30/60/90 timer that halts running and pops up a “enter the Paid in Full code”, with short-term, one-time, codes to “extend” run time a little bit.

Hi Gunner

it is not a no pay no game issue … i didnt make that too clear

a pub or a club asks me to build a machine. i make an estimation, build the machine for them and then … the pub/club does not pay the bill. i am looking for an easy way to disable/cripple the machine to make the pu/club pay their bill to me.

sorry for the misunderstanding …

henning

Sorry, that was probably an unfamiliar saying for you… “No Pay, No Play” means if you don’t do something required, then you don’t get whatever you are wanting.

I meant it as a built in “payment security” routine, wherein after a preset time, if they don’t pay (you) “No pay” then their stuff stops working “No play”, until they pay the bill and you give them the code.

Using Blynk.connect() instead of Blynk.run(), may help. They effectively do the same thing, but according to the documentation Blynk.connect() has a default timeout of 30 seconds - which can presumably be shortened if you wish.
You can also use Blynk.connected() to find-out if the Blynk connection is established and do something if it is.

A couple of (non-Blynk) alternatives…

Build-in a default shut-down switch which kicks-in after 30 days (assuming you work on 30 day payment terms). As suggested above, the kill switch could be disabled by entering a code. You might want to store the kill-switch status in NVR (Spiffs), so that once it’s been overridden it will never kick-in again.

If you can connect to your client’s Wi-Fi system then use HTTP OTA updates to check for new code every so often (daily maybe). Once a payment is recieved and cleared then you pop a new code version on your HTTP server and the device is updated. This would be a handy way to provide remote software support if needed anyway.

Pete.

I think you are all missing the simplest fix… host your own local server in your house.

You can simply disable the app when ever you like and the hardware will accept it regardless of the Wifi connection the ESP8266 uses to connect.

So buy yourself a nice powerful raspberry pi, set it up using instruction on these forums/help center and then hard code all your devices connect to your server. Use port forwarding to give it external access.

You will have complete control over the app and user accounts they’ve set up.

1 Like

Hi thanks for all your answers

one thing that might be missing is …

the ESP8266 has no wifi connection when i am not there. i will not be using the pubs/bars wifi if there is one.
the only time the ESP can have a wifi and therefor internet connection is when i am there with my hotspot/iphone.

i am sure it will work. my question is … will the esp run fine without wifi or will there be any unforseen behaviour of blynk when it has no wifi

henning

Well, essentially Blynk NEEDS a network connection to a server (cloud, local, over the internet or local network, etc). You can code to bypass that need with Blynk.config() and various coding methods… But then then the ESP is just running your normal Arduino type code without any of the Blynk benefits… and if this is the “normal” state of function, what do you use Blynk for?

i know. i have many other projects that use blynk and that are running fine.

What i would like to do is to go to the place and turn the machine off.

go there, esp finds my hotspot, connects to the blynk server, i start the blynk app, flip a switch, machine replies with execution of “cripple”, i turn my hotspot off, machine is crippled,

uncrippling after a paid bill would be the same procedure, flip the switch back and it works fine again.

this whole procedure can be probably done with a directional antenna from the outside.

my concern is only that if for example blynk.run() is not called for a while it will crash or something. i dont know if there are timed interrupts used or so. will it resume working fine after not being called for lets say 20 days…
those are the questions i have.

i have a case of an unpaid 6000€ bill, you know … i just want to be prepared better next time.

hopefully you understand now where i am coming from.
henning

Totaly understand the need… however I think you are using the wrong tools for this application… Blynk is designed to be in control more often than not. You are talking about crippling a full on IOT application and using it as an “emergency” kill switch and nothing more.

You could use any simple, but limited, push button App and BT/BLE module to access and trigger such disconnect, much easier than crippling Blynk (while still allowing regular code to run) until those rare moments where you need to use it.

You could even set up an ESP to act as a WiFi AP that only you can connect to and control that way… no need for Blynk in that application either.

yes thank you …

the AP method was my second choice.

i thought i could easily use this wonderful tools blynk for the purpose …

i will go for second choice now.

thanks everybody … :slight_smile:
henning
closed

You could, but perhaps not worth all the effort and potential risk (having a stable IOT application without the I).

Now, if you have internet access on site (or even a built in Local Server in a “closed circuit” configuration) … you can do some fully managed setup and data logging. Even full control and monitoring that way… at least when you are in range of the Local Servers AP. A bit more effort, but if you need those functions, then perhaps worth going that way?