# Random color for Ikea bulbs via the Ikea button

**URL:** <https://community.homey.app/t/random-color-for-ikea-bulbs-via-the-ikea-button/114776>\
**Category:** Flows\
**Created:** [August 21, 2024, 5:59pm UTC](https://community.homey.app/t/random-color-for-ikea-bulbs-via-the-ikea-button/114776 "2024-08-21T17:59:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dudu\_95](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dudu_95/32/93061_2.png) [@dudu\_95](https://community.homey.app/u/dudu_95)\
**Post date:** [August 21, 2024, 5:59pm UTC](https://community.homey.app/t/random-color-for-ikea-bulbs-via-the-ikea-button/114776/1 "2024-08-21T17:59:32Z")

</div>

I would like to create a flow that, when the left Ikea button is pressed, selects a random color and applies it to the specified bulb. However, when I click the button, a random number is selected, but the bulb doesn’t change color. I think the issue is that the “°” symbol is missing after the number, and I can’t add it. Is there another solution?

Previously, I created a flow using the “generate a random color” card for Ikea bulbs, but this flow generates a different color for each bulb. I would like a random generation that applies the same color to both of my bulbs.

 ![CleanShot 2024-08-21 at 19.51.53@2x](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/d/4dd8876aedbcb5401fb1c2a8a33341b5c1e1c3f1.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [August 21, 2024, 10:34pm UTC](https://community.homey.app/t/random-color-for-ikea-bulbs-via-the-ikea-button/114776/2 "2024-08-21T22:34:10Z")

</div>

Here you’ll find the _real_ values used by capabilities  
[https://tools.developer.homey.app/tools/devices](https://tools.developer.homey.app/tools/devices)  
You will find there is no color capability number greater than 1, so 360 is not gonna work. It should be “between 0 and 1”

> ![Screenshot from 2024-08-22 00-27-30](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/4/b454c1111d6c5343aaf3fc8d31d95384b09f4618.png)

You can use the card’s red dot for error messages, so use it I’d say!  
 ![Screenshot from 2024-08-22 00-33-06](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/8/e8a41b56f2983e6eea401a50b57e0662e11ffef0.png)

> [@dudu\_95](#):
>
> the “°” symbol

No, there shouldn’t be anything used but numeric values

---

<div class="post-metadata">

**Author:** ![dudu\_95](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dudu_95/32/93061_2.png) [@dudu\_95](https://community.homey.app/u/dudu_95)\
**Post date:** [August 22, 2024, 12:45pm UTC](https://community.homey.app/t/random-color-for-ikea-bulbs-via-the-ikea-button/114776/3 "2024-08-22T12:45:27Z")

</div>

Even though I generate a random value between 0.00 and 0.99, it always selects either 0 or 1. I found another solution using a script, and it works.

![CleanShot 2024-08-22 at 14.38.48@2x](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/b/3b8fc47916d8b64319f746ca90903fcaeebde35f.png)

```auto
const nb_aleatoire = Math.floor(Math.random() * 100) / 100;
return nb_aleatoire;

```

 ![CleanShot 2024-08-22 at 14.45.00@2x](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/5/35893e8e496700e812f3a90c64bdb0d919f7510f.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [August 22, 2024, 1:40pm UTC](https://community.homey.app/t/random-color-for-ikea-bulbs-via-the-ikea-button/114776/4 "2024-08-22T13:40:19Z")

</div>

I think you should let the “Custom logic” app developer know you found a bug.  
That card probably only works with zero digits now.

This is also a way to accomplish it

> ![1000033272](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/2/924660fd3d694d7bea7acf251a32f7ca81a68d14.jpeg)

Value check:

> ![1000033268](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/b/cbde095766602affcf12208f8bfbd560a677b4f9.jpeg)
