Creating dimmer (input_number)

Same here. But, it’s an improvement - the last time I tried it just failed completely and wouldn’t even load the (fairly) blank page.

Looks like this corresponds to the following method of the ServiceRegistry class:

Try increasing sleep_time. I’d try at least 1.0, or maybe even more, just to see if that solves the problem. Then you can try lower numbers until you find something reasonable.

have you tried calling this service from the services tab? Because this method and the last method should work. Also, home assistant is reporting that the service is being called. The only thing that could be the problem is service call itself.

Call the shell command from the service tool:

Yes tried that too. Still no change.

Invalid value: 0.0 (range 10.0 - 100.0)

I think @petro was asking you to try the shell_command.increase_level_office and shell_command.decrease_level_office services.

1 Like

Ups sry, made a screenshot from the wrong service.
I called shell_command.decrease_level_office and shell_command.increase_level_office with no effect. If I call the command line from bash it works well.

Oh, that’s the problem. You have to get these services working from HA, or nothing you do with the automations or scripts will do any good.

1 Like

OMG! Got it.
The problem was that I was not able to call shell_command with inline commands. I had to refer to a shell script including the command.

THANK YOU! I love you guys. You are my real heroes!

shell_command:
  decrease_level_office: /home/homeassistant/.homeassistant/shell_scripts/light/office_bright.sh
  increase_level_office: /home/homeassistant/.homeassistant/shell_scripts/light/office_light.sh
1 Like

I try to make similar automation for fan speed.

Why I get error in jinja2:

Error rendering template: UndefinedError: 'trigger' is undefined

Here is automation script:

  - alias: Set fan speed
    trigger:
      platform: state
      entity_id: input_number.kitchen_hood_fanspeed
    condition:
      condition: template
      value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"
    action:
      service: script.adjust_fan_speed
      data_template:
        command: >
          {% if trigger.to_state.state|int > trigger.from_state.state|int %}
            switch.kitchen_hood_fan_up
          {% else %}
            switch.kitchen_hood_fan_down
          {% endif %}
        steps: >
          {{ (trigger.to_state.state|int - trigger.from_state.state|int)|abs }}

script:
  adjust_fan_speed:
    sequence:
      - condition: template
        value_template: "{{ steps|int > 0 }}"
      - service_template: "{{ command }}"
      - service: script.adjust_again
        data_template:
          command: "{{ command }}"
          steps: "{{ steps|int - 1 }}"
  adjust_again:
    - service: script.adjust_fan_speed
      data_template:
        command: "{{ command }}"
        steps: "{{ steps }}"