[Feature Idea] Homeassistant Integration for OFM

Unfortunately I am currently not up to that task, but I still want to discuss a certain feature-Idea.

It would be super-nice to to have a Homeassistant-Integration for the OFM. Certain API-Features need to be there anyways, to e.G. use openflexure-connect. I’d think of an integration similar to the prusa-link-integration (featurewise). openflexure-connect can already read exposed informations like

  • is available/online
  • live preview cam image

even pre-connect.

when connected/authenticated, there’d be more to monitor. what I’d think of is for example

sensors:

  • current state [idle/scanning/stitching/errorCondition]
  • percent done
  • name of current scan
  • preview of current scan (image entity)
  • motor positions/current coordinates
  • CameraStream (HA already has a native method to integrate things like camera-streams efficiently)
  • isOnline [bool]
  • uptime
  • state/ip/mac for wifi and eth
  • firmware version
  • motor-board type (and it’s fw-revision)
  • error states
  • illumination state
  • self-defined sensors for modifications

triggers/switches:

  • start scan [args]
  • goTo [x,y,z]
  • focus
  • take snapshot
  • toggle illumination
  • set background-values
  • self-defined switches/toggles for modifications

additional sensors and actors (maybe hidden by default)

  • calibration data (sensor)
  • calibrate (switch)
  • motor-board total step count [x,y,z] (maybe useful for deciding, if new motors and assoc. printed parts may be need to replaced somewhen as maintenance measure)
  • system load
  • mem usage
  • available space on sdcard
  • temperatures
  • updates available [count] (system)
  • trigger fw-update (e.G. for sangaboard or RPI Bootloader)

…and most likely countless others i didn’t even think of…

I think such an integration would be supercool, and most likely many (if not all) things are already there in one form or another. Even without any modifications, with API-access and ssh together basically all of the above would already be possible, even tough only one of which should be used (and OFM should maybe consider certificate handling to not blow passwords in plain over the network. even optional selfsigned certs with 10y validity are much better than none at all…).

Beside me finding it desirable to stare at wiggly graphs, i think it would also greatly benefit anyone hosting more than one or two OFMs to quickly get an overview for classrooms and such. Having a Homeassistant-Integration would also serve as some kind of default-example-implementation on how to implement an API-client to get all the valuable metrics in realtime, and therefore would enable easy transitions to other smart-home-platforms like FHEM or monitoring-Platforms like Grafana in the long run.

What do you all think?

-zeus

1 Like

I have never used home assistant so I don’t really know hard it would be to integrate, or have anything setup to try it. There was also a suggestion, and a MR for adding Promethius logging to the server, which could also provide a metrics interface, but not integrated into a combined UI like I assume we would get with home assistant.

The next v3 pre-release with come with a management server that will always be available for a number of things that are on this list. Mostly for checking microscope state and restarting it. Over time we plan to add a way to edit the configuration and do updates through this server

1 Like

If you have never used Homeassistant, I’d just highly recommend it, it is super-fun to use and follows a “local first” directive. It is super-flexible and in my opinion far surperior above any other smart-home-like software (especially above proprietary ones). you can basically attach anything to it, that has some form of useable API, and everything available in homeassistant can be stiched together in a multitude of ways. It has come a long way regarding usability for non-tech-people, but without beeing to locked down to do anything useful yourself.

Prometheus is also an interesting option, because it is basically the default stack for monitoring stuff that can be described as some form of “service”, “host” or “network”, especially when it later should be displayed in a grafana dashboard.

however, a prometheus/graphite/grafana-stack or some other kind of time-series-database is most useful for short-term (minutes to days or weeks at best) in-app-metrics, like “what is the response-time between frontend and backend over time”, “db-queries/sec” or “http-request-responses by http-errorcode in percent as a piechart aggregated over hourly intervals” or something like that. for useful user-facing metrics (and especially user-facing controls) a homeassistant-integration would be a much better choice.

I am more a sysadmin then a programmer, so I am currently not up to the task to write an integration, but from what i’ve heard, this is not very complicated, because homeassistant has a very pluggable addon-system, and you can’t get more native to it that with python and (lots of) yaml, which is a much better stance than beeing in need of java or c/c#/c++…

while you can easily run a HA-Instance on a raspberry pi, it basically runs on anything in that performance-ballpark or above, fan-favorites are current mini-pcs (e.g. intel n150-based) or discarded office-mini-pcs from dell, lenovo or hp. they sometimes cost next to nothing (if memory and storage prices currently weren’t crazy…). I run it virtualized on proxmox, which works absolutely fine.

Everything I have heard about it sounds like it is a great project for those who want a smart home without all of the lock in and spying of the commercial systems. However, my house remains pretty much entirely non-smart, I get enough technology when working!

I do hear that often, because there is too much emphasis on the phrase “smart”. you are - beside other things - a software-developer, aren’t you? what are you doing while programming? in the broardest term you offload some logic from your head to a program, to ultimately use the program to automate things you don’t want to do manually over and over again. Effectively this is already smart-home, but mostly without the link to physical entities in your home.

That is exactly how I feel and use “smart”-home, and many many others tethering to homeassistant are doing the exact same also.

Forget about the BS-smarthome-marketing s#!+show that are constantly bombarding you in every corner. think about it like a programmer: what you “do” in a smarthome-system (beside integrating things to it) is writing glue code (the “automations”).

For example, my most useful automation is also my simplest one:

if light in bedroom is turned on:

wait 10 minutes

if light is still on:

toggle light.

when i go to bed, i don’t need to get up a second time to just turn off the light. when putting clothes into the closet, i don’t think about the light, because it will turn off in a moment anyways. All you need for this is a way to flick the switch without physically pressing it, and there are numerous wired and wireless options for that (easiest would probably be something like a “shelly 1pm” stuck behind the light-switch, which uses wifi).

you really cannot call this a “smart” system, that’s why I said, don’t over-emphasize the term “smart-home”. however, having some form of controlling this and that, and maybe combining it with some informations from e.g. public information apis (current weather in my region, when goes the next bus, what is the current gas-price in my area) can make up for some very powerful quality-of-life-improvements, but everything locally without beeing forced to customer-clouds (if the devices themselves allow this of course)…

Many things you can already do without integrating any devices at all. integrate a weather-api, the local trash-collecting-company’s calendar-schedule and the ha-app on your phone (your phone can act as a plethora of sensors also). you can already build things like “remind me via push-notification on the evening before waste gets collected to bring the trash outside, but when it will rain today or tomorrow, change the message to tell me to park the trashbin under the carport instead”. something like that ..) . you sure can “smart out your whole life”, but the simple automations are the most efficient ones.

I really can’t recommend enough to try it out :slight_smile:

1 Like