Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Testers wanted] New ESPHome configuration and documentation improvements #67

Open
2 of 8 tasks
iMicknl opened this issue Oct 1, 2023 · 68 comments
Open
2 of 8 tasks
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@iMicknl
Copy link
Owner

iMicknl commented Oct 1, 2023

I am working on improving this repository. The main goal is to make it easier to get started, by providing only two configurations and a more updated README + configuration. In order to achieve this, all feedback and contributions are welcome.

Main goal:

  • Only provide 2 options and pin-outs (LoctekMotion Desk and LoctekMotion Desk with pass through)
  • Advise to use ESP32 due to 5V tolerance and hardware UART, add note about ESP8266 with voltage shifter (5V -> 3.3V).
  • Simplify the README and installation instructions (add a version for non technical people, 'plug and play')
  • Add system diagrams explaining the wiring
  • Modernize YAML config with cover, buttons and number entity
  • Remove the need for desk_height_sensor.h (load from custom component)
  • Simplify and improve docs (e.g. add https://esphome.io/guides/getting_started_hassio.html)

Long term:

Changes

  • Switch will turn off automatically when min or max height is reached
  • New cover entity
  • New number entity (still buggy)
  • Presets are exposed as button entities
  • Experimental buttons for alarm / alarm off
image image

Pin-out

In the past we have discussed multiple pin-outs, but it seems that multiple pin-outs can be supported by the same desk.

RJ45 pin Name ESP32
8 +5V (VDD) VIN
7 GND GND
6 TX TX2 (GPIO17)
5 RX RX2 (GPIO16)
4 PIN 20 D23 (GPIO23)
3 (unknown)
2 SWIM
1 RES

You can change the ESP32 pin-out mapping, but don't forget to change the pin number in the YAML.

esp32-flexispot
My setup, no soldering required.

Configuration

office-desk-esp32.yaml

The following secrets should be part of your ESPHome config: encryption_key, wifi_ssid and wifi_password.

Feedback

Any feedback and contributions are welcome! For example the work above adopted for pass through configurations.

@iMicknl iMicknl added enhancement New feature or request help wanted Extra attention is needed labels Oct 1, 2023
@iMicknl iMicknl pinned this issue Oct 1, 2023
@ThomDietrich
Copy link

ThomDietrich commented Oct 6, 2023

Hey @iMicknl,

thanks for providing this updated version of the code. The improvements look really good. First observations:

  • You have mixed up preset 3 and 4 in the comments. On my device this is Button 4:
    name: "Sit" # Preset 3 on some control panels
  • On my specific device the wake screen command and the PIN20 method do not work, however, "child lock" (which seems not supported) wakes up the device (and produces the current desk height) - so thank you!
  • update_interval: 0ms # update in every loop() iteration in number "Desk Height" does what you intended, but is that really necessary?
  • You've used the name "Desk Height" twice. Yes not a technical issue, more of an intuitive ick
  • First testing results: All combinations of Up/Down, Cover and Button commands seem to work and I couldn't get them to collide. Very big improvement to before!
  • A preset button will send the desk on its way. This can be stopped by e.g. shortly pressing the Up or Down button. Could you add a "Stop" button?
  • A binary_sensor that indicates that the desk is currently moving would be great

General comment: It seems like more and more devices will be potentially supported by your project, and each will have their own caveats. My HCB223A-1 seems to be a good example. Should we capture those differences in a table of sorts?

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 8, 2023

Thanks a lot for your extensive feedback, @ThomDietrich!

On my specific device the wake screen command and the PIN20 method do not work, however, "child lock" (which seems not supported) wakes up the device (and produces the current desk height) - so thank you!

The wake command does not work here as well. What do you mean with PIN20 doesn't work? PIN20 is set to ALWAYS_ON (high) to allow the ESP32 to control the desk.

update_interval: 0ms # update in every loop() iteration in number "Desk Height" does what you intended, but is that really necessary?

This floods the log indeed, and I need to have a better look here. It needs to be at least 0.5s, in order for the number template to be updated with the height of the desk height sensor.

A preset button will send the desk on its way. This can be stopped by e.g. shortly pressing the Up or Down button. Could you add a "Stop" button?

Good one! Perhaps we could make the cover.stop button behave like this. I am not sure how often you want to cancel a preset command?

A binary_sensor that indicates that the desk is currently moving would be great

In theory the cover entity should have such a status already. We need to have a look if this is currently missing and if so, if this could be added.

You've used the name "Desk Height" twice. Yes not a technical issue, more of an intuitive ick

Do you have any suggestions for a better name / structure? The issue here is that one is a sensor and the other one is a number entity (that is still a bit buggy).

@ThomDietrich
Copy link

ThomDietrich commented Oct 9, 2023

PIN20 is set to ALWAYS_ON (high) to allow the ESP32 to control the desk.

Oh! I didn't know that. Compare here: https://github.com/iMicknl/LoctekMotion_IoT#execute-a-command
Maybe you want to add a description to the README? I wouldn't know because on my device the pin does not have a purpose, i.e., ALWAYS_OFF does not change any behavior.

It needs to be at least 0.5s, in order for the number template to be updated with the height of the desk height sensor.

I get that. My first thought was a delta/throttle filter but glad I tested it: Filters are only supported by sensors. One option i can think of is to disable direct updates and do the following:

      id: "desk_height"
      on_value:
        then:
          - component.update: set_desk_height

I've tested the solution and it works as expected.

I am not sure how often you want to cancel a preset command?

Probably very seldom but to me it feels like this action is missing from the options offered in HA. I would expect the Stop button to stop all movements, be it preset or cover actions. Yes the cover has this function but I generally like to offer slightly redundant but purposeful options. Makes integration in e.g. automations or a Lovelace dashboard a lot easier.

In theory the cover entity should have such a status already. We need to have a look if this is currently missing and if so, if this could be added.

I thought so as well but doesn't seem like it 🧐 Apparently this can be achieved via - cover.template.publish: > id: desk_cover > current_operation: OPENING but it didn't make a difference in a quick test.Anyhow, for the same reasons as above, I'd vote for a dedicated binary_sensor (ideally in addition to the cover publishing "opening")

Do you have any suggestions for a better name / structure?

Good challenge. Nope can't think of one. Let's leave as is.

Not really a bug but this triggers my internal perfectionist. Any idea how to sync those two? Simple rounding didn't work for me.

[10:52:06][D][sensor:094]: 'Desk Height': Sending state 67.80000 cm with 1 decimals of accuracy
[10:52:06][D][number:012]: 'Desk Height': Sending state 67.800003
[10:52:06][D][sensor:094]: 'Desk Height': Sending state 67.70000 cm with 1 decimals of accuracy
[10:52:06][D][number:012]: 'Desk Height': Sending state 67.699997

@jamesmyatt
Copy link
Contributor

jamesmyatt commented Oct 9, 2023

BTW, ESP8266 GPIO pins are also tolerant to 5V inputs. e.g. https://www.tablix.org/~avian/blog/archives/2022/05/a_footnote_about_esp8266_5v_tolerance/

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 9, 2023

Oh! I didn't know that. Compare here: https://github.com/iMicknl/LoctekMotion_IoT#execute-a-command
Maybe you want to add a description to the README? I wouldn't know because on my device the pin does not have a purpose, i.e., ALWAYS_OFF does not change any behavior.

Interesting. So in your case you don't have PIN20 connected to your ESP + no PIN20 in your config?

Thanks for your other improvements, I will give it a try and update the startpost when I am done.

BTW, ESP8266 GPIO pins are also tolerant to 5V inputs. e.g. https://www.tablix.org/~avian/blog/archives/2022/05/a_footnote_about_esp8266_5v_tolerance/

Thanks, @jamesmyatt! Not sure why I had so many stability issues when using the ESP8266 with the same config. Perhaps the combination of 5V + no hardware UART causes these stability issues. Multiple users reported similar behavior with ESP8266, but I wasn't able to pin point the issue.

@ThomDietrich
Copy link

ThomDietrich commented Oct 9, 2023

Interesting. So in your case you don't have PIN20 connected to your ESP + no PIN20 in your config?

Historically motivated I have it connected and configured as internal switch as per your default config. However I can confirm that the switch does not have any effect, i.e. neither ALWAYS_OFF and ALWAYS_ON, as well as switching during runtime will interrupt normal operation.

Imho, let's state that PIN20 shall be connected and configure it as ALWAYS_ON as a simplified default. We can still leave a comment "not needed by all controllers" as a comment.
I'd suggest a different name other than "Virtual Screen", which at least I can't relate to. How about "Remote Control Pull-up"?

@ThomDietrich
Copy link

ThomDietrich commented Oct 10, 2023

Minor additional comment: In your code some name and id settings are quoted, not all. None of them need quotes.

Slightly tangent but maybe relevant for docs? As I am using an ESP32-C3 my setup uses GPIO21 as TX, GPIO20 as RX. Some dev boards also don't offer all pins. I suggest to add a remark that users should check the pinout of their specific board.

Suggest renames:

  • switch_alarm -> switch_alarm_off
  • button_alarm -> button_alarm_set
  • button_alarm: entity_category: config

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 10, 2023

Thanks @ThomDietrich, I will make the changes. And actually hope to soon have a beta branch where everyone can easily contribute.

@j3mu5
Copy link

j3mu5 commented Oct 15, 2023

Thanks @iMicknl for the rework! With the new code, ESP Home runs very stable on an ESP32 chip! So far I haven't noticed any more crashes. Good work!

I still observed three features that don't quite match the expected behaviour.

  1. If the height is selected via HA using the slider, the desk always moves a little too far, i.e. to slightly too high positions when going up and to slightly too low positions when going down.

  2. If the 4 seat positions are selected via HA (Preset 1, Preset 2, Sit, Stand), the desk height is not updated.
    This can only be done manually if
    a) I press the button "Wake Screen" while the display is still on.
    b) when the display is off, one presses the "Memory" button.

  3. update_interval: 0ms seemed a bit brutal to me - this spammed my log until the ESP Home frontend (within homeassistant) crashed. Is it possible to increase this value to 250 - 500 ms?

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 15, 2023

Thanks for the feedback, @j3mu5! Great to hear that this runs stable on your ESP32.

  1. This is a known issue indeed, and won't be too easy to solve. Other implementations keep retrying (so going up and down) until they reach the requested height. I see this feature more as a gimmick anyways, since most desks have 4 presets.
  2. Which desk do you have? For me, the height updates as well when I set a preset.
  3. This will probably be changed to a 'push' mechanism as suggested by @ThomDietrich.

@j3mu5
Copy link

j3mu5 commented Oct 15, 2023

Dear @iMicknl , it is an honour for me to contribute by testing and giving feedback! :)

  1. I also don't find it essential that the table hits the exact height when set by the slider. As you say, this works perfectly with the presets. I don't find repeated adjustment with up and down (like other implementations) an improvement.
    I have one further idea: How about subtracting (upwards movement) or adding (downwards movement) a certain, user selectable offset (1-2 cm) from the target size. This would at least compensate for the error somewhat. The difference between the target and the actual value is unfortunately variable; between 1 and 2 cm in my case.

  2. It is the Flexispot E7 with a Wemos D1 mini 32. I have connected the cables as follows:
    GND White-Brown
    +5V (VDD) Brown
    GPIO17 Green
    GPIO16 White-Blue
    GPIO23 Blue

  3. Cool, thanks @ThomDietrich

@brumouta
Copy link

My Flexispot E7 also don't update height when clicking presets

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 15, 2023

@brumouta do you use the pin-out and config from above?

@brumouta
Copy link

brumouta commented Oct 15, 2023 via email

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 15, 2023

@brumouta if you would be able to use the pin-out from this branch (if it isn't the same), would be great. It should work for your device as well.

@brumouta
Copy link

It should be moving the rx and tx to gpio13 and gpio 15 and leaving pin20 where it is?
image

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 15, 2023

I meant the pin-out on the side of your desk mainly, doesn't matter much how you link it to your ESP. The original approach has multiple options for pin outs on the desk side.

@JannikSchmuck
Copy link

Hey @iMicknl

thanks for the updated version of the code, it made it so much easier for me to implement the project at my desk.

As I'm a total newbie with ESPs and HA I could assist in improving the documentation if needed, just let me know if I can help with that, by the way the reference to the ESPWebtools made the implementation a lot easier for me.

The issue with the desk height not being updated when using the presets as @j3mu5 mentioned I can confirm, this also occurs on my E8 (HS13B-1) with ESP32 Dev.

@brumouta
Copy link

@iMicknl yeah, i'm using the same pins that @j3mu5 is using. I can try tomorrow the new config, and the number from 1 to 8 is basically following the image from main branch right? Or it's just inverted here, because it's basically the same thing from the opposite side.

@ThomDietrich
Copy link

@iMicknl what's stopping the merge of v2 branch into main? Seems like it already is a big improvement, even if further improvements can come through individual discussions as we had them here

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 16, 2023

@ThomDietrich time to finish the instructions and polish everything! 😁.

& I would like to add passthrough configurations as well.

@iMicknl
Copy link
Owner Author

iMicknl commented Oct 16, 2023

@iMicknl yeah, i'm using the same pins that @j3mu5 is using. I can try tomorrow the new config, and the number from 1 to 8 is basically following the image from main branch right? Or it's just inverted here, because it's basically the same thing from the opposite side.

@brumouta, it is the same as https://github.com/iMicknl/LoctekMotion_IoT?tab=readme-ov-file#hs01b-1 from the main branch. The main branch has different pinouts, and it seems this specific pin-out works on all devices.

@l7ssha
Copy link

l7ssha commented Oct 19, 2023

This version of esphome config works much better than the ones fro repo. I modified to add keypad passthrough and it seems to work really well. I used .h file and sensor snippets from repo - probably not the best way of implementing it, but works nonetheless. My desk was bought from elzap.eu with HS13B-1 controller.

https://gist.github.com/l7ssha/c6d989396a560f895ee3c770815a650a

@brumouta
Copy link

@iMicknl yeah, i'm using the same pins that @j3mu5 is using. I can try tomorrow the new config, and the number from 1 to 8 is basically following the image from main branch right? Or it's just inverted here, because it's basically the same thing from the opposite side.

@brumouta, it is the same as https://github.com/iMicknl/LoctekMotion_IoT?tab=readme-ov-file#hs01b-1 from the main branch. The main branch has different pinouts, and it seems this specific pin-out works on all devices.

Wait, this is one is the same as the other one based on RJ45 colours, but the pins order are inverted, now I'm more confused

@ThomDietrich
Copy link

ThomDietrich commented Jan 4, 2024

Look for this part of the code:

switch:
  - platform: gpio
    name: Serial Control Pull-Up  # "PIN20" of desk controller
    pin:
      number: GPIO9 # might be different for your setup
      mode: OUTPUT
    restore_mode: ALWAYS_ON
    entity_category: config
    internal: true

Change the last line to internal: false. You will see a new switch turn up in Home Assistant.

@1100101
Copy link

1100101 commented Jan 4, 2024

I don't have Home Assistant, but I added an MQTT command to toggle the PIN20 switch.
If i toggle the switch off for at least 2 seconds, and then on again, the height data packages are being processed (I enabled the debug logging in height_sensor.h), and if the hight has changed it is being published.
But if I don't "touch" the virtual switch, and change the height of the table, no debug messages regarding height are being processed.

@voydz
Copy link

voydz commented Feb 15, 2024

Thanks for this project. I really appreciate the work that has been done.

Just as a note. I had to download the height sensor C implementation and use it with 'includes:' as the 'external_components:' entry does not work for me. (compile error)
Am I missing something?

I have the same issues with the reporting of the desk height. (Two RJ45 ports that seem to report different things.)
Will do some testing and share my findings if I got something interesting.

best regards

@fbloemhof
Copy link

fbloemhof commented Mar 9, 2024

Seems to work fine!

My control box is a "CB38M3B(IB)-1". I found out my ethernet wiring is the other way around, but this might be my own fault. I only have RX/TX connected now and all looks good. If I use the original controller it also updates the esp status.

Is it possible to adjust the alarm (timer)?

Also I would like to change the behavior of the up and down buttons to "momentary", the same as the desk itself. Would this be possible?

@gschmidl
Copy link

I tried this on my standing desk with the HS13A-1 controller and a second RJ45 port and it worked instantly - what took the longest was getting the ESP32 into flash mode.

@jamesmyatt
Copy link
Contributor

jamesmyatt commented Mar 22, 2024

Is this the same as the version in the v2.1 branch, which looks like it's the latest? main...v2.1

@markuspi
Copy link

Using my own esphome configuration, i got my Flexispot E7 stuck in ASR and E07 errors. Resolving the problem via esphome did not work right away: Continuously sending the move down command using an interval of 100ms resulted in slow, jerky motion and did not fix the error. Only after i adjusted the send_every interval down to 50ms, i was able to move the table down normally and fix the error

@bobtheshizocat
Copy link

bobtheshizocat commented Mar 31, 2024

Thanks for the repository @iMicknl, and the helpful comments from everyone to read through!

I have a Flexispot E7 with the control box CB38M2E(IB)-1 and the control panel HS13B-1. I'm using an ESP32-WROOM-32 dev board (esp32dev) for the smart addon. This is my wiring (using the same one mentioned here):

ESP32 Cable-Color RJ45-PIN
+5V (VIN) Brown 8
GND White-Brown 7
GPIO16 (RX2) White-Blue 5
GPIO23 Blue 4
GPIO17 (TX2) Green 2
Click here to expand for an image of the wiring ![esp32-rj45-breadboard](https://github.com/iMicknl/LoctekMotion_IoT/assets/84284486/3e3b4ca8-0795-4e5a-bd28-1d5f2acbc363)

Does work as expected:

  • Desk (Up- / Down- / Stopbutton has a short delay)
  • Alarm
  • Preset 1
  • Preset 2
  • Sit
  • Stand
  • Desk Height (Sensor)
  • Alarm off
  • Child Lock
  • Memory
  • Restart

Doesn't work as expected:

  • Desk Height (Number): Shows the current height, but if I enter a value, it sets the desk either too high while going up or sets it too low while going down.
  • Wake Screen: Doesn't work.

@dominik-b13
Copy link

Thanks for this project. I really appreciate the work that has been done.

Just as a note. I had to download the height sensor C implementation and use it with 'includes:' as the 'external_components:' entry does not work for me. (compile error) Am I missing something?

I have the same issues with the reporting of the desk height. (Two RJ45 ports that seem to report different things.) Will do some testing and share my findings if I got something interesting.

best regards

i solved the compile error by using an older esphome version (2023.6.5 worked for me, didnt test any newer)

@Qu4ndo
Copy link

Qu4ndo commented Apr 17, 2024

I have a Flexispot E7 Pro and built it using a NodeMCUv2 Board (ESP8266).
The pin-out worked as expected but I had to lookup my specific wiring diagram for the used ethernet cables (B standard).
After also changing the pins to the correct ones on my NodeMCUv2 board (including changing it in the esphome yaml) everything worked right out of the box!

NodeMCUv2 Mapping:

RJ45 pin Name ESP32
8 +5V (VDD) VIN
7 GND GND
6 TX TX (GPIO1)
5 RX RX (GPIO3)
4 PIN 20 D7 (GPIO13)
3 (unknown)
2 SWIM
1 RES

Additional Notes:

  • Don't forget to place the file "desk_height_sensor.h" into your esphome config base directory (ssh/sftp/terminal)!
  • The ethernet cable ends have twisted pairs (in my situation "T-568B" standard) but only the pin number is important.
  • My Desk Controller is the model "CB38M2L(IB)-2" with the Panel "HS13M-1C0"

Testing:

Function Default Working
Height Button Control
(Up/Down/Stop)
true true
Sit true true
Stand true true
Preset 1 true true
Preset 2 true true
Display Desk Height true true
Alarm false false
Alarm Off false false
Child Lock true true
Memory
(press Preset Button afterward)
true true
Restart - true
Wake Screen - false

Note:

  • "Default" means if it is a function the table should have (out of the box).
  • "Height Button Control" works in ~5cm steps. In order to get only one step you have to instantly press the stop button.
  • The same is for the Desk Height (Number) input. It will mostly go ~5cm (1step) further than planned.
  • "Wake Screen" works automatically with the press of a preset button, but not manually.
  • Playing with "Alarm" did get me a Error Code. Nothing a restart of the desk can't fix.

@jamesmyatt
Copy link
Contributor

jamesmyatt commented Apr 20, 2024

With ESPHome 2024.4.0, I get the following compile error:

/config/esphome/eh-086b7c.yaml: In lambda function:
/config/esphome/eh-086b7c.yaml:104:37: error: expected type-specifier before 'DeskHeightSensor'
  104 |       auto desk_height_sensor = new DeskHeightSensor(id(desk_uart));
      |                                     ^~~~~~~~~~~~~~~~
/config/esphome/eh-086b7c.yaml:106:33: error: could not convert '{desk_height_sensor}' from '<brace-enclosed initializer list>' to 'std::vector<esphome::sensor::Sensor*>'
  106 |       return {desk_height_sensor};
      |                                 ^
      |                                 |
      |                                 <brace-enclosed initializer list>

The desk height sensor and external_components are as in the v2.1 branch. The only significant difference is that I'm using the ESP8266 platform rather than the ESP32. I don't know if this matters.

This matches the ESPHome docs (https://esphome.io/components/sensor/custom.html#step-2-registering-the-custom-sensor). Although this approach for custom integrations is marked as deprecated. In fact, I wonder if it's a problem of mixing the "custom component" and "external component" functionality.

@jamesmyatt
Copy link
Contributor

OK. It seems to work well when desk_height_sensor.h is added via the esphome/includes entry. But not via the external components. So I think that the v2.1 config is inconsistent in the way it's using the desk_height_sensor. I'll make a PR to fix this.

@voydz
Copy link

voydz commented Apr 24, 2024

OK. It seems to work well when desk_height_sensor.h is added via the esphome/includes entry. But not via the external components. So I think that the v2.1 config is inconsistent in the way it's using the desk_height_sensor. I'll make a PR to fix this.

Yeah, think so, too.

Now, on ESPHome 2024.4.1, it will not even compile with a local desk_height_sensor.h. It is a bit outdated, I think it will need an update. Unfortunately I did not look into ESPHome too much.

@jamesmyatt
Copy link
Contributor

jamesmyatt commented May 23, 2024

PR #83 is to revert to using the "custom component" local include logic rather than the external component. This works but is not encouraged.

However, PR #84 instead implements the sensor as a proper external component and can be tested by using the yaml config from the PR with the following modification:

external_components:
  source: github://jamesmyatt/[email protected]
  components: [ loctekmotion_desk_height ]

@iMicknl
Copy link
Owner Author

iMicknl commented May 28, 2024

Thanks, @jamesmyatt. I will dive into this. Just returned from a long holiday, so will try to review in the coming week. 😊

@exico91
Copy link

exico91 commented Jun 4, 2024

Hello!
I just bought a Flexispot E7 and I have the controller HS13M-1C0
Im using a ESP32-C3 mini from Wemos (im using the version 1.0.0, it needs a tweak in the wifi section, *note1) https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html

I followed the pinout from Qu4ndo #67 (comment)

The control box has two RJ45 connectors, I used one for the panel and one for the ESP instead of using a passtrough.

RF45 pin Name ESP32-C3
8 +5V VBUS
7 GND GND
6 TX 4
5 RX 5
4 PIN 20 10
3 (unknown)
2 SWIM
1 RES

Obviously place the "desk_height_sensor.h" file in the same directory as the yaml.

(Up/Down/Stop) - Works
Sit - Works, its preset 4
Stand - Works, its preset 3
Preset 1 - Works
Preset 2 - Works
Desk height - Works
Alarm - Not found in the yaml for E7
Alarm Off - Not found in the yaml for E7
Child Lock - Not found in the yaml for E7 *note2
M - Works
Wake Screen - not working, maybe because Im using the second RJ45 port instead of a passtrough?

*note1:
If you use a C3 Mini V 1.0.0 set in the wifi section "output_power: 8.5"
There is a HW bug and the solution is to limit the wifi power, otherwise it works

*note2:
There is a code for the child lock or is just a M key spam?

*extra:
I also have bluetooth proxy enabled on this ESP because I have devices in the home that use bluetooth and why not using one that is hidden and forever on? Works no problem.

@jamesmyatt
Copy link
Contributor

@iMickn, "load from custom component" can be ticked now too.

Also, the 5V tolerance is also OK for ESP8266: I have the RJ45 cable wired directly to the corresponding pins on my ESP8266 D1 mini.

@jamesmyatt
Copy link
Contributor

jamesmyatt commented Jun 4, 2024

@exico91 , this issue concerns the v2 version of the component. Can you try using the config from the v2.1 branch of the repo? You won't need a local copy of desk_height_sensor.h Note that the current branch for the custom component is actually "v2.1" not "v2.2".

I'm also interested in the performance of the ESP32-C3, especially with the bluetooth proxy.

@exico91
Copy link

exico91 commented Jun 4, 2024

@exico91 , this issue concerns the v2 version of the component. Can you try using the config from the v2.1 branch of the repo? You won't need a local copy of desk_height_sensor.h Note that the current branch for the custom component is actually "v2.1" not "v2.2".

I'm also interested in the performance of the ESP32-C3, especially with the bluetooth proxy.

Ok, I missed that. I tried the 2.1 branch and edited the source from 2.2 to 2.1 in the yaml.
I adapted the code in the repo with my code and everything works except the wake screen. (Alarm ok, child lock ok)
Now it also struggles with the UART
`20:48:09 [W] [component:237]

Component uart.switch took a long time for an operation (151 ms).

20:48:09 [W] [component:238]

Components should block for at most 30 ms.`
And glitches sometimes. I can 100% replicate the glitch if I set the height manually in cm from HA. If I use a preset the desk goes to the correct height but the esp crashes and reboots.
I should try to hook up the HW UART instead of other pins

@exico91
Copy link

exico91 commented Jun 5, 2024

Unfortunately with HW Uart crashes too. I guess that the single core is not enough. Its better if I disable the bluetooth proxy but hangs with long travels. For example, since is faster in descent than climbing it will crash when I use the preset Stand but not if from Stand I use the preset Sit.
I will order a ESP32-S3 that is dual core to test.

@iMicknl
Copy link
Owner Author

iMicknl commented Jun 7, 2024

@jamesmyatt fixed! Now the v2 branch has all the latest updates and your contributions.

@N3m3515
Copy link

N3m3515 commented Jun 25, 2024

Thanks for the repository @iMicknl, and the helpful comments from everyone to read through!

I have a Flexispot E7 with the control box CB38M2E(IB)-1 and the control panel HS13B-1. I'm using an ESP32-WROOM-32 dev board (esp32dev) for the smart addon. This is my wiring (using the same one mentioned here):

ESP32 Cable-Color RJ45-PIN
+5V (VIN) Brown 8
GND White-Brown 7
GPIO16 (RX2) White-Blue 5
GPIO23 Blue 4
GPIO17 (TX2) Green 2
Click here to expand for an image of the wiring
Does work as expected:

  • Desk (Up- / Down- / Stopbutton has a short delay)
  • Alarm
  • Preset 1
  • Preset 2
  • Sit
  • Stand
  • Desk Height (Sensor)
  • Alarm off
  • Child Lock
  • Memory
  • Restart

Doesn't work as expected:

  • Desk Height (Number): Shows the current height, but if I enter a value, it sets the desk either too high while going up or sets it too low while going down.
  • Wake Screen: Doesn't work.

I have the same result with my wemos d1 mini.
and the desk hight only gets reported when the screen on my display is on and i press wake screen as long as it is on.

@iMicknl
Copy link
Owner Author

iMicknl commented Jul 28, 2024

@N3m3515 are you using the pin-out and latest YAML from the start post?

@Lsamamig12
Copy link

Would mind sharing your code? Thanks 🙏

I have a Flexispot E7 Pro and built it using a NodeMCUv2 Board (ESP8266). The pin-out worked as expected but I had to lookup my specific wiring diagram for the used ethernet cables (B standard). After also changing the pins to the correct ones on my NodeMCUv2 board (including changing it in the esphome yaml) everything worked right out of the box!

NodeMCUv2 Mapping:

RJ45 pin Name ESP32
8 +5V (VDD) VIN
7 GND GND
6 TX TX (GPIO1)
5 RX RX (GPIO3)
4 PIN 20 D7 (GPIO13)
3 (unknown)
2 SWIM
1 RES

Additional Notes:

  • Don't forget to place the file "desk_height_sensor.h" into your esphome config base directory (ssh/sftp/terminal)!
  • The ethernet cable ends have twisted pairs (in my situation "T-568B" standard) but only the pin number is important.
  • My Desk Controller is the model "CB38M2L(IB)-2" with the Panel "HS13M-1C0"

Testing:

Function Default Working
Height Button Control
(Up/Down/Stop) true true
Sit true true
Stand true true
Preset 1 true true
Preset 2 true true
Display Desk Height true true
Alarm false false
Alarm Off false false
Child Lock true true
Memory
(press Preset Button afterward) true true
Restart - true
Wake Screen - false
Note:

  • "Default" means if it is a function the table should have (out of the box).
  • "Height Button Control" works in ~5cm steps. In order to get only one step you have to instantly press the stop button.
  • The same is for the Desk Height (Number) input. It will mostly go ~5cm (1step) further than planned.
  • "Wake Screen" works automatically with the press of a preset button, but not manually.
  • Playing with "Alarm" did get me a Error Code. Nothing a restart of the desk can't fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests