View Home-assistant in FarmOS

@Farmer-Ed @mstenta
Hi there…
Is it possible to embed Home-assistant content in a hosted FarmOS?

2 Likes

Anything is possible :wink:

I do the exact opposite and have farmOS embedded in Home Assistant.

However maybe you should look at the work by @SirSundays

This is for Grafana, but should be easily modified for Home Assistant, I’m not 100% sure how Home Assistant will behave in an i-frame, there may be some need to change X-frame options for HA, this was the case with running farmOS and Grafana in an iframe.

No matter what URL you paste in, may it be Grafana or something else, that website will be displayed. In the background everything is done via iFrames.

So feel free to use it for something else. Maybe you want to link a calendar or a Node-Red instance or something completly different. Be creative!

Edit:
Looks like HA works in an i-frame since June 21 Run Home Assistant in an iframe - #2 by Nick4 - Configuration - Home Assistant Community

2nd Edit :thinking: just realized you said hosted, I presume Farmier, that may complicate it a bit / need help from @mstenta.

1 Like

Thanks for the input @Farmer-Ed. You’re helpful as always.
Yep, I’m on hosted FarmOS.
I can’t see any possibility out of the box. I guess it would require a module…

For a first step, I would like some sensor graphics in FarmOS. I see Graphana could work fine for this.
Or maybe FarmOS inside HomeAssistant could work just as well
:thinking:
IFrame module for FarmOS would be cool tho…

1 Like

AKAIK it won’t be out of the box yet…
But graphs were part of 1.x and I think @paul121 might be working on this for 2.0, I think he may have been waiting on a Charts module dependency that is in the process of being updated for Drupal 9.

farmOS inside Home Assistant is simple but requires x-frame options to be changed to permit farmOS being viewed inside an iframe. This you would need to discuss with @mstenta as you won’t have the permissions and there may be a minor security concern for you with regards website spoofing if your instance can be displayed inside an iframe on any website.

Grafana could well work fine for your needs.
And as far as I’m aware, the Grafana module above is essentially an i-frame module so it could work for other webapps like Home Assistant or Node-Red Dashboards although it may be a bit off being an approved module for Farmier.

Maybe a general IOT Dashboard module could be an idea?

I’ve added a feature-request tag to the thread as I think some implementation of this could be great.

Have you a local instance of farmOS too? Can be useful for experimenting with.

2 Likes

Yep. I briefly tested this in FarmOS 1 before I opted for 2.0. Would be nice to get that in 2.0 too.

I would like that a lot. It should be possible to automatically create observations logs when sensors report home that something has happened or a level is reached
And maybe activity log with a due date.

I did setup a local FarmOS. Messed it up and did not find time to tinker with it again, but I see it could be fine for testing indeed.

Just scratching the surface yet. I have other software for crops and pig management, so ATM my need for FarmOS is sensor-stuff and Node-Red and manual logging og different events.
Not even sure I need Home Assistant. I think it’s a “must try” :slight_smile:

Since you are already using Node Red, it is probably the easiest way to achieve all of that at the moment.

Does your other software packages have API’s, as well as the sensor stuff I’ve been using Node-Red to sync other databases and calendars with farmOS.

Truthfully you don’t. I’m a big fan of Home Assistant and it is the basis of all of my home and farm automation, but if you just want to connect simple sensors to farmOS then Node-Red by itself is more than enough. Home Assistant does create a nicer user interface though especially for the home where other users want a dashboard with simple intuitive controls for heating and lighting and also great for integrating CCTV. Node-Red can also generate Graphs they are a little more of a pain to setup compared to a sensor managed by Home Assistant but if it is just graphs you want rather than controls then maybe Grafana is a better choice anyway, but I’ve no experience of it myself.

Hmmm…
@pat you have me thinking now.
I had considered trying to make a Farm Assistant variant of Home Assistant in the past, but was put off for 2 or possibly 3 reasons:

  1. It would probably be a lot of work for little benefit, mostly re-skinning with an agri theme.
  2. Home Assistants Development has too many frequent breaking changes making keeping a forked version in line a little more difficult. Also potentially less appealing to perspective users as an IOT solution in a live business use case.
  3. Lack of necessary skills (But I’ve been working on that one)

I also found someone else actually beat me to it and took this path, but that project seems to have stalled, Farm Assistant needs help - Third party integrations - Home Assistant Community, AgSense Consulting.

But maybe a Node Red module with both flow programming and the dashboard accessible within farmOS would be the simplest way to go and cut out Home Assistant altogether.

