Properly reset PMS7003 via Rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
JohnW
Normal user
Posts: 10
Joined: 19 Oct 2019, 20:27

Properly reset PMS7003 via Rules

#1 Post by JohnW » 26 Dec 2022, 14:26

Hello,

I have PMS7003 dust sensor and sometimes it stops working, so I want to automatically reset it via Rules.
Have checked PMS7003 specs and it looks like we need to set Reset Pin Low, but in ESP Easy source I see this code for reset:

Code: Select all

// Toggle 'reset' to assure we start reading header
    addLog(LOG_LEVEL_INFO, F("PMSx003: resetting module"));
    pinMode(_resetPin, OUTPUT);
    digitalWrite(_resetPin, LOW);
    delay(250);
    digitalWrite(_resetPin, HIGH);
    pinMode(_resetPin, INPUT_PULLUP);
How to set Reset Pin INPUT_PULLUP in Rules?

User avatar
Ath
Normal user
Posts: 3482
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Properly reset PMS7003 via Rules

#2 Post by Ath » 26 Dec 2022, 14:44

You can use the command

Code: Select all

pmsx003,reset
to reset the sensor. This can be issued from rules, the Tools page, or remote via HTTP or MQTT (when using the OpenHab controller).

It requires the RST pin to be configured correctly.
/Ton (PayPal.me)

JohnW
Normal user
Posts: 10
Joined: 19 Oct 2019, 20:27

Re: Properly reset PMS7003 via Rules

#3 Post by JohnW » 27 Dec 2022, 16:17

Ath wrote: 26 Dec 2022, 14:44 You can use the command

Code: Select all

pmsx003,reset
to reset the sensor. This can be issued from rules, the Tools page, or remote via HTTP or MQTT (when using the OpenHab controller).

It requires the RST pin to be configured correctly.
Unfortunately, I don't see in logs (Debug Dev) any output releted to the sensor reset. Wiring looks good - RST pin is connected to GPIO13.

TD-er
Core team member
Posts: 8738
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Properly reset PMS7003 via Rules

#4 Post by TD-er » 27 Dec 2022, 17:05

What build are you using?
This reset command was only added a few months ago.

JohnW
Normal user
Posts: 10
Joined: 19 Oct 2019, 20:27

Re: Properly reset PMS7003 via Rules

#5 Post by JohnW » 27 Dec 2022, 18:10

TD-er wrote: 27 Dec 2022, 17:05 What build are you using?
This reset command was only added a few months ago.
I was thinking about it as well - old build.
Any way to properly reset via Rules w/o updating to a new build? Don't know if there were some breacking changes.

TD-er
Core team member
Posts: 8738
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Properly reset PMS7003 via Rules

#6 Post by TD-er » 27 Dec 2022, 21:52

I always try to make no breaking changes.
This means when we add new features, the settings will be patched to make sure there are at least sensible defaults for the new features.
However, sometimes settings need to be patched in such a way that it is actually a breaking change.. but only when going back to an older build using the same settings.

It is always a good idea to backup the settings file if you're making a large jump in ESPEasy builds.

You could on the "Hardware" tab set the pin you need to input pullup.
This will make sure the device is not kept in reset when you boot.
Then you can just use the GPIO calls in the rules to trigger the same kind of reset as is done in the code you quoted.

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests