Problem with brightness on Yeelight platform

Hi,

I have a problem getting and setting the brightness on a yeelight bulb… I use the script below:

  - service: light.turn_on
    entity_id: light.kitchen_light_1
    data_template:
      brightness: "{{ states.light.kitchen_light_1.attributes.brightness - 25 }}"

This works great for another light, but the yeelight seems to give back a brightness value with 2 or more decimals…

When i check the light in states I see the following:

light.living_room_light_1 on
brightness: 206.55
color_temp: 316
min_mireds: 153
max_mireds: 588
rgb_color: 255,67.92041905680745,0
xy_color: 0.654,0.342
effect_list: Disco,Slow Temp,Strobe epilepsy!,Strobe color,Alarm,Police,Police2,Christmas,RGB,Random Loop,Fast Random Loop,Slowdown,WhatsApp,Facebook,Twitter,Stop
friendly_name: Kamer licht 1
supported_features: 127
google_assistant: true
google_assistant_name: Living room light 1

This is the error in the log:

2017-11-20 19:49:45 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: expected int for dictionary value @ data[‘brightness’]. Got ‘231.55’

Why is this? Is there a way to remove the decimals?

can’t you do something like…

{{ (states.light.kitchen_light_1.attributes.brightness | round(0)) - 25 }}

Yes this works, thanks!