Control your FlexiSpot desk (additional hardware required)

This is a short tutorial how you can control your Flexispot desk with Openhab.

You need:

  • FlexiSpot desk (obviously)
  • ESP32/ESP8266
  • RJ45 cable
  • optional: RJ45 to jump wires adapter (example)
  • jump wires
  • MQTT Broker (e.g. Mosquitto)

This project is based on the work of iMicknl who published a possibility to control a FlexiSpot desk for example with HomeAssistant via EspHome (github). I introduced the controlling via MQTT so it can be used with Openhab.

Important: This tutorial is based on a FlexiSpot E6. You have to adjust the files if you have another FlexiSpot desk (desk height). Further information can be found here.

1. Flash the ESP

You have to flash the ESP with the prepared firmware. You can find a small how to flash a EspHome project via command line here.
The files you need:

Fill the gaps, marked with <> in table.yaml, with your settings (wifi, mqtt, desk height). The board must also be adjusted if necessary (in this case a esp8266 is used with a nodemcu board).

Place both files in the same folder and flash the esp with: esphome run table.yaml

2. Wiring

The RJ45 cable is used to connect the desk to the ESP. Use the free ethernet port on the control panel of the desk and put the other and into the adapter or split the ethernet cable so you can access the wires.
Now find the model of your control panel and connect the wires as it’s described here and here.

In my case the used control panel is HS01B-1. With the linked adapter the cables are plugged in as follows: (Desk, RJ45 Pin, Adapter Color, ESP Pin)

  • GND β†’ 7 β†’ Brown β†’ GND
  • RX β†’ 5 β†’ Green β†’ D6
  • TX β†’ 6 β†’ Yellow β†’ D5
  • PIN20 β†’ 4 β†’ Red β†’ D2

3. Openhab

The ESP is now wired to the desk and powered. It’s time to define the thing and the items on Openhab.
desk.things:

Thing mqtt:topic:desk "FlexiSpot Desk" (mqtt:broker:mqttbroker) @ "Mqtt"
  {
    Channels:
      Type switch : preset_1 "Preset 1" [ stateTopic = "esptisch/switch/preset_1/state", commandTopic = "esptisch/switch/preset_1/command", on="On", off="Off" ]
      Type switch : preset_2 "Preset 2" [ stateTopic = "esptisch/switch/preset_2/state", commandTopic = "esptisch/switch/preset_2/command", on="On", off="Off" ]
      Type switch : preset_3 "Preset 3" [ stateTopic = "esptisch/switch/preset_3/state", commandTopic = "esptisch/switch/preset_3/command", on="On", off="Off" ]
      Type switch : m "M" [ stateTopic = "esptisch/switch/m/state", commandTopic = "esptisch/switch/m/command", on="On", off="Off" ]
      Type switch : wake_up "Wake Up" [ stateTopic = "esptisch/switch/wake_up/state", commandTopic = "esptisch/switch/wake_up/command", on="On", off="Off" ]
      Type number : height "Height" [ stateTopic = "esptisch/sensor/desk_height/state" ]
      Type number : uptime "Uptime" [ stateTopic = "esptisch/sensor/uptime/state" ]
      Type number : wifi_signal "Wifi Signal" [ stateTopic = "esptisch/sensor/wifi_signal/state" ]
      Type switch : status "Status" [ stateTopic = "esptisch/status", on = "online", off = "offline" ]
  }

desk.items:

Group                       gSchreibtisch                                      "Schreibtisch"                                                                                                                                                                                                                          ["Sensor"]
Switch                      Schreibtisch_Status                                "Schreibtisch Status"                                                                                                                                                                       (gSchreibtisch)                                            ["Status"]              {channel="mqtt:topic:desk:status"}
Switch                      Schreibtisch_Preset_1                              "Schreibtisch Preset 1"                                                                                                                                                                     (gSchreibtisch)                                            ["Switch"]              {channel="mqtt:topic:desk:preset_1"}
Switch                      Schreibtisch_Preset_2                              "Schreibtisch Preset 2"                                                                                                                                                                     (gSchreibtisch)                                            ["Switch"]              {channel="mqtt:topic:desk:preset_2"}
Switch                      Schreibtisch_Preset_3                              "Schreibtisch Preset 3"                                                                                                                                                                     (gSchreibtisch)                                            ["Switch"]              {channel="mqtt:topic:desk:preset_3"}
Switch                      Schreibtisch_Wake_Up                               "Schreibtisch Wake Up"                                                                                                                                                                      (gSchreibtisch)                                            ["Switch"]              {channel="mqtt:topic:desk:wake_up"}
Switch                      Schreibtisch_M                                     "Schreibtisch M"                                                                                                                                                                            (gSchreibtisch)                                            ["Switch"]              {channel="mqtt:topic:desk:m"}
Number                      Schreibtisch_Height                                "Schreibtisch Height"                                                                                                                                                                       (gSchreibtisch)                                  ["Measurement"]         {channel="mqtt:topic:desk:height"}
Number                      Schreibtisch_Wifi_Signal                           "Schreibtisch Wifi Signal"                                                                                                                                                                  (gSchreibtisch)                                            ["Measurement"]         {channel="mqtt:topic:desk:wifi_signal"}
Number                      Schreibtisch_Uptime                                "Schreibtisch Uptime"                                                                                                                                                                       (gSchreibtisch)                                            ["Duration"]            {channel="mqtt:topic:schreibtisch:uptime"}

I think this is a great opportunity to make the smart desk even smarter. But sadly there is some hardware necessary which is, in my opinion, the hardest part of the implementation. I hope you have fun with this little project and integrating your FlexiSpot desk :slight_smile:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.