clockwise icon indicating copy to clipboard operation
clockwise copied to clipboard

[Feature Request] Integration with Home Assistant

Open jorgeassuncao opened this issue 2 years ago • 2 comments

Is it possible to integrate the Clock with Home Assistant? Being based on ESPhome i believe it would be realy simple to do.

At the moment when trying to integrate it with HA this is the result

image

jorgeassuncao avatar Oct 03 '23 11:10 jorgeassuncao

Hi Jorge. This is an interesting feature that I didn't work yet. I agree that it won't be difficult to add it. For now, I think you can use the endpoints available on Clockwise to do a basic integration with Home Assistant https://clockwise.page/docs/api

jnthas avatar Oct 08 '23 16:10 jnthas

@jorgeassuncao

I created 2 rest_command in my HA yaml

rest_command:
  clockwise_set_display_brightness:
    url: "http://<CLOCKIP>/set?displayBright={{ brightness }}"
    method: POST
  clockwise_restart:
    url: "http://<CLOCKIP>/restart"
    method: POST
    content_type: "application/x-www-form-urlencoded"

You can then execute the services using

service: rest_command.clockwise_set_display_brightness
data:
  brightness: 25
service: rest_command.clockwise_restart

I have then created automations tied into "day and night routines" that will execute the first rest command, setting the brightness to X, sleeping for 2 seconds, then executing the restart service.

Something like this


description: "Turn off clock at 11pm"
mode: single
trigger:
  - platform: time
    at: "23:00:00"
condition: []
action:
  - service: rest_command.clockwise_set_display_brightness
    data:
      brightness: 1
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: rest_command.clockwise_restart
    data: {}

Seems to give a nice way of turning the display on/off via an automation in HA

karl0ss avatar Jan 02 '24 11:01 karl0ss