How to Switch WordClock via HTTP and Input Text via UI or Automation

Hi everyone, I have a Word Clock with a WS2812
https://www.mikrocontroller.net/articles/WordClock_mit_WS2812#STM32_WordClock_Software

I would like to switch this on/off via Homeassistant, which I have already implemented via configuration.yaml

switch:
  - platform: command_line
    switches:
      wordclock:
        command_on: "/usr/bin/curl -X GET http://10.0.2.214/?action=poweron"
        command_off: "/usr/bin/curl -X GET http://10.0.2.214/?action=poweroff"
        value_template: '{{ value == "1" }}'
        friendly_name: Wordclock

Now I would also like to pass texts or values to start a ticker or dim the clock, the commands are:

Ticker http ://10.0.2.214/?ticker=Text&action=saveticker
Brightness: Value 0- 10: http ://10.0.2.214/display?brightness=10&action=savebrightness

Unfortunately I can’t do it, who can help me?

wordclock:
  input_text:
    ticker:
  rest:
    - authentication: basic
      scan_interval: 60
      resource_template: "http:// 10.0.2.214/?ticker={{ states('input_text.sa_site_id') }}sste&action=saveticker"

Welcome to the forums.

Have a read of the post linked below, especially item 11 about formatting. YAML is indent sensitive and to assist people in helping, you should use the “formatted text” tags when posting, so they can read your yaml correctly.

Okay sorry

Not sure what this is here? Shouldn’t you configure a RESTful switch to pass your input_text to the Wordclock endpoint?

Or is there a Wordclock custom component you are using?

Yes I want to use the RESTful switch, no custom component. I don’t know how to put the input text into the REST command as a variable. I also have trouble creating an input slider for the brightness setting.

If you aren’t interested in any returned value from doing the settings maybe shell_command is the way to go. Not having a WordClock or the API - this is a guess based on your post:

shell_command: 
  wc_set_text: "/usr/bin/curl -X GET http:// 10.0.2.214/?ticker={{ states('input_text.sa_site_id') }}sste&action=saveticker"
  wc_set_brightness: # insert brightness etc

These days I create helpers like input_text and input_number in the GUI - but if you want to do them in YAML the examples are in the docs.

input_number:
  wc_brightness:
    name: "WordClock Brightness"
    initial: 30
    min: 1
    max: 100
    step: 1

input_text:
  sa_site_id:
    name: "WordClock Message"
    initial: ""

Then automations to update on change of value:

automation:
  trigger:
    - platform: state
      entity_id:
        - input_text.sa_site_id
  action:
      service: shell_command.wc_set_text
# etc for other helpers.

ah okay that only works via automation not directly like with a switch

I works by moving a slider in the UI. Nothing more is required apart from the helper and a short automation.

Even if you used a RESTful switch alone, that isn’t going to accept a numeric value.