Download PDF
      SAMOVAR                                  
×
Menu
  • Additional features

Additional features

 
 
 
Additional functions can be implemented with Lua and PCF8575/PCF8591 expanders over I2C. Lua is enabled by the separate Samovar_lua build environment in PlatformIO, by the "Use Lua" («Использовать Lua») checkbox on the "Hardware" («Оборудование») tab of the configurator, or by the #define USE_LUA directive in user_config_override.h; the expanders are enabled in the same place with the USE_EXPANDER and USE_ANALOG_EXPANDER directives (in the configurator, the "PCF8575 expander address" («Адрес расширителя PCF8575») and "PCF8591 expander address" («Адрес расширителя PCF8591») fields).
 
Programming of additional functions is implemented on the basis of the scripting language Lua. The script editor is available on the Settings – Editor page ("Settings" («Настройки») – "Editor" («Редактор»)).
 
You can attach any actuators or buttons (sensors that work as buttons) to the port expander, and decide for yourself what should happen at a given moment while Samovar is running.
The init.lua file runs when Lua is initialized. While Samovar is working, the common script.lua and the mode script selected in the settings run about once a second. You can change them in the file editor of the web interface.
 
You can store variables in the Samovar memory, run up to 10 timers, get the Samovar operation status, and so on. That is, you can connect additional equipment and control it automatically while Samovar is working
 
You can check that a safety sensor has not tripped, and if it has, switch Samovar off right from the script, or increase or stop the water supply. There can be many scenarios. They depend on the specific equipment.
 
The basic Samovar functionality does not change.
 
Scripts can use one analog input of the board — LUA_PIN (GPIO34 on ESP32 DevKit, GPIO4 on ESP32-S3), read by the analogRead() function. Samovar 7.00: in Cheesemaking mode this input is used by the pH sensor, and accessing it from a script ends with an error. The relay, pump and button outputs cannot be switched from a script — only through the port expander or the standard Samovar functions.