Regulator - Level Control

.

Plugin details

Type: Regulator

Name: Level Control

Status: NORMAL CLIMATE

GitHub: P021_Level.ino

Maintainer: .

Used libraries: .

Introduction

It is always helpful to have some sort of local level control. This is something that would normally be handled by a Home Automation controller, but if you really need to have something like a locally controlled heater, you could use the Level Control plugin.

The ESP module can be used as a level controlling device, think of a simple temperature control unit. Use a DS18B20, BME280 or similar temperature sensor and a mechanical or solid state relay to control a heater. Connect this relay to a GPIO pin.

Configuration

Device Configuration
  • Name A unique name should be entered here.

  • Enabled The device can be disabled or enabled. When not enabled the device should not use any resources.

Sensor

  • GPIO -> Level low Select a GPIO pin that will be updated when the Level state changes. The state is applied directly on the GPIO pin, so only On (1) and Off (0) will be set.

  • Check Task Select the Task that should be monitored. Initially the first Task will be selected. Only configured tasks can be selected.

  • Check Value After selecting the task, the value that should be monitored can be selected. Initially, the first value of the task is selected.

  • Set Level The value that is to be maintained. Decimals can be used in this value.

  • Hysteresis To avoid ‘flip-flopping’ of the output, some hysteresis should be applied to the Set Value. The value entered here will be applied ‘around’ that set value, so half of the hysteresis below Set Value will turn on (1) the output state, and half of the hysteresis above the set value will turn off (0) the output state.

There is 1 exception to the Hysteresis: If the Hysteresis is set to 0, the output state will turn on (1) if the measured value goes below Set Value, and the output state will turn off (0) if the measured value reaches Set Value + 1.0.

  • Invert Output: When checked, the output state will be 0 instead of 1 when the level is activated.

  • Save ‘Set Level’ after change via config command Via the config command, the Set Level value can be changed. To avoid wearing out the flash memory of the device by too often saving these settings, the default is now off, for existing tasks (after upgrade of ESPEasy), the old behavior of saving after each change is still active. The user should decide if saving the setting is actually required, or if that can be attained by carefully planning a save command or via a manual save.

  • Auto-save interval: Here a time in minutes can be set after which any changed ‘Set Level’ via the config,task,<taskname>,SetLevel,<value> command will be saved. This requires that the above setting Save ‘Set Level’ after change via config command is disabled! When used, a setting of ca. 30 minutes, or even longer when the Set Level is changed often, seems apropriate, unless the unit often reboots, but then that cause should be investigated and solved. The timer, when activated, should survive a warm reboot.

Data Acquisition

This group of settings, Single event with all values and Send to Controller settings are standard available configuration items. Send to Controller is only visible when one or more Controllers are configured.

Values

The output state value is available in Output. No other options are available for Values.

Commands available

Command

Extra information

config,task,<taskname>,SetLevel,<value|calculation>

Value: {Any valid numeric (float) value}

Calculation: {A valid calculation, as can be used in Rules}

Using this command, either from rules, via http or mqtt, the Set Level of the plugin can be changed. If the value differs from the currently set value, the settings are saved.

config,task,<taskname>,SetHysteresis,<value|calculation>

Value: {Any valid numeric (float) value}

Calculation: {A valid calculation, as can be used in Rules}

Using this command, either from rules, via http or mqtt, the Hysteresis of the plugin can be changed. If the new value differs from the currently set hysteresis, the settings are saved.

[<taskname>#GetLevel]

Not a real command, but this plugin supports the GetLevel Config function, to retrieve the Set Value from the settings, by using the pseudo value GetLevel.

[<taskname>#GetHysteresis]

Not a real command, but this plugin supports the SetHysteresis Config function, to retrieve the Hysteresis from the settings, by using the pseudo value GetHysteresis.

Events

When the Output state changes, an event is generated, with the new state as the payload, so this change can also be handled using Rules.

Change log

Changed in version 2.0:

added 2023-10-28: Set Hysteresis via config command and get via [<Taskname>#GetHysteresis] variable.

added 2022-08-22: Auto-save interval option.

added Major overhaul for 2.0 release.

Added in version 1.0:

added Initial release version.