ESPHome + Hubitat

Cool! I'll order one and can be the guinea pig, in case others are interested in automating a desk :slightly_smiling_face:

1 Like

Hey @jonathanb - my Upsy Desky controller came in today. I managed to get it connected to my internet, have the IP address reserved, and can control my desk from the ESPHome's web interface from the Upsy Desky's IP address... All good signs so far!

I've been trying to get it added to HE now. I have been following your Toolkit instructions, and I think the only thing I need to flush out is the driver code... I tried drafting some based on your ButtonSwitch.groovy code to adapt the Upsy Desky base code, but I'm not having the best of luck with it... Any chance you could help with the driver code?

If it helps, here's a screenshot of the web interface:

Essentially, I'm hoping to have HE be able to do is:

  • read the current Desk Height;
  • hit the Preset 1, 2, 3, 4 buttons set via the keypad;
  • buttons to raise/lower the desk;
  • set the Target Desk Height manually;
  • restart the Upsy Desky device; and
  • turn the Status LED on/off.

Any help/guidance would be much appreciated!

Yes, let me get something basic working that can then be customized this week :slight_smile:

1 Like

Looks like there is one entity in there that I never coded support for, I think its the dropdown selection. Should not be difficult to add that into the ESPHome library.

I don't see specific controls for raise/lower desk, I see we can send a specific height to the device, what were you thinking when you said raise/lower buttons would do?

I believe the up/raise and down/lower buttons would be tied to lines 33 and 34 in the base code?

So essentially, press and hold on the "raise" button would raise the desk until you let go. Press and hold the "lower" button would lower the desk until you let go. Not sure if that's possible in HE's device page/on Dashboards, etc... I know I mimic that control in Button Controller with Pico remotes for lights.

Ok I have a basic driver for testing. You can set the position value or use the buttons (1-4) with the push command for presets, or with the hold to set.

You will need both the updated ESPHome library from:
https://raw.githubusercontent.com/bradsjm/hubitat-public/development/ESPHome/ESPHome-API-Library.groovy

And the driver from:
https://raw.githubusercontent.com/bradsjm/hubitat-public/development/ESPHome/ESPHome-UpsyDesky.groovy

It does not look like the ESPHome template exposes the up and down directly, should be possible to add that however with some updated YAML.

Incredible, thanks @jonathanb!

Here's what it looks like for me:


I can confirm the following works:

  • Current States lists the current height of the desk.
  • By inputting 1, 2, 3, or 4, I can "Push" my preset heights 1, 2, 3, and 4.
  • By manually typing in a height, I can "Set Position" (within the min and max of the desk's allowance).
  • "Restart" causes the Upsy Desky to reboot safely.
  • Pressing "On" turns the status LED on and "Off" turns the status LED off.

Basically, for what I'm hoping to do with the HE integration, it's wonderful! Thank you again for writing the driver code (and the ESPHome integration)!

The only feedback I can provide is:

  • It's not clear via the Current States or in the On/Off Commands that the switch is turning the status LED on/off - I'm not sure if you can add any context to the On/Off buttons or the "switch" indicator in the Current States that the Status LED is what it's controlling?
  • Typing in 1, 2, 3, or 4 and then clicking on the Hold button seems to be correlating to the "Set Preset" buttons on the ESPHome page. I think this is useful/should be kept - but again, that's not clear that's what it's doing. Can you add/change anything that indicates "Set Preset" instead of "Hold"?
  • The only other feature I think would be worthwhile would be buttons correlating to pressing the "Up/Raise" and "Down/Lower" buttons on the controller. I initially wondered if that was what the "Hold" button was intended to do (since we'd messaged about press and hold for raising and lower), but then while testing realized that's not the case (see above point for "Set Preset").

Again, thank you so much!

christina aguilera television GIF by The Voice

1 Like

Good suggestions, I'll add it to my todo list :slight_smile:

1 Like

Updated development branch for the Upsy Desky driver:

https://raw.githubusercontent.com/bradsjm/hubitat-public/development/ESPHome/ESPHome-UpsyDesky.groovy

Changes:

  1. Added custom commands of "Led On" and "Led Off"
  2. Added custom commands of "preset" and "set preset"
  3. Reduced number of events while desk is moving so it waits until the desk stops before updating the new position

Looks like to do the raise/lower will need modifications to the ESPHome yaml to expose those capabilities as buttons in the UI like the presets. Maybe you can ask the developer of the board how to do that?

1 Like

See below for how it displays on HE with the updated driver:

Based on my testsing of the driver, note that the Preset and Push buttons essentially have the same functionality: pushing one of the preset buttons on the control pad. One of those could probably be removed, unless you're intending for those to function differently...

Also, the Hold button, which used to have the functionality of what is now the Set Preset button (confirmed that works), now doesn't do anything/throws this error:

Apparently I didn't completely remove the old buttons, they are gone now :slight_smile:

1 Like

Brilliant! They're gone, and it's all working as intended! Thanks @jonathanb!

Excellent, now what kind of automations are you doing with this new found wizardry over the desk? :slight_smile:

Still kinda early on... Admittedly, I got one to see if I could even get it integrated... Now that I confirmed that/it is, is the fun part of finding automations to pull together!

  • I'd like to integrate it into GH... I've been messing around with that a bit with the GH Community integration, but not having the best of luck with getting the attributes, etc. flushed out to a functional addition to GH (likely raise/lower desk commands to the sitting/standing position).
  • I'm thinking I'll incorporate setting it back down to the seated position each night during the bedtime routine to "reset" it for the next day.
  • I've seen some people raising their desk out of the way when their robot vacuum was running to get dangling cords out of the way... I have all my cords controlled, so that's not really useful for me. But I can see it being beneficial.
  • If HE would add actionable notifications to their phone app, I'd add notifications like "You've been sitting for 45 minutes. Would you like to raise the desk?" and then have it raise if Yes or stay in the current position if No... For now, will likely do just a notification like "FYI, you've been sitting at the desk for 45 minutes."
  • Alternatively, you could automate it to automatically raise/lower while you're working (e.g., sitting for 40 minutes, raised for 20 minutes, repeat).
  • You could have different presets set for different members of the household... So like have the presets reprogrammed/updated based on who's using the desk (maybe controlled with a Stream Deck).

I'm sure in time, I'll come up with other quirky automations!

1 Like

Integration with your work chat app. Meetings come along, and it automatically forces you to stand for the meeting. Studies show that people tend to concentrate more when standing.

Or: Chaotic Neutral... "The desk will move to the standing position in 5... 4... 3..." at a random interval between 1 and 45 minutes after you have been sitting for too long. If you try to override it, it lets you... For about ten seconds, then it moves back to where it wanted to be. A presence sensor on your PC showing user activity can be used to instigate this timer only when you're actually on the PC.

1 Like

@jonathanb I recently tried to add uptime sensor to your MultiSwitch driver and it did not work. Then to revert, I did a raw import of the driver on github site. Now, the multiswitch child devices work, but the rssi (signalstrength) is no longer updating. I tried changing device driver to 'device' to clean the states and then switched back to proper device driver, now there is no rssi: state at all and it only has:

State Variables

  • requireRefresh : true

Actually got the rssi to show back up by recompiling the device with a change that would affect the structure, in this case, changed logging level. Then, uploaded the new firmware. After it synced to the Parent device in HE, the rssi state variable returned and is logging.

@jonathanb still if you have time, can you include an uptime sensor on the MultiSwitch driver:

  - platform: uptime
    name: "System Uptime"
    id: system_uptime
    filters:
      - lambda: return x / 3600;
    unit_of_measurement: "hours"
    accuracy_decimals: 2

@jonathanb this may be a dumb question but would there be any way of using a Tile BLE tracker to monitor a person arriving and departing from their home with an ESP32 and your drivers? Thanks.

It is possible to do, ESPHome should be able to receive it and you could set up a field to track presence in ESPHome and publish it in Hubitat.

Another option would be to use OpenMqttGateway on an ESP32 to publish the state to MQTT (if you have MQTT set up already) and then use an MQTT driver to get the state. One advantage is that gateway has a ton of devices it supports.

1 Like

@jonathanb There is an update available ESPHome 2023.5.0 Will updating to this version break anything?