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

[Add entity to fan class] OrconWifiController #75

Closed woetski123 closed 6 months ago

woetski123 commented 7 months ago

Is your feature request related to a problem? Please describe. I've connected the ESPHOME device https://www.tindie.com/products/hjhickinson/orconwificontroller-for-orcon-mvs-15/ to Homey pro 2023 which the ESPHOME app. I see 5x sensors and 1x switch. I'm unfortunately missing just 1 entity to set the fan speed. I've contacted the seller, he said it should be: Type: "Light", Name: "mv_unit_speed_test".

When looking at the log the ESP home application makes in the GUI, i can see the following: "{ "id": 1428093848, "type": "Light", "name": "mv_unit_speed_test", "config": { "objectId": "mv_unit_speed_test", "key": 1428093848, "name": "mv_unit_speed_test", "uniqueId": "mvtest13lightmv_unit_speed_test", "supportedColorModesList": [ 3 ], "legacySupportsBrightness": true, "legacySupportsRgb": false, "legacySupportsWhiteValue": false, "legacySupportsColorTemperature": false, "minMireds": 0, "maxMireds": 0, "effectsList": [], "disabledByDefault": false, "icon": "", "entityCategory": 0 }"

But unfortunately I cannot select this in the native capability and i've not found out how to do this myself.

Describe the solution you'd like Please add the native capability. Mega thank you.

Describe alternatives you've considered N.A.

Additional context If you need more information, logs, do not hesitate to contact me.

Wouter Netherlands

Baldhor commented 7 months ago

@woetski123 I need to implement support for Light component with britghness entity.

I need all the logs from the "collect debug info" feature : https://github.com/Baldhor/Homey-ESPhome-Enhanced/wiki/User-Guide#manage-your-physical-devices-page

I then should be able to simulate your device, and implement it within few days.

Baldhor commented 7 months ago

In the meantime, I analyzed a little the attributs to implement to supports the light component fully. Note: it goes much farther than your needs, but I will do it fully if possible.

https://esphome.io/components/light/index.html

transition_length: time! Require to implement a specific input format rule to allow to input seconds, hours, ... whatever color_mode: dynamic list of values brightness: percentage => slidder 0.0 to 1.0 (if mode is compatible) color_brightness: percentage => slidder 0.0 to 1.0 (if mode is compatible) red: percentage => slidder 0.0 to 1.0 (if mode is compatible) green: percentage => slidder 0.0 to 1.0 (if mode is compatible) bleu: percentage => slidder 0.0 to 1.0 (if mode is compatible) white: percentage => slidder 0.0 to 1.0 (if mode is compatible) color_temperature: float => slidder based on minMireds and Maxmireds cold_white: percentage => slidder 0.0 to 1.0 (if mode is compatible) warm_white: percentage => slidder 0.0 to 1.0 (if mode is compatible) flash_length: time => refer to transition_length. effect: dynamic list of values

Reminder: dynamic list of values is not supported by Homey, by default, only the context aware flow cards will be available. => Implementation of user specific list of value will be on user request for a beer!

Implementation of supportedColorMode is strange! For exemple, the value 3 means ON_OFF && BRIGHTNESS. => https://www.esphome.io/api/color__mode_8h_source I feel some mapping will be required ...

flash_length This attribut require to send a color at the same time,. A color can actually be any of the attributs red, blue, green, brigthness, ... and it depends of the color mode selected. From Homey side, it's just impossible to implement such functionnality. The only way would be to use a kind of script, or a specific format like: 2G1B1bri... => I will not be supported

low level api Low level api use the legacySupported flag to authorize or not the functionnalities ... legacy means legacy ... I feel it will create some issues!

    setBrightness(brightness) {
        if (!this.config.legacySupportsBrightness) throw new Error('brightness is not supported');
        this.command({ brightness });
    }

It should be based on the "selected mode":

