# Adding and subtracting brightness in steps

**URL:** <https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971>\
**Category:** eWeLink CUBE\
**Tags:** ihost\
**Created:** [January 8, 2025, 1:04am UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971 "2025-01-08T01:04:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![karel.novotny](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@karel.novotny](https://forum.ewelink.cc/u/karel.novotny)\
**Post date:** [January 8, 2025, 1:04am UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/1 "2025-01-08T01:04:27Z")

</div>

Hello,  
in the ihost system with 4 buttons assigned, can you set it so that in addition to the on/off function, the buttons can also be used to control the brightness in steps (gradually) - I only found a step for a predefined % of brightness. I can’t set it so that the brightness increases or decreases according to the number of presses

thank you

---

<div class="post-metadata">

**Author:** ![SuiKa](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/suika/32/8656_2.png) [@SuiKa](https://forum.ewelink.cc/u/SuiKa)\
**Post date:** [January 8, 2025, 12:33pm UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/2 "2025-01-08T12:33:22Z")

</div>

Do you mean by two device controling each other?  
One is button and the other one is light.

---

<div class="post-metadata">

**Author:** ![karel.novotny](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@karel.novotny](https://forum.ewelink.cc/u/karel.novotny)\
**Post date:** [January 8, 2025, 2:12pm UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/3 "2025-01-08T14:12:15Z")

</div>

Yes, one is a button and the other is a light. The light has the function of changing color temperature and brightness.

---

<div class="post-metadata">

**Author:** ![SuiKa](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/suika/32/8656_2.png) [@SuiKa](https://forum.ewelink.cc/u/SuiKa)\
**Post date:** [January 9, 2025, 2:09am UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/4 "2025-01-09T02:09:54Z")

</div>

We don’t have such function in iHost for now.  
Smart scene only supports certain percentage of brightness.

If you want a more customize automation, node-red add-on would be a better choice.  
A simple combination of event-state node, switch node and control-device node would do the trick.

---

<div class="post-metadata">

**Author:** ![SuiKa](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/suika/32/8656_2.png) [@SuiKa](https://forum.ewelink.cc/u/SuiKa)\
**Post date:** [January 9, 2025, 2:14am UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/5 "2025-01-09T02:14:20Z")

</div>

Please refer to here: [【Add-on Guide】Node-red](https://forum.ewelink.cc/t/add-on-guide-node-red/15505)

Play with it and give me a holler if you bump into any problem.

---

<div class="post-metadata">

**Author:** ![eerke](https://avatars.discourse-cdn.com/v4/letter/e/eb9ed0/32.png) [@eerke](https://forum.ewelink.cc/u/eerke)\
**Post date:** [January 9, 2025, 10:39am UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/6 "2025-01-09T10:39:54Z")

</div>

In the control device node there has to be a set amount to turn on. In contrast to real devices virtual devices have a “put device state” node. Is there a way to replicate the “put device state” node for real devices? For instance the brightness level could be stored as a variable and added to a template node before “a put device state” node. If there is way to do this with a real device I have not found it. Maybe an HTTP out calling an interface with the API?

---

<div class="post-metadata">

**Author:** ![SuiKa](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/suika/32/8656_2.png) [@SuiKa](https://forum.ewelink.cc/u/SuiKa)\
**Post date:** [January 10, 2025, 8:35am UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/7 "2025-01-10T08:35:09Z")

</div>

> [@eerke](#):
>
> Is there a way to replicate the “put device state” node for real devices? For instance the brightness level could be stored as a variable and added to a template node before “a put device state” node.

That’s not a bad idea.  
We’ve discussed it.  
We’ll add a switch to toggle Action and JSON state in control-device node.  
If it’s off, then only JSON state from payload will be send to iHost.

---

<div class="post-metadata">

**Author:** ![eerke](https://avatars.discourse-cdn.com/v4/letter/e/eb9ed0/32.png) [@eerke](https://forum.ewelink.cc/u/eerke)\
**Post date:** [January 10, 2025, 11:12am UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/8 "2025-01-10T11:12:39Z")

</div>

That is a good way to implement it. Some other nodes just allow the msg.payload to set the activation but I think that creates problems because all sorts of things get sent as msg.payload. Requiring a JSON object will hopefully minimise the amount of error types needed to be caught.

Whilst this is being implemented is there an easy way to do this using the HTTP Out node or a Function Node and the Cube API? I had thought about trying this but concluded I’d need to save a separate token somewhere in the flow.

---

<div class="post-metadata">

**Author:** ![SuiKa](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/suika/32/8656_2.png) [@SuiKa](https://forum.ewelink.cc/u/SuiKa)\
**Post date:** [January 13, 2025, 2:19am UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/9 "2025-01-13T02:19:47Z")

</div>

Invoke the token api with some tools like postman, then click the button in iHost, then you’ll have your own token.  
The token will be valid unless the iHost is reset or the total amount of your iHost token exceed 5000.

---

<div class="post-metadata">

**Author:** ![renatoyamane](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@renatoyamane](https://forum.ewelink.cc/u/renatoyamane)\
**Post date:** [January 14, 2025, 4:25pm UTC](https://forum.ewelink.cc/t/adding-and-subtracting-brightness-in-steps/116971/10 "2025-01-14T16:25:27Z")

</div>

The incremental / decremental steps could be very useful for Philips Hue Remote Control because it has brightness control in steps:

 ![3012533_A.eps_High](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/4/479d5d305ecc1de0849bcbbc8fdd83f458fe4105.jpeg)
