IRC logs for #farmOS, 2020-01-04 (GMT)

2020-01-03
2020-01-05
TimeNickMessage
[20:56:16]* farmBOT has joined #farmos
[06:10:19]* JustTB has quit (Ping timeout: 265 seconds)
[06:24:49]* JustTB has joined #farmos
[07:15:05]* JustTB has quit (Quit: Leaving.)
[08:22:26]* spitz234[m] has joined #farmos
[10:37:37]* cpm has joined #farmos
[10:55:11]* JustTB has joined #farmos
[14:28:22]* cpm has quit (Quit: Leaving)
[15:34:27]<paul121[m]>the default sensor graph only displays 24 hours?
[15:34:31]<paul121[m]>Is that correct?
[15:35:10]<mstenta[m]>Actually I think it's only the last 100 points
[15:35:34]<mstenta[m]>That was kind of an arbitrary decision
[15:35:54]<mstenta[m]>With the assumption we'd take a next step at some point
[15:54:47]<paul121[m]>Ah okay
[15:55:30]<paul121[m]>Over Christmas I wrote some scripts to send my dad's solar panel data via notifications to his phone
[15:55:37]<paul121[m]>And just am hooking it into farmOS, too ;-)
[15:56:30]<paul121[m]> * And am just now hooking it into farmOS, too ;-)
[15:56:43]<paul121[m]>Ironically we get about 100 data points per day haha (based on current length of day)
[15:57:16]<paul121[m]>Question: Can you edit sensor data? Mostly would be nice to delete all data for the sensor in the "debugging" phase of setting up the sensor
[15:57:36]<paul121[m]>(right now I've archived a few sensor assets to reset the data)
[16:04:48]<paul121[m]>ACTION uploaded an image: Screen Shot 2020-01-04 at 1.04.14 PM.png (185KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/XhOVWMaheJXZtbyx... >
[16:16:20]<mstenta[m]>Cool!!
[16:17:08]<mstenta[m]><paul121[m] "Question: Can you edit sensor da"> Not via the farmOS UI currently
[16:17:32]<mstenta[m]>Workaround would be to delete the sensor asset and create a new one, and copy and paste the public and private keys over to the new one
[16:18:14]<mstenta[m]>If you have direct access to the database you can also do it with an SQL query
[16:19:20]<mstenta[m]>That would be a useful addition though: maybe a delete data button that appears in the edit tab (with a warning and confirm page)
[16:23:41]<paul121[m]>Yeah I think that would be useful
[16:23:58]<paul121[m]>Even with the option to delete data in a given date range
[16:25:14]<paul121[m]>And specify the `value` string so you could delete only some data from the sensor
[16:45:39]<mstenta[m]>Yea! It might not be too hard to do that with a custom Views Bulk Operation
[16:47:02]<mstenta[m]>That would allow you to use the existing filter/sort options, select all, and then have a delete button below the list of data on the main sensor asset page
[16:47:22]<mstenta[m]>VBOs are what all the buttons on asset/log lists are
[16:47:32]<mstenta[m]>They're pretty simple to write
[16:47:50]<paul121[m]>Ohh and the Quantity Report?
[16:48:14]<mstenta[m]>Huh?
[16:48:44]<paul121[m]>The same "sorting" features in the Quantity Report - are those provided by a VBO?
[16:48:56]<mstenta[m]>Oh you mean the filter/sort on the quantity report? Yea that's standard Views module feature
[16:49:50]<mstenta[m]>Views module is basically just a SQL query builder, that lets you build lists of things, and also expose UI forms for sorting/filtering them
[16:49:58]<mstenta[m]>That's what all the lists in farmOS are built with
[16:50:09]<mstenta[m]>Including the sensor data list you see under the graphs
[16:50:34]<mstenta[m]><paul121[m] "The same "sorting" features in t"> No those aren't VBO, they are just Views features
[16:50:54]<mstenta[m]>VBOs are the buttons at the bottom of lists when you select rows
[16:51:00]<paul121[m]>ohhh! So the "Bulk Operation" piece is the selecting multiple rows, and doing an action on the rows
[16:51:05]<paul121[m]>Yup, makes sense.
[16:51:07]<mstenta[m]>Yes exactly
[16:51:26]<paul121[m]>So the "Custom" part of a VBO is basically just writing the SQL query?
[16:51:42]<mstenta[m]>Not even... It's just writing the action
[16:51:50]<mstenta[m]>Let me find an example...
[16:53:07]<mstenta[m]>https://github.com/farmOS/farmOS/blob/7.x-1.x/modules/farm/farm_log/farm...
[16:53:45]<mstenta[m]>That hook defines the "Assign" action for assigning logs in bulk to a user
[16:54:15]<mstenta[m]>The only thing that might be a hurdle for the asset sensor data View is...
[16:54:24]<mstenta[m]>The rows are not Drupal entities
[16:54:34]<mstenta[m]>They are just simple database table rows
[16:54:48]<mstenta[m]>I think VBOs might only work with entities... :-/
[16:54:56]<mstenta[m]>I forget though. Maybe it's possible
[16:56:20]<mstenta[m]>Here's another hook that defines three actions for asset entities (archive, unarchive, and clone):
[16:56:23]<mstenta[m]>https://github.com/farmOS/farmOS/blob/7.x-1.x/modules/farm/farm_asset/fa...
[16:58:34]<mstenta[m]>Here's the documentation for definitely custom VBOs
[16:58:36]<mstenta[m]>https://www.drupal.org/node/2052067
[16:58:44]<mstenta[m]>Defining*
[16:59:30]<paul121[m]>So as soon as you implement `hook_action_info` Drupal knows to display the bulk operations in the View?
[17:00:03]<mstenta[m]>No there's another step necessary: you have to edit the View configuration
[17:00:16]<mstenta[m]>To add the operation as an option
[17:00:33]<mstenta[m]>So you can build views with different sets of operations depending on what you need
[17:05:10]<mstenta[m]>Hmm I don't think it will be possible to use VBO on sensor data... :-(
[17:05:14]<mstenta[m]>https://www.drupal.org/node/1282486
[17:05:46]<mstenta[m]>> VBO only supports entity (base or revision) tables.
[17:07:08]<mstenta[m]>Drat
[17:07:44]<paul121[m]>haha shoot
[17:08:07]<mstenta[m]>So maybe just a custom form
[17:08:26]<mstenta[m]>Maybe in a new tab separate from the view and edit tabs
[17:10:22]<paul121[m]>That makes sense
[17:10:45]<paul121[m]>And the `form_submit` would run a SQL query
[17:10:55]<mstenta[m]>Yup!
[17:11:12]<mstenta[m]>And you could have the date range and other filters you described
[17:12:03]<paul121[m]>Neat. I'll try and give that a shot
[17:13:27]<paul121[m]>Gtg but hopefully within the next week lol
[17:13:35]<mstenta[m]>That's probably a better approach for this anyway
[17:13:40]<mstenta[m]>Cool! Later!
[17:30:56]<mstenta[m]>@paul121:matrix.org: fyi here is the line that deletes data when a sensor asset is deleted
[17:30:59]<mstenta[m]>https://github.com/farmOS/farmOS/blob/1e398698e6907d220dbcb87f8e07c20a79...
[17:36:55]* JustTB has left #farmos ()
[17:41:37]* JustTB has joined #farmos