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

Issues with Plugin Development and Loading for CraftBeerPi4 #144

Closed
brackendalebrewing opened this issue Jul 13, 2024 · 12 comments
Closed

Comments

@brackendalebrewing
Copy link

Description: I've been working on updating some of my plugins for CraftBeerPi4. I have developed a plugin that allows CBPI4 to be used by an Ubuntu-based PC, with GPIO provided by an Arduino using Telemetrix-AIO. This plugin has not been tested on a Raspberry Pi. During the development, I encountered two significant issues that make plugin development difficult.

Observations:
1. Plugin Template Setup File Issues:
◦ The plugin template setup file is missing both insertion points and keywords.
◦ Without insertion points, the plugin loading fails with little or no log evidence.
◦ Using the verbose -v option during installation provided some insight, and once corrected, plugins load properly.
2. Plugin Loading Dependency on Installation Source:
◦ After reconfiguring the plugin with the changes in the setup file, the plugin will load and run properly only if the CBPI4 instance is installed from a remote repository (either GitHub or PyPI).
◦ The plugin fails to load into a CBPI4 instance created from a local repository, although plugins can still be installed successfully from remote plugin repositories.

Steps to Reproduce:
1. Develop a plugin for CBPI4 using the provided template setup file.
2. Attempt to load the plugin without insertion points and keywords.
3. Install CBPI4 from a local repository and attempt to load the plugin.
4. Install CBPI4 from a remote repository and attempt to load the plugin.
Expected Behaviour:
• The plugin should load without issues, regardless of the source from which CBPI4 is installed.
• The plugin template setup file should include insertion points and keywords to prevent loading failures.
Actual Behaviour:
• Plugins fail to load without insertion points and keywords in the setup file.
• Plugins only load properly when CBPI4 is installed from a remote repository.
Environment:
• CraftBeerPi4 version: 4.1.rc1
• OS: Ubuntu 24.04,22.04

Additional Context: These issues significantly hinder plugin development, especially for those using local repositories for development and testing.
This really is very much out of my scope and ability. I am a older heavy equipment operator who likes making beer and tinkering with code.
I hope this is helpful

@avollkopf
Copy link
Member

Not sure if I understand you correctly.

First of all, you should use the latest version of cbpi which is not 4.1......
Are you using the plugin template from github directly to create a plugin?

@brackendalebrewing
Copy link
Author

brackendalebrewing commented Jul 13, 2024 via email

@avollkopf
Copy link
Member

avollkopf commented Jul 15, 2024

Starting with Register:

Example from the SCD30 plugin:

def setup(cbpi):
    cbpi.plugin.register("SCD30 Sensor", SCD30Sensor)
    cbpi.plugin.register("SDC30 Config", SCD30_Config)
    pass

The plugin itself is calling the register function -> Hence, the order of calling your classes must be defined there anyhow. But plenty of the extension plugins are working partly asynchronous and therefore, you cannot really rely on the fact that one function is called before the other one to have something accomplished before the other plugins starts. Could be done somehow similar to the SCD30 plugin where it has to wait until the sensor activation is done.

Power values larger than 100:

This is not an option for implementation as power vales are defined in % and a scale of 100% is more than sufficient for a water heating process.

Rough Example: 100 Liters of water with a 10 kw heater -> start at 70°C and stop at 70.2°C

-> requires 1.4kw to heat it up within one minute (in an ideal world with 100% efficiency) -> 14% of your max power

Increased precision is there, not really required.

In addition to that, plenty of other plugins depend on the % definition.

@brackendalebrewing
Copy link
Author

brackendalebrewing commented Jul 22, 2024 via email

@avollkopf
Copy link
Member

The Power definition within cbpi and the UI is defined as '%' and can't have a value of 1000+ by definition of '%'... Not sure about the windows applications you are referring to, but I am talking for instance about the esp based (arduino libraries) mqtt device which can be used for brewing but also for fermentation. It is connected via mqtt and also here, power @ 100% tells the esp to go to the max setting of whatever device is hooked up. power @ 0% tells the esp to set the hooked up adc, ... to go to 0. Everything in between is just a question of the resolution and as mentioned above is not relevant to heat up water with 0.0001 watt precision for a few seconds.

How the power % is translated into an adc value or whatever has to be done in a corresponding actor or logic plugin.

@brackendalebrewing
Copy link
Author

brackendalebrewing commented Jul 24, 2024 via email

@avollkopf
Copy link
Member

1024/1024 is as much 100% as 100/100

But that's what I am saying. The calculation can be done in the actor plugin / mqtt device / arduino,.... as the "% resolution" is more than sufficient for the application.

@brackendalebrewing
Copy link
Author

brackendalebrewing commented Jul 24, 2024 via email

@brackendalebrewing
Copy link
Author

brackendalebrewing commented Jul 24, 2024 via email

@avollkopf
Copy link
Member

I think, I get more insight into your request.

I need to think about it in more detail, but I still don't think, that the power parameter should be changed. It could be probably handled with an additional parameter such as resolution.....

Your actor plugin could use the resolution paramter and is regulated via the resolution -> Power is calculated from resolution and remains between 0 and 100.

The open question is still on how you control the PWM / resolution for your desired actor? Within your actor plugin?

@brackendalebrewing
Copy link
Author

brackendalebrewing commented Jul 24, 2024 via email

@avollkopf
Copy link
Member

Well, first of all, this issue is going to mix up plenty of different topics. Hence, i am going to close it.

On the resolution of the 'power' a new topic must be openend. I already thought about changing it to float. I've had a discussion on that in the past with someone and he mentioned it should remain at int...

Anyhow, the definition of the power parameter is not going to be changed as it may break plenty of other things/dependencies (not only in the cbpi server itself). As already mentioned, I will think about a solution that should work also for the existing environment. I have extremely bad experience by just changing a few lines and an existing definition of a parameter.

On the GPIO topic I assume you are talking about the regular GPIO actors in cbpi. They work as expected and never have to be re-saved. I start the Pi, download a recipe and start brewing. No need to fiddle with hardware or the settings prior each process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants