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
5 stars 3 forks source link

The cover is not showing up in the list of unbind native capabilities. Anything wrong in my config? #22

Closed Baldhor closed 1 year ago

Baldhor commented 1 year ago
          The cover is not showing up in the list of unbind native capabilities. Anything wrong in my config?

Also, one small improvement, I have a sensor for the Wi-Fi signal but the capability is missing in the list. I have picked measure_pressure, but it is not entirely correct.

Scherm­afbeelding 2023-08-20 om 14 02 42

Config:

esphome:
  name: REDACTED
  platform: ESP8266
  board: d1_mini
  comment: "RelayBoard001"

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: !secret ota_password

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  ap:
    ssid: ${devicename}
    password: !secret wifi_password

captive_portal:

web_server:
  port: 80
  auth:
    username: REDACTED
    password: !secret ota_password

sensor:
  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: 60s

cover:
  - platform: template
    name: "Garage Door"
    open_action:
      # Cancel any previous action
      - switch.turn_off: garagepoort_trigger
      # Turn the OPEN switch on briefly
      - switch.turn_on: garagepoort_trigger
      - delay: 0.3s
      - switch.turn_off: garagepoort_trigger
    close_action:
      # Cancel any previous action
      - switch.turn_off: garagepoort_trigger
      # Turn the OPEN switch on briefly
      - switch.turn_on: garagepoort_trigger
      - delay: 0.3s
      - switch.turn_off: garagepoort_trigger
    optimistic: true
    assumed_state: true

switch:
  - platform: gpio
    pin:
      number: D3
      inverted: true
    name: "Garagepoort"
    id: garagepoort_trigger

Originally posted by @JoachimVeulemans in https://github.com/Baldhor/Homey-ESPhome-Enhanced/issues/20#issuecomment-1685266910

Baldhor commented 1 year ago

Need add support to windowcoverings_closed capability I think

JoachimVeulemans commented 1 year ago

@Baldhor logs for information

"Unknown native capability, ignoring"

Scherm­afbeelding 2023-08-20 om 16 28 36

Baldhor commented 1 year ago

@JoachimVeulemans I published a new test version with additional logs ... https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/

What I need is the new log which start with: computeNativeCapability for entityId 1402501725:

I think the entity object will have a state property of type float, and I need to convert it into either windowcoverings_closed which expect a boolean, or to windowcoverings_state which expect an enum ...

In ESPhome, template cover have a state property with 3 possible values: 1.0 (open), 0.0 (close) or {} (unknown)

I will try to simulate your cover on my own device, but with your logs I will be sure I simulate the correct case.

NB: I was able to add those logs, because I solved the circular reference issue yesterday.

JoachimVeulemans commented 1 year ago

@Baldhor small side problem, the input field for the encryption key is limited to 20 characters. This is too short for the key, could you change the maximum number of characters?

Log for computeNativeCapability: [ManagerDrivers],[Driver:esphome-wizard],[PhysicalDevice:192.168.1.188:6053],computeNativeCapability for entityId,1402501725:

{
    "_events": {},
    "_eventsCount": 2,
    "config": {
        "objectId": "garage_door",
        "key": 1402501725,
        "name": "Garage Door",
        "uniqueId": "garagecovergarage_door",
        "assumedState": true,
        "supportsPosition": false,
        "supportsTilt": false,
        "deviceClass": "",
        "disabledByDefault": false,
        "icon": "",
        "entityCategory": 0,
        "supportsStop": false
    },
    "type": "Cover",
    "name": "Garage Door",
    "id": 1402501725,
    "connection": {
        "_events": {
            "message.SwitchStateResponse": [
                null,
                null,
                null,
                null,
                null,
                null
            ]
        },
        "_eventsCount": 28,
        "frameHelper": {
            "_events": {},
            "_eventsCount": 5,
            "host": "192.168.1.188",
            "port": "6053",
            "buffer": {
                "type": "Buffer",
                "data": []
            },
            "socket": {
                "connecting": false,
                "_hadError": false,
                "_parent": null,
                "_host": null,
                "_closeAfterHandlingError": false,
                "_readableState": {
                    "objectMode": false,
                    "highWaterMark": 16384,
                    "buffer": {
                        "head": null,
                        "tail": null,
                        "length": 0
                    },
                    "length": 0,
                    "pipes": [],
                    "flowing": true,
                    "ended": false,
                    "endEmitted": false,
                    "reading": true,
                    "constructed": true,
                    "sync": false,
                    "needReadable": true,
                    "emittedReadable": false,
                    "readableListening": false,
                    "resumeScheduled": false,
                    "errorEmitted": false,
                    "emitClose": false,
                    "autoDestroy": true,
                    "destroyed": false,
                    "errored": null,
                    "closed": false,
                    "closeEmitted": false,
                    "defaultEncoding": "utf8",
                    "awaitDrainWriters": null,
                    "multiAwaitDrain": false,
                    "readingMore": false,
                    "dataEmitted": true,
                    "decoder": null,
                    "encoding": null
                },
                "_events": {},
                "_eventsCount": 5,
                "_writableState": {
                    "objectMode": false,
                    "highWaterMark": 16384,
                    "finalCalled": false,
                    "needDrain": false,
                    "ending": false,
                    "ended": false,
                    "finished": false,
                    "destroyed": false,
                    "decodeStrings": false,
                    "defaultEncoding": "utf8",
                    "length": 0,
                    "writing": false,
                    "corked": 0,
                    "sync": false,
                    "bufferProcessing": false,
                    "writecb": null,
                    "writelen": 0,
                    "afterWriteTickInfo": {
                        "count": 2
                    },
                    "buffered": [],
                    "bufferedIndex": 0,
                    "allBuffers": true,
                    "allNoop": true,
                    "pendingcb": 2,
                    "constructed": true,
                    "prefinished": false,
                    "errorEmitted": false,
                    "emitClose": false,
                    "autoDestroy": true,
                    "errored": null,
                    "closed": false,
                    "closeEmitted": false
                },
                "allowHalfOpen": false,
                "_sockname": null,
                "_pendingData": null,
                "_pendingEncoding": "",
                "server": null,
                "_server": null
            }
        },
        "_connected": true,
        "_authorized": true,
        "port": "6053",
        "host": "192.168.1.188",
        "clientInfo": "homey",
        "password": "<hidden value>",
        "encryptionKey": "<no value>",
        "reconnect": false,
        "reconnectTimer": null,
        "reconnectInterval": 30000,
        "pingTimer": {
            "_idleTimeout": 15000,
            "_idlePrev": {
                "_idlePrev": {
                    "_idleTimeout": 15000,
                    "_idlePrev": {
                        "_idleTimeout": 15000,
                        "_idleStart": 2972411,
                        "_repeat": 15000,
                        "_destroyed": false
                    },
                    "_idleStart": 2972409,
                    "_repeat": 15000,
                    "_destroyed": false
                },
                "expiry": 2987409,
                "id": -9007199254739961,
                "msecs": 15000,
                "priorityQueuePosition": 2
            },
            "_idleStart": 2981474,
            "_repeat": 15000,
            "_destroyed": false
        },
        "pingInterval": 15000,
        "pingAttempts": 3,
        "pingCount": 0
    }
}
Baldhor commented 1 year ago

@Baldhor small side problem, the input field for the encryption key is limited to 20 characters. This is too short for the key, could you change the maximum number of characters?

My bad, I made it 44 in conf_settings, but forgot to make it 44 in new_device ...

Fix published: https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/

JoachimVeulemans commented 1 year ago

@Baldhor I can enter the full key but it does not allow me to click on "Connect". It seems some validation is incorrect. I can click on "Connect" when the key field is empty.

Baldhor commented 1 year ago

You cannot have both password and encryption key. I should add an info message I suppose

JoachimVeulemans commented 1 year ago

Why? In Home Assistant, I asks me to input the encryption key, then the password. Is this not the intended use?

JoachimVeulemans commented 1 year ago

I guess not, will adapt my configs :)

image

Baldhor commented 1 year ago

As far as I can tell it's either one or another :) I suppose home assistant ignore the password if there are an encryption key. Either that or there are a bug in the ESPhome low level client I use.

From logic point of view, one or another seems the way to go.

Baldhor commented 1 year ago

Ok so:

    "config": {
        "objectId": "garage_door",
        "key": 1402501725,
        "name": "Garage Door",
        "uniqueId": "garagecovergarage_door",
        "assumedState": true,
        "supportsPosition": false,
        "supportsTilt": false,
        "deviceClass": "",
        "disabledByDefault": false,
        "icon": "",
        "entityCategory": 0,
        "supportsStop": false
    },

supportsPosition == false

But: image

Position == 1 ...

That doesn't make a lot of sense!

I need to be able to reproduce it. Maybe I will have time tomorrow, I will keep you aware.

Baldhor commented 1 year ago

@JoachimVeulemans I was able to reproduce your device using this yml conf:

  - id: cover2
    platform: template
    name: "Garage Door"
    optimistic: true
    assumed_state: true

New version published: https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/ Please confirm it works as expected, and I'd appreciate a review on the homey app store :)