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

Inputs and outputs to handle non-numerical values #1400

Open
CKraw opened this issue Nov 10, 2024 · 5 comments
Open

Inputs and outputs to handle non-numerical values #1400

CKraw opened this issue Nov 10, 2024 · 5 comments

Comments

@CKraw
Copy link

CKraw commented Nov 10, 2024

In my first weeks of actively working with Mycodo (v8.16.0), I focus on using inputs and outputs that specifically allow the execution of bash commands. Those commands include addressing a Python file which eventually performs I2C transmissions. The response data (being chopped by regex) is what I intend to display in a widget on my dashboard, for instance.

Unfortunately, I run into problems when I have my commands return or receive data that is alphanumerical, e.g. a simple text value for a device name. With this in mind, both tasks of displaying some text in an input widget or using an output widget for updating that text value cannot be accomplished so easily. As far as I can tell, this is due to Mycodo (and its underlying time series DB) only accepting numerical data that fits any compatible measurement and unit.
Frankly, for this kind of tasks dealing with plain data that originates from outside of the Mycodo system, I'm not even interested in contacting the Influx DB and thus, I could also do without picking any measurement which forces my values to meet certain conditions...

@kizniche Is there any way to safely configure my inputs/outputs to cope with non-numerical data without being at risk of breaking Mycodo's underlying mechanics?

@CKraw
Copy link
Author

CKraw commented Nov 16, 2024

@bchwtz Just pinging my project manager...

@kizniche
Copy link
Owner

There are two databases that Mycodo uses, influxdb for time-series data and an SQL db for all other data (settings, etc.). I would suggest using the SQL db if you need to store text.

@kizniche
Copy link
Owner

To save/retrieve data from the SQL db you can use self.set_custom_option() and self.get_custom_option().

@CKraw
Copy link
Author

CKraw commented Nov 16, 2024

Thanks for the quick reply, Kyle. As a follow-up, I found this post on your other forum: Reading and writing data to database tables.

So would you suggest the approach mentioned therein to me as well? @kizniche

@kizniche
Copy link
Owner

Widgets can communicate directly with Functions. There is an example widget and function showing how data of a Function is received and displayed by a widget.

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