# Controlling remote devices from within FarmOS

**URL:** <https://farmos.discourse.group/t/controlling-remote-devices-from-within-farmos/29>\
**Category:** Development\
**Created:** [June 21, 2019, 6:44am UTC](https://farmos.discourse.group/t/controlling-remote-devices-from-within-farmos/29 "2019-06-21T06:44:45Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![paul121](https://avatars.discourse-cdn.com/v4/letter/p/54ee81/32.png) [@paul121](https://farmos.discourse.group/u/paul121)\
**Post date:** [November 27, 2019, 7:25am UTC](https://farmos.discourse.group/t/controlling-remote-devices-from-within-farmos/29/9 "2019-11-27T07:25:24Z")

</div>

@MBConsultingUK That sounds like some cool work you’re doing!! Would love to hear more about your ideas for the demo farm. I’ve been thinking about that & this (bi-directional IoT in farmOS) a lot more lately…

> FarmOS publishes state changes to a messaging bus (I’d suggest MQTT here as it seems to be the most used in the IoT space). At this point “something” (either a hub as in (1) or the devices themselves) would connect to the message bus and act based on the messages they receive

Just re-reading your first post, I definitely agree that Option 2 makes the most sense. I’m quite interested in MQTT as a means of passing this data around. If farmOS could push state changes out over MQTT (when a log is created, a harvest is completed) and listen to data from sensors coming over MQTT (temperature, gate open/closed, etc), that would allow for a very robust system!!!

In [Schedule a log based on a quantity value](https://farmos.discourse.group/t/schedule-a-log-based-on-a-quantity-value/115) @mstenta mentioned the Drupal Rules module. This is an interesting concept that would allow some of this functionality internally within farmOS (create a log once another log is finished, etc) BUT I think this could be done externally, too.

I came here to mention [node-red](https://nodered.org/)… this could be a neat IoT tool outside of farmOS. Have you heard of it @MBConsultingUK? It has some great ways of creating rules with “Nodes” - various inputs and outputs. The community can submit additional “Nodes”, and can also publish rules as “flows” and share them in a JSON format.

This is WAY cool - in 5 minutes I was able to download node-red and create a webpage that displays subway stations in San Francisco via [this flow someone shared](http://ryanjbaxter.com/2015/01/13/sample-node-red-flow-using-websockets/) In another 5 minutes I created a flow that re-routed the results of a farmOS API request… You could easily create a flow that listens to an MQTT topic and sends the data via HTTP POST to a sensor in farmOS

---

_[View the full topic](https://farmos.discourse.group/t/controlling-remote-devices-from-within-farmos/29)._
