Deduce the status of a non-home automation appliance with Home Assistant (through vibrations)

6 minutes of reading
PURPOSES OF PROJET:
  • Use an approdeductive process to determine the operating status of a non-home automation appliance
  • Difficulty level: bass
  • Cost: null (net of the detection sensor)
CONCEPTS FACED:
SOFTWARE COMPONENTS USED:
PHYSICAL DEVICES USED:
  • The device in which it is running Home Assistant, in addition, of course, to the household appliance to be registered
  • A vibration sensor (eg. LUMI Aqara)
PROJET MOST INDICATED FOR:

All environments

Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
revision projet: 1.1

Abstract

Traditional appliances - those that do not have a domotic soul - are not excluded a priori from the possibility of "being domotized": the techniques for domotize the non-domotic they are indeed the most disparate. Just think of the air conditioners: in a few simple steps it is possible to make them piousnamedomotic systems although they are not designed to be used in this way.

What is often more difficult to obtain is operating status of a non domotic appliance: returning to the example of air conditioners, it is rather easy to manage them, it is difficult to understand if that command has gone successful or not.

Vacuum cleaner robot on parquet
a robot vacuum cleaner.

For operating status of the appliance, it goes without saying, it means "what he is doing at a given time". At the very least, get to determine if it is operational or not.

Know the operating status of an appliance is useful (if not necessary) to equip the prohis personal domotics of further "senses" for the purposes of notification, automation (for example, if the power supply to the appliance is removed / not removed in the event of the tenants leaving the environment), monitoring.

Home Assistant, through profirst model a entity, allows us to define virtual sensors which take on an (arbitrary) status rather than another starting fromabsorption analysis of the appliance itself. In fact, every appliance absorbs electricity: the way it does it can help us understand what the appliance is doing at a given moment. This was the approccio of another guide of which we certainly recommend careful reading.

Otherwise…

Another way - that pursued by this guide - is to use anything other than approdeductive, that is the one aimed at understanding what an appliance is doing based on ... to the vibrations it emits. It sounds like a joke, but it's not at all.

Some appliances - very specific - have the characteristic of not being easily "legible" in terms of electrical absorption, therefore use readings of this type often becomes useless, almost. Otherwise, other behaviors are more easily understood, and therefore can be modeled inside the domotics such as, for theapptogether, the vibrations.

A case in point concerns the robot vacuum cleaners. In projet illustrating how to domotize a non-domotic robot vacuum cleaner with Home Assistant, we have shown how easy it is to make home-automation functions as much as it is difficult to infer the return to the base, and then the shutdown, the state of rest.

Bene: with this guide we will obtain the result of defining a virtual binary sensor that indicates whether a given appliance is (at least) on or off based on its vibrations, which in the example of the robot vacuum cleaner (and not only) would be extremely convenient to implement.

What we need

Aqara vibration sensor
Sensorand vibration LUMI Aqara.

Simple: first we need a sensor that, once placed on the appliance, detect the amount of vibration prolearned from the appliance on which it is placed; secondly it is necessary that this sensor is integrated with Home Assistant, who appreceives the measurements and, through them, conditions the status of a binary sensor defined in the configuration.

Sensorthere are many; we suggest the adoption of the sensor of vibration LUMI AQARA, which stands out for its economy, reliability and integrability. Such a sensor (like many sensors ZigBee of his race) can be integrated into Home Assistant in various ways (via the BRIDGE/Gateway Xiaomi, through ConBee / deCONZ o CC2531 /zigbee2mqtt etc).

For the present guide, we will take the presence of ours for granted Home Assistant of the sensor sensor.bed_activity, which is usually the extent and appare via integration of this sensor via Gateway Xiaomi; if other additions are used, it will be sufficient to identify the entity that contains, in profirst state, the magnitude of vibration and use it as we will in this guide.

Nb Magnitude means an integer value (the 0 indicates the state of rest) that rappsents the vibration level (almost) instantaneous of the sensor.

Analysis

OPERATING STATE ON / OFF