ON_OFF: Only on/off control.
BRIGHTNESS: Only brightness control. Accepts brightness parameter.
WHITE: Single white channel only. Accepts brightness and white parameters.
COLOR_TEMPERATURE: Color-temperature controlled white channel. Accepts brightness and color_temperature parameters.
COLD_WARM_WHITE: Cold and warm white channels. Accepts brightness, color_temperature, cold_white and warm_white parameters.
RGB: RGB color channels. Accepts brightness, color_brightness, red, green and blue parameters.
RGB_WHITE: RGB color channels and a separate white channel. Accepts parameters from RGB and WHITE color modes.
RGB_COLOR_TEMPERATURE: RGB color channels and a separate color-temperature controlled white channel. Accepts parameters from RGB and COLOR_TEMPERATURE color modes.
RGB_COLD_WARM_WHITE: RGB color channels and two separate cold and warm white channels. Accepts parameters from RGB and COLD_WARM_WHITE color modes.
woetski123 commented 7 months ago

Hi Baldhor, Many thanks for the fast and friendly response!

The missing "mv_unit_speed_test", should be able to control the fan speed. So i guess some sort of PWM as an input possibly.
I'm also in contact with the designer of the device, so if you have questions?

Here is the log: "{ "versions": { "platform": "local", "platformVersion": 2, "version": "10.1.0", "appVersion": "1.2.2" }, "physicalDeviceId": "Wizard1701083203228", "physicalDevice": { "physicalDeviceId": "Wizard1701083203228", "status": "available", "used": true, "name": "OrconMVS15_controller", "ipAddress": "192.168.178.24", "port": "6053", "encryptionKey": "", "password": "", "nativeCapabilities": [ { "nativeCapabilityId": "1148164139:state", "entityId": "1148164139", "attribut": "state", "entityName": "mv_unit_speed_bypass_test", "type": "Switch", "used": 1, "value": false, "configs": {}, "constraints": { "type": "boolean" }, "specialCase": null }, { "nativeCapabilityId": "1166331093:state", "entityId": "1166331093", "attribut": "state", "entityName": "mv_tacho_test", "type": "Sensor", "used": 1, "value": 408, "configs": { "readOnly": true, "unit": "pulses/min", "precision": 0 }, "constraints": { "type": "number" }, "specialCase": null }, { "nativeCapabilityId": "1305956432:state", "entityId": "1305956432", "attribut": "state", "entityName": "mv_speed_requested_test", "type": "Sensor", "used": 1, "value": 0.000050999999075429514, "configs": { "readOnly": true, "unit": "s", "precision": 8 }, "constraints": { "type": "number" }, "specialCase": null }, { "nativeCapabilityId": "1885457911:state", "entityId": "1885457911", "attribut": "state", "entityName": "OrconPressure", "type": "Sensor", "used": 1, "value": null, "configs": { "deviceClass": "pressure", "readOnly": true, "unit": "hPa", "precision": 1 }, "constraints": { "type": "number" }, "specialCase": null }, { "nativeCapabilityId": "3729473773:state", "entityId": "3729473773", "attribut": "state", "entityName": "OrconHumidity", "type": "Sensor", "used": 1, "value": null, "configs": { "deviceClass": "humidity", "readOnly": true, "unit": "%", "precision": 1 }, "constraints": { "type": "number" }, "specialCase": null }, { "nativeCapabilityId": "3747014784:state", "entityId": "3747014784", "attribut": "state", "entityName": "OrconTemp", "type": "Sensor", "used": 1, "value": null, "configs": { "deviceClass": "temperature", "readOnly": true, "unit": "°C", "precision": 1 }, "constraints": { "type": "number" }, "specialCase": null } ], "rawData": [ { "id": 1148164139, "type": "Switch", "name": "mv_unit_speed_bypass_test", "config": { "objectId": "mv_unit_speed_bypass_test", "key": 1148164139, "name": "mv_unit_speed_bypass_test", "uniqueId": "mvtest13switchmv_unit_speed_bypass_test", "icon": "", "assumedState": false, "disabledByDefault": false, "entityCategory": 0, "deviceClass": "" } }, { "id": 1166331093, "type": "Sensor", "name": "mv_tacho_test", "config": { "objectId": "mv_tacho_test", "key": 1166331093, "name": "mv_tacho_test", "uniqueId": "mvtest13sensormv_tacho_test", "icon": "mdi:pulse", "unitOfMeasurement": "pulses/min", "accuracyDecimals": 0, "forceUpdate": true, "deviceClass": "", "stateClass": 1, "lastResetType": 0, "disabledByDefault": false, "entityCategory": 0 } }, { "id": 1305956432, "type": "Sensor", "name": "mv_speed_requested_test", "config": { "objectId": "mv_speed_requested_test", "key": 1305956432, "name": "mv_speed_requested_test", "uniqueId": "mvtest13sensormv_speed_requested_test", "icon": "mdi:timer-outline", "unitOfMeasurement": "s", "accuracyDecimals": 8, "forceUpdate": false, "deviceClass": "", "stateClass": 1, "lastResetType": 0, "disabledByDefault": false, "entityCategory": 0 } }, { "id": 1428093848, "type": "Light", "name": "mv_unit_speed_test", "config": { "objectId": "mv_unit_speed_test", "key": 1428093848, "name": "mv_unit_speed_test", "uniqueId": "mvtest13lightmv_unit_speed_test", "supportedColorModesList": [ 3 ], "legacySupportsBrightness": true, "legacySupportsRgb": false, "legacySupportsWhiteValue": false, "legacySupportsColorTemperature": false, "minMireds": 0, "maxMireds": 0, "effectsList": [], "disabledByDefault": false, "icon": "", "entityCategory": 0 } }, { "id": 1885457911, "type": "Sensor", "name": "OrconPressure", "config": { "objectId": "orconpressure", "key": 1885457911, "name": "OrconPressure", "uniqueId": "mvtest13sensororconpressure", "icon": "", "unitOfMeasurement": "hPa", "accuracyDecimals": 1, "forceUpdate": false, "deviceClass": "pressure", "stateClass": 1, "lastResetType": 0, "disabledByDefault": false, "entityCategory": 0 } }, { "id": 3729473773, "type": "Sensor", "name": "OrconHumidity", "config": { "objectId": "orconhumidity", "key": 3729473773, "name": "OrconHumidity", "uniqueId": "mvtest13sensororconhumidity", "icon": "", "unitOfMeasurement": "%", "accuracyDecimals": 1, "forceUpdate": false, "deviceClass": "humidity", "stateClass": 1, "lastResetType": 0, "disabledByDefault": false, "entityCategory": 0 } }, { "id": 3747014784, "type": "Sensor", "name": "OrconTemp", "config": { "objectId": "orcontemp", "key": 3747014784, "name": "OrconTemp", "uniqueId": "mvtest13sensororcontemp", "icon": "", "unitOfMeasurement": "°C", "accuracyDecimals": 1, "forceUpdate": false, "deviceClass": "temperature", "stateClass": 1, "lastResetType": 0, "disabledByDefault": false, "entityCategory": 0 } } ] } }"