In my current setup I now have 2 instances of Node-Red running.

  1. Node-Red addon in Home Assistant, which is used for everything HA and sensor related including forwarding sensor data to farmOS if necessary.
  2. On a separate Raspberry Pi I run farmOS, so I also installed Node-Red here and use it for automation within farmOS, connecting farmOS with other API’s, CSV uploading and a notification/calendar synchronization server. I separated it out as there were too many farmOS flows running on my HA instance and its easier to guarantee it is running while farmOS is.

I’m also working on a module to send log update events from farmOS to Node-Red or other services. External notifications, webhooks, MQTT etc - #17 by Farmer-Ed

Edit 1:

A poor MS Paint mockup

Edit 2:

Perhaps with some further development of Node-Red nodes for farmOS this could also make a flow based alternative to creating quick forms and CSV importers more accessible?

A quick play with @SirSundays code this morning, (Nothing changed except labels).

Yep. One less thing to manage.

I don’t think so. Pig management is purly local on phone and computer. (But does this exemplary well). So I see no need to put animals into FarmOS. But there are some management event logging in FarmOS. Waiting for the FieldKit there… Nothing to automate tho.

Using CropPLAN for crops. (Webbased) I also have a LogMaster installed in my tractors. It logs tractor hours at different fields/zones, and puts useage/cost in CropPLAN reports. For those who owns a fancy flashing tractor, it also logs fuel consumption and visualizes this in field maps.
Gives me great detailed reports with little effort. I just have to enter what kind of work that’s done.
This is actually a cool idea for an open source solution too. Could very vell be a FarmOS module.
But that’s another story…

I will try out HomeAssistant at some time, but maybe I’ll wait.
I’ll consentrate on NodeRed.

Wow…
I guess one would still need node-red up and running somewhere, and point that to the FarmOS instance? Hosted or not?
Love the idea tho.

1 Like

:heart_eyes:
@mstenta Could this be done in a hosted setup?

1 Like

Yes, probably simplest if it is hosted. We will convince @mstenta offer it on Farmier yet :wink:
But Node-red is small and I believe you can host it on Oracles free cloud offering.

1 Like

Just to answer the original question, in case anyone is interested, Home Assistant works within the iFrame too.

Will be useful for the Google calendar module I’ve been working on too.

1 Like

@pat @Farmer-Ed I love the idea of offering Node Red hosting! But realistically I’m not in the position to figure that out in the near future. In the meantime, it sounds like there are existing options for Node Red hosting? Maybe it would be worth compiling a list of options in a dedicated thread?

I’d also be curious to learn more about the hosting considerations myself. Especially curious to understand what it looks like to host Node-Red for multiple users. User isolation, multiple instances, security, maintenance costs, etc etc are all things I would need to understand in order to offer it through Farmier.

1 Like

Thanks for the reply @mstenta, wasn’t really expecting the hosting of Node-Red on Farmier any time soon. I suppose the real question from @pat is what would it take to get an iframes module approved for Farmier?

1 Like

Ah sorry only somewhat following this. :slight_smile:

what would it take to get an iframes module approved for Farmier?

If you put something together I’d be happy to take a look!

1 Like

It’s Ok I know you are busy, so there is no panic,
The Module in question is a Grafana module and is entirely the work of @SirSundays so maybe he’ll join the conversation at some stage, I was experimenting with it this morning and only changed the labels to suit Node-Red.

Think I will be borrowing some of it though for my Google calendar module.

I was kinda following the discussion here :smiley:

I think it would be easy to modify the module so you can have a custom iframe accessible from the sidebar. The only thing that would need to change is to make the title customizable. Otherwise, I think it is basically ready to use.

2 Likes

Yes, works great with Node-Red and a few other web apps that I tried, and the title is the only thing I have changed, probably not difficult to make customizable, would be nice to figure out the icon too.

well done by the way.

I can already give you an insight into Node-Red because I maybe will start hosting it together with Grafana for some clients (not for the university).

First: There is no real multi-user functionality. Every user can see every flow inside Node-Red. You can hide them but that´s it. Otherwise, every user needs to have their own instance. But is really project-dependent if this is breaking or not. So there is no user isolation in short.

It’s kinda easy to host multiple node-red`s together in one server. I made a script to do that for me and configure everything. We use it already for two years or so. I maybe will go on from that in the future and build a system around it. Here is the link to the documentation:
https://wiki.eolab.de/doku.php?id=user:jan001:nigdocu

Unfortunately, it is in german. But maybe Google Translate can help :sweat_smile:

In the end, we had one subdomain and the instances were all linked with their path with help of NGINX.

I´m still not sure what the maintenance cost will be because I´m still not decided on VPS and making my own cloud or going directly over to something like AWS.

1 Like

It´s nice to see how it helps other people :smiley:

1 Like