Sensor Graph OK, but Sensor Data field empty

Hi, I’m new to farmOS and have a quick question regarding sensors.

I setup farmOS on a Raspberry Pi3 and I also have Home Assistant running on a seperate Raspberry Pi4, I’ve deployed sensors around the farm using Arduino’s and Raspberry Pi Zeros using WiFi, LoRa and 4G. The sensors all communicate with Home Assistant and I’d like to send some of the sensor data to FarmOS. I setup one of the sensors to use the farmOS API in the Node-Red addon for Home Assistant and in farmOS it plots the graph perfectly but the Sensor Data Field is empty and says “No data found for this sensor”. Is this expected behaviour?


Hi @Farmer-Ed - welcome to the farmOS community! :slight_smile:

Hmm - what “Filters” are applied to the “Sensor Data” View below the graph? I wonder if maybe the date range ended up different from the graph or something?

I forget how some of that 1.x code works, to be honest. We’ve been making a lot of improvements to sensors in 2.x (although graphs are still TBD: Add graphs of data stream data [#3203015] |

1 Like

Hi @mstenta and thank you.
There is no filters applied as far as I can tell, also no date range options showing for sensor data.

Perhaps a more fundamental issue with my build? Its running on docker on 32 bit Pi OS using SQLite if that has any bearing.

How soon are we likely to see a stable release of farmOS 2.0?
I like what I’ve seen so far in 1.x, the sensor issue is not critical as Home Assistant is providing plenty of information and handles notifications and graphs as it is, but I suppose it would nice to have everything farm related visible from farmOS. I look forward to trying out 2.0

1 Like

Huh. That is very strange @Farmer-Ed - I’m not sure what’s wrong. I wouldn’t think your build/environment would affect this at all.

If you want to dig in and debug, you can enable the Views UI module, enable “Show the SQL query” in /admin/structure/views/settings, then go to /admin/structure/views and edit the “Farm Sensor Data” View (“Views” are basically SQL queries you can build via the Drupal UI). Scroll down to “Preview with contextual filters” and enter the asset ID of your sensor asset then click “Update preview”. The SQL query will be displayed. You can then try running that query directly against your database (outside of the context of farmOS/Drupal) and maybe that will shed some light on the issue.

That’s the quick “advanced debugging” tutorial for this - hope it helps! :slight_smile:

1 Like

@mstenta, I have to admit SQL is not exactly one of my strong points, but thank you very much for the tips.

This is the query generated.

SELECT farm_sensor_data.timestamp AS farm_sensor_data_timestamp, AS farm_sensor_data_name, farm_sensor_data.value_numerator AS farm_sensor_data_value_numerator, farm_sensor_data.value_denominator AS farm_sensor_data_value_denominator
{farm_asset} farm_asset
LEFT JOIN {farm_sensor_data} farm_sensor_data ON =
WHERE (( ( = '73' ) )AND(( (farm_asset.type IN  ('sensor')) AND (LENGTH( > '0') )))
ORDER BY farm_sensor_data_timestamp DESC

I tried running the query in DB Browser for SQLite and it didn’t like the curly brackets. (I also tried without the brackets and it ran without error but didn’t return anything, I realise that was grasping at straws to start with)

Execution finished with errors.
Result: unrecognized token: "{"
At line 1:
SELECT farm_sensor_data.timestamp AS farm_sensor_data_timestamp, AS farm_sensor_data_name, farm_sensor_data.value_numerator AS farm_sensor_data_value_numerator, farm_sensor_data.value_denominator AS farm_sensor_data_value_denominator

I also used the GUI to check the database and to me it looks OK, timestamps are from the expected times as I deleted the sensor and created 2 new ones yesterday afternoon.

1 Like

Are you having the same problem with other sensors? Or just this one?

It was all sensors, but I’ve not tried many yet.
Anyway I seem to have a solution now.

I changed one of the filter criteria from in /admin/structure/views Farm Sensor Data View

[Sensor data: Sensor reading name (longer than 0)]
[Sensor data: Sensor reading name (has word )]

Sensor value is not changing as the pump it is monitoring is switched off, So I’ll have to go and physically test that but looks good for now.

Thanks very much for your help on this.


Oh interesting! I wonder if this is an SQLite compatibility issue. Maybe SQLite3 doesn’t like this query condition:

Might be worth opening a bug report for this so we can fix it. I haven’t used sensor data in SQLite3 personally, so it may have just gone unnoticed until now. We should also check to see if 2.x is affected (cc @paul121).

1 Like

@Farmer-Ed, just seeing this now. Out of curiosity, are you planning on having all of your sensor data housed in FarmOS on 15 minute intervals?
I haven’t started yet, but I’m looking at different architectures for having FarmOS and Home Assistant coexist more formally, probably with an integration in HA.


No probably not in the long run.
Most of my sensors are battery/solar powered Arduinos and sleep for an hour or longer after passing sensor data to HA. So hourly or longer more likely depending on the sensor.

Are you talking about creating a version of farmOS as a HA addon?
I initially tried getting HA and farmOS to co exist on a single Raspberry Pi 4, not as an addon though simply another docker container with both running on Pi OS but performance was horrible for farmOS with regular timeouts. I think my issue was the configuration of NGINX to handle SSL for both so I gave up and now run farmOS on a separate Pi 3 with SSD, they now both run their own NGINX proxies but HA handles the SSL certs.


Actually, I should have clarified that yes, ultimately I would love a FarmOS add-on for HA built using their approach to add-ons and running on Home Assistant OS. As you mentioned, there’s a bit of a problem with NGINX proxies and an official HA add-on would alleviate that because (I believe) the FarmOS UI can be displayed as a window in HA. I haven’t tested any of that, and I’m sure there are technical hang-ups, but it would be a great goal.

There is also utility to having an integration that pulls data from FarmOS back into Home Assistant, which can be done using a remote FarmOS node like your setup or a FarmOS node as a HA add-in.

It’s nice to connect with someone who is trying some of the same things. I’ll be tackling a lot of the above early next year (I’m currently working on an OpenThread/Matter add-on for home assistant as a learning exercise). I’m very interested in the 1+1=3 nature of integrating HA and FarmOS for mutual benefit.


This piqued my interest. Can you elaborate how you have HA handling SSL certs for FarmOS? That’s a particular sticking point that I’d love more flexibility on for my setup which is similar hardware as yours. Thanks.

1 Like

@mikefarms I’d also be interested to see any development in integrations between HA and farmOS and I’m sure others would too. I’d imagine with beta release of farmOS 2.0 due soon it may be a better starting point.

Nginx and Duckdns Addons already handle SSL certs for HA and save them to a folder shared by the Samba Addon, so I mounted this Samba share on my farmOS Pi and added it as a volume using docker compose.

I’m currently documenting all of my farm IOT/IT projects on my website, my farmOS install is here:

I plan on adding My HA -Node-Red-farmOS setup shortly also. Not sure I’m great at documentation but have a look and see for yourself.

@mstenta I hope linking my site is OK, if not I can remove it promptly?


Yes definitely targeting farmOS 2.0. I’ve personally never even run farmOS 1.x!

I looked at this. I haven’t gone through your procedure, but I will and I’ll let you know if there are any undocumented sticking points. It looks like you do have a knack for documentation, FWIW.

That kind of procedure is perfect for the concept we talked about on the FarmOS dev call - namely community-provided walkthroughs on various specific topics. Basically, we tag what version of FarmOS it’s been tested for and then create a GitHub pull request for a Markdown version with pictures so it shows up on the FarmOS website. The walkthroughs wouldn’t be a part of the official documentation (and also wouldn’t have an expectation of being maintained as development continues), but could provide help for common tasks beyond the official documentation scope.


Here is the thread where @jgaehring and I were talking about implementation.


OK cool,
It is 1.x that I am currently running.

1 Like

@mikefarms, I have published my HA/Node-red/farmOS how-to, I’d be happy to add both of them to the community-provided walkthrough repo when @jgaehring has it ready.