Home Assistant Community

Make a +/- switch for a number of scripts


I have a airconditioner that I control with broadcom IR-codes. I have multiple scripts for a number of temperatures, currently from 20C to 25C.

Now I want a switch that can increase or decrease the temperature setting on the AC by one degree each activation.

Is there any component for this or can it be done by some scripting?

In the end I want an automation that can increase the innertemp by one click if the temperature drops below a certain value.


You could set up an input_number with the range:

   min: 20
   max: 25
   step: 1

Then you could have a script trigger on state change of your input_number and turn on the corresponding broadcom switch. There is also a custom component that works in a similar way with remote control codes to control an aircon. I’ll see if I can find the link.


This is the one I was thinking of: https://github.com/vpnmaster/homeassistant-custom-components


Thanks! So if I put all my IR-codes inside the ini-file I should be abe to call them with the broadlink climatecomponent. But where do I put the files on my hassio? :thinking:


Sorry, I am not using hassio, so no clue.


Found another thread about it here, I’ll do some reading


I’ve got the custom-climate-broadcom-component working nicely now. But I’m still stuck with my initial problem. How to make an incremental switch that will +1 och -1 depending on my temperature

I want my AirConditioner to keep temp between 22-23 in my house. Now I figured I could do this in the template-section with this code:

{{ states.climate.fujitsu.attributes.temperature + 1 }} 
{{ states.climate.fujitsu.attributes.temperature - 1 }}

The only problem now is I dont know how to call these rows in an actual automation… or switch template??

Can anyone help?


I finally figured out how to make a working automation of this, the problem now is that when it triggers it does so like 15 times instead of just one time… thus lowering my climate way to much… feels like its stuck in a loop… anyone got any ideas?

Automation looks like this:

- alias: MANUAL - Climate Decrement
  initial_state: 'off'
    platform: time
    hours: '/1'
    minutes: 41
    - condition: numeric_state
      entity_id: 'sensor.vardagsrum_temperature'
      above: 23
    service: climate.set_temperature
    entity_id: climate.fujitsu
      temperature: "{{ states.climate.fujitsu.attributes.temperature|int - 1 }}"

I also get a number of errors in the log:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/configparser.py”, line 789, in get
value = d[option]
File “/usr/local/lib/python3.6/collections/init.py”, line 883, in getitem
return self.missing(key) # support subclasses that define missing
File “/usr/local/lib/python3.6/collections/init.py”, line 875, in missing
raise KeyError(key)
KeyError: ‘high_15’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/service.py”, line 288, in _handle_service_platform_call
await func(entity, data)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/init.py”, line 574, in async_service_temperature_set
await entity.async_set_temperature(**kwargs)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/climate/broadlink.py”, line 281, in set_temperature
File “/config/custom_components/climate/broadlink.py”, line 166, in send_ir
command = self._commands_ini.get(section, value)
File “/usr/local/lib/python3.6/configparser.py”, line 792, in get
raise NoOptionError(option, section)
configparser.NoOptionError: No option ‘high_15’ in section: ‘heat’


Found the error, it tried to do the automation the whole minute, I specified the trigger down to seconds then it worked like a charm!

Clarification. A regular climate component wouldn’t need this, but the custom climate component does only create a climate-gui that you can manually control on the dashboard. It does not regulate the IR-controlled airconditioner automagically since it doesn’t know wich signal to send when the temp drops below a certain value. This automation adds that intelligence. Not that there are many more ppl on the planet that would ask for this kind of solution, but anyway :smiley: