#Why is publishing mqtt changing brightness different then using light.on service?

1 messages · Page 1 of 1 (latest)

restive parcel
#

i have the following 2 yaml's for automations, and the mqtt lowers brightness by a ton, but looks the same. whats going wrong here?
The mqtt publish that lowers brightness by a ton:

metadata: {}
data:
  evaluate_payload: false
  qos: 0
  retain: false
  topic: zigbee2mqtt/Living Room Cherry Blossom Painting/set
  payload: >-
    {"brightness": {{ states('input_number.living_room_virtual_brightness')|int
    * 0.41}}}

And the light.on service that works normal, much brighter:

  transition: 0
  kelvin: 2963
  brightness_pct: "{{ states('input_number.living_room_virtual_brightness')|int * 0.41}}"
target:
  entity_id: light.living_room_cherry_blossom_painting
enabled: true
action: light.turn_on
plucky storm
#

The top one uses brightness which is a value from 0 to 255. The bottom one uses brightness_pct which is a value from 0 to 100

#

To achieve the same brightness level with the top one, you need to multiply the value with 2.55 (and then convert it to an integer)

restive parcel
#

making it " {"brightness": {{ states('input_number.living_room_virtual_brightness')|int * 0.41 *2.55}}}" seems to have done the trick. dont know how to convert this to a integer.

cunning tide
#

((states('input_number.living_room_virtual_brightness')|int) * 0.41 *2.55} | int(0) (I think the parens are correct).

plucky storm
#

there's a funky } in there

#

(states('input_number.living_room_virtual_brightness') | int * 0.41 * 2.55) | round | int is what I would do

cunning tide
#

I was typing it on mobile lol I had a feeling the parens was off.

modern fox
#

Oh, thanks discord for loading all those missing messages after I reply

cunning tide
#

Better late than never 🤣

#

HATE when that happens too.

modern fox
#

So freakin annoying