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

Safety mode #174

Closed
zsamiatt opened this issue Jun 10, 2021 · 12 comments
Closed

Safety mode #174

zsamiatt opened this issue Jun 10, 2021 · 12 comments
Assignees
Labels
architecture Changes to the underlying hardware or software architecture done The underlying issue has been fixed enhancement New feature or request
Milestone

Comments

@zsamiatt
Copy link

zsamiatt commented Jun 10, 2021

If wifi or HA dead need safety mode.
We need control inbuild relay. It's hard to fix problem in the dark. And I think the screen protection should also work without network.

I have Lanbon L8 with 0.6.0 firmware.

@zsamiatt zsamiatt added the enhancement New feature or request label Jun 10, 2021
@nagyrobi
Copy link
Collaborator

Ongoing discussion about this: #61

@fvanroie fvanroie added this to the 0.6.x milestone Aug 2, 2021
@fvanroie fvanroie self-assigned this Aug 2, 2021
@fvanroie
Copy link
Collaborator

fvanroie commented Aug 2, 2021

In 0.6.1 the automatic reboot on wifi disconnect has been removed. The plate will keep on trying to reconnect indefinitely...

/online.cmd and /offline.cmd scripts are executed when the wifi status changes. This makes it possible to disable or hide buttons, go to a special offline page, etc...

Mqtt has not yet received the same update, but will probably get a similar change.

@nagyrobi
Copy link
Collaborator

nagyrobi commented Aug 3, 2021

@fvanroie
Copy link
Collaborator

I have created a feature-mqtt branch that doesn't obstruct the normal GUI while MQTT reconnects.
The Connecting... progressbar is gone and the plate keeps responding as normal to local events.

This needs thorough testing though... as it involves some multi-threading and semaphores, which I'm not really familiar with.
Preliminary testing seems OK here, but just in case you want to test this branch I would not advised to put it on a production plate.

@fvanroie fvanroie added the wip Work in Progress label Jan 26, 2022
@fvanroie fvanroie modified the milestones: 0.6.x, 0.7.x Jan 26, 2022
@fvanroie fvanroie added the architecture Changes to the underlying hardware or software architecture label Jan 26, 2022
@fvanroie fvanroie removed the wip Work in Progress label Apr 12, 2022
@bensuffolk
Copy link
Contributor

Can you add a feature to run a cmd file when MQTT connects and when it disconnects like you do for wifi?

@fvanroie
Copy link
Collaborator

fvanroie commented Jul 7, 2022

The main issue has been that the PubSubClient library has a blocking connect() method which locks up the UI for serveral seconds before it times-out. For this the reason the openHASP MQTT code blocks the display whenever it looses the connection... To work around this issue, I had created a bit of a hack that runs the connect() method in a separate task. That hack is in the old feature-mqtt branch but I'm not confident that this will be a good (long-term) solution.

I'm playing around now with the esp_mqtt module, which is Espressifs implementation of the MQTT protocol for their IOT devices. It seems to work well and handles disconnects gracefully without blocking the UI. My reasoning is that swapping MQTT clients would be a better long-term solution since it's Espressifs own code. There are also a lot of additional capabilities that could be used, like MQTTS or MQTT v5, etc...

I'll publish my code later for testing, but basically it would be a simple define to switch like:

#define USE_ESP_MQTT
//#define USE_PUBSUBCLIENT

@bensuffolk
Copy link
Contributor

That sounds like a sensible way forward to me.

@fvanroie
Copy link
Collaborator

fvanroie commented Jul 7, 2022

Now that I think about it... it could have an influence on the ETHSPI code. PubSub uses an Arduino WifiClient object as its underlying network protocol. I don't think that esp_mqtt supports the Arduino networking library since it's an ESP-IDF module. Probably the ESP-IDF W5500 lwip network interface needs to used...

@bensuffolk
Copy link
Contributor

The ETHSPI is using the lwip network interface, so it will all just work with the WiFiClient. It's not a separate Ethernet library.

@fvanroie
Copy link
Collaborator

fvanroie commented Jul 9, 2022

My bad! I thought it was a purely Arduino SPI library, but looking under the hood indeed reveals the ESP-IDF framework being used. This is good news and should indeed be supported by the esp_mqtt client.

I have checked in the code but now somehow the Github throws an error while I'm able to compile locally...

@fvanroie
Copy link
Collaborator

I've worked around the error by disabling Freetype for the time being.

@fvanroie fvanroie added the wip Work in Progress label Jul 26, 2022
fvanroie pushed a commit that referenced this issue Jul 26, 2022
fvanroie pushed a commit that referenced this issue Jul 26, 2022
fvanroie pushed a commit that referenced this issue Jul 30, 2022
fvanroie pushed a commit that referenced this issue Nov 21, 2022
@fvanroie
Copy link
Collaborator

I've added mqtt_on.cmd and mqtt_off.cmd scripts.

fvanroie pushed a commit that referenced this issue Nov 28, 2022
@fvanroie fvanroie added done The underlying issue has been fixed and removed wip Work in Progress labels Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Changes to the underlying hardware or software architecture done The underlying issue has been fixed enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants