Baldhor / Homey-ESPhome-Enhanced

This is an Homey app which adds support for ESPHome devices. ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems. More information on their homepage: https://www.esphome.io/
GNU General Public License v3.0
4 stars 3 forks source link

Physical Device versus Homey Device #12

Closed Baldhor closed 10 months ago

Baldhor commented 10 months ago

Current situation

As of current situation, which is actually the default behaviour for all Homey devices, a physical device (real world device) is linked to one and only one device in Homey. All capabilities of the physical device are directly linked to the Homey device.

image

Let's consider a physical device which include a temperature, humidity and air pressure sensor. In Homey, it will appear as one device which those 3 capabilities.

image

Above, you can see a Xiaomi sensor. On room view, only the temperature appear. To check the other capabilities, you need to go "inside" the device!

Example with Athom sw03

An ESPhome device can have a lot of entities. For example if you consider the device I use to control my covers: image

This device has:

(You can find the configuration I use here: https://github.com/Baldhor/Homey-ESPhome-Enhanced/tree/main/esphome-config)

I could actually modify the configuration to handle the cover with a simple button, and use the 2 others for whatever purpose:

So why those "entities" should all appear in a single "Homey device"!?

Example with Sonoff 4CH

Another example, I'm using many Sonoff 4CH to control all my heaters. image

Each physical device control up to 4 heaters which can be in different rooms.

Currently, I have no choice, I'm using virtual device and many many many flows to "copy" the events from the virtual device to the "homey device", and the opposite ...

Here are the flows, just for my ground floor (yes, I have a big house ...) image

Remark: they are currently running Tasmota, not ESPhome. If I change to ESPhome, I will need to modify about 50 flows!

What I want

I want during pair time to have the ability to split the physical device entities into different Homey devices image

Remark: the user should have the right to handle several entities (capabilities) into the same Homey device, but he should also have the right to split them as he want!

Different kind of entities

In ESPhome, an entity can serve many different use. Let's take the exemple of my Athom SW03 configuration for cover:

When exposed as settings, I should be able to configure it as "read only" or "read/write".

Different kind of entity options

For exemple "open duration", has 3 options configured:

Sensor (like uptime) have many options:

We should be able to modify those options in the device settings screen.

An ESPhome physical device configuration can be modified easily

To make it short: The strengh of ESPhome is the abilioty given to easily modify our device behaviours! Everytime we change such configuration on the physical device, we should not have to delete and pair again the device! We should be able to "update" ...

Baldhor commented 10 months ago

This enhancement imply a big rework of the application

Baldhor commented 10 months ago

It's working ...

I made 2 devices with 2 capabilities each based on the same physical device:

  1. Cover and humidity
  2. Temperature and Battery

image image image image

The cover is working very well, same for the 3 sensors.

Still many things to test and fix ... but already a lot of functionnalities ... => Connect to new physical device and configure virtual devices, their capabilities and options

More to come: => Modify / Delete existing virtual devices ...

Broken:

Baldhor commented 10 months ago

For those interrested, I published a test version: https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/

Baldhor commented 10 months ago

4.0.1 published for test: https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/ Many refacto to make next steps easier. Imply a breaking change, which I could not avoid, sorry. => Need to delete device created with version 4.0.0 through the wizard driver

RoadXY commented 10 months ago

Anything specific I need to test?

Baldhor commented 10 months ago

@RoadXY just new device, anything you can think of :)

I'm working on the existing device functions

Baldhor commented 10 months ago

Published TEST version 0.4.2: https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/

Wizard is fully implemented!

What it CANNOT DO

What is LIMITED

What YOU can do

What it does FOR YOU

HELP WANTED

I cannot test every single use case by myself, there are many devices I do not have. Using mock (add random behaviour to the physical device through its firmware configuration) has its limits!

I didn't tested flows yet (trigger, condition, actions), and also need to test if there are several times the same "capability" on a virtual device.

Baldhor commented 10 months ago

0.4.3 published: Fix: add capability listener Fix: solved a few bugs related to the modification of a capability. If you change the type, it actually means a delete and a add, not a modify. Was missing Homey.done();

Baldhor commented 10 months ago

0.4.4 published and I asked for certification Seems stable enough.

I also made a community in homey forums

Baldhor commented 10 months ago

Last commit add support for title, preventInsights and preventTag options for all capabilities. To be honest, I'm unsure who would use preventInsights and preventTag ...

But title allows to distinguish two capability of the same type! Here is an exemple for temperature: image

And in flows: image

And this is possible because in the wizard, I configured: image

(Difficult to make a nice screenshot with this wizard ... who designed it!?)

Baldhor commented 10 months ago

Published 0.5.1: legacy driver is now deprecated, and only the wizard can be used for new devices.