Baldhor commented 7 months ago

@woetski123 Thans for the full logs, I will be honest, it doesn't provide any usefull additional information lol

next step for me is to find a way to simulate the behaviour of your device, I will check on it this weekend, after that it should be straight forward. I do not have a "light" esphome device ...

edit: to be honest, I don't understand the choice of the developper to use a light component ... but anyway soon or later Light must be implemented, so why not now

Baldhor commented 6 months ago

@woetski123 I published a version with support for state and brightness. It should be live tomorrow, in the meantime, you can install the test version : https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/

!!! I noticed an annoying behaviour of the monochromatic component:

Two solutions here:

  1. Just use the state : ON / OFF
  2. Do not use state, but only brightness

You can match brightness to many capability, I would suggest DIM for your usecase, and the device class FAN.

Have fun, and let me know if any issue.

Baldhor commented 6 months ago

ah no, the solution I proposed above doesn't work ... changing brightness will not turn on the state ... so need to handle both. Very annoying ...

Baldhor commented 6 months ago

Know behaviour, which other users reported as annoying and proposed ESPhome pull request => https://github.com/esphome/issues/issues/2833 But those pull requests have been ignored, apparently the behaviour expected is different for many users ...

I suggest to modify your device configuration to use fan speed component: https://esphome.io/components/fan/speed

Note: It will require to implement the support of this component in the ESPhome app for Homey ...

Baldhor commented 6 months ago

closing:

Thanks

woetski123 commented 6 months ago

@Baldhor, mate. new test update works beautiful, indeed what you say is true: "I can now regulate fan speed of my house, and indeed when switching the state it goes to 100% first." But that's no problem.

Enjoy your well deserved rest of the weekend!