The theory tells us that an appliance off is, of course, in a state of quiet. This is usually true, but we have appurato that often, regardless, the vibration sensors are so sensitive that they never reach the 0 value, even when perfectly still.

First thing to do, therefore, is to place the sensor on the appliance "in standby" and check what is the vibration reading, so as to have a minimum value to be taken as a reference value for the state "off". Any value greater than the minimum value will therefore be attributed to the state "on - operational"

This approccio it is the most basic and is usually used to make virtual binary sensors, which they own appunto a simple on / off status.
Later we will see how to do it.

DETAILED OPERATING STATE

Obtaining detailed operating status data it is the more complex the behavioral variability is of the appliance itself e from the degree of detail you want to get.

The first thing to do is to observe the behavior of the appliance during a complete use cycle, which is the appliance, which one it is use and its duration. In this we are helped by the historian of Home Assistant: during and after the execution of the cycle it will be possible to understand whether the various phases of operation of the appliance provide or not a "model" evidence in the graph relating to the vibrations detected.

Home Assistant - Aqara vibration sensor - bed activity
an example of detection from the sensor LUMI.

If the sensor is placed on a household appliance that you present different vibration patterns based on various functions (think of the washing machine), it would be possible, on a theoretical level, define more advanced virtual sensors than the simple one on/off, exactly following the same approof the projet based on the definition of sensors starting from the electric absorption.

However, we can say that this approccio would not be, in most cases, concretely feasible, given the difficulty in shaping a real e profirst "behavioral model" of an appliance through vibrations alone. Of course we can probut don't expect great successes.

How to create the sensor

Assumptions

In this projet we assume to have available - as explained above - an entity sensor that provides the measured vibration magnitude on the called appliance sensor.bed_activity.

Sensorand on / off

Since the operational status is rappresent of base by two possible conditions (on / off - 1 / 0) we will use a "Binary template Sensor"To define an entity that appanointed rappautomatically resets the status of the appliance starting from the instantaneous magnitude data supplied by sensor.bed_activity. We will assume (but it is indeed a theoretical assumption) that the sensor is at rest measure 0.

In configuration we will add:

binary_sensor:
      stato_operativo_elettrodomestico:
        delay_on:
          seconds: 5
        delay_off:
          seconds: 5
        value_template: "{{ states('sensor.bed_activity')|int > 0 }}"

The meaning is simple: when the sensor sensor.bed_activity will measure a vibration (magnitude value detected > 0) for more than five seconds, the virtual binary sensor will assume the status on ("on"); vice versa, it will come back up off ("off") When the value drops to 0.

We will therefore have defined a sensor called binary_sensor.stato_operativo_elettrodomestico, which will take on value "on"When the appliance is working and"off"When it will be at rest.

DETAIL SENSOR

As explained, the definition of a detail sensor based on a recursive behavior pattern of the appliance (in terms of vibrations) is an approccio that we don't feel we can support. There is also a limit to the imagination, after all. Nevertheless, those who want to try can - of course - freely do so: a cue can certainly come from proabsorption based jet, paragraph “Sensorand detail"

Automation

At this point, as we are equipped with capable sensors to detect the operational status of the non-domotic appliance, in addition to consulting the states and trends over time we will be able to prosee how to use them as trigger, condizioni and / or object of actions in ours automations.

An example is to make sure to be alerted at the state change (from “on” a “off"And vice versa - or other) of the appliance.

In the automation that follows, the simple state of the appliance (surveyed through "binary_sensor.stato_operativo_elettrodomestico") Is the trigger (trigger) of an automation that prosees to alert a user through a notification Pushbullet conveyed through an entity called "notify.marco"

- alias: "Notifica per cambio di stato"
  trigger:
    platform: state
    entity_id: binary_sensor.stato_operativo_elettrodomestico
  condition: []
  action:
     service: notify.marco
     data_template:
       title: "Elettrodomestico"
       message: "L'elettrodomestico è passato da {{ trigger.from_state.state }} a {{ trigger.to_state.state }}"


Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.


telegram

Stay up to date through ours Telegram channel!