artem-sedykh / mini-humidifier

Minimalistic humidifier card for Home Assistant Lovelace UI
MIT License
155 stars 26 forks source link

Levoit Classic 300S Humidifier #124

Open Scope666 opened 5 months ago

Scope666 commented 5 months ago

Hi,

I mostly have this card working, I just can't figure out how to control the night light.

It's a separate entity_id in the integration: light.classic300s_night_light

type: custom:mini-humidifier
entity: humidifier.classic300s
indicators:
  humidity:
    icon: mdi:water
    unit: '%'
    source:
      entity: sensor.classic300s_current_humidity
buttons:
  led:
    icon: mdi:lightbulb-on-outline
    order: 2
    type: dropdown
    entity_id: light.classic300s_night_light
    state:
      attribute: brightness
    source:
      '0': '80'
      '1': '50'
      '2': 'Off'
    active: state => (state !== 2 && state !== '2')
    change_action: |
      (selected, state, entity) => {
        const options = { entity_id: entity.entity_id, brightness: selected };
        return this.call_service('light', 'turn_on', options);
      }

I'm not really a coder, so I know what I have for the LED / Light is wrong.

Any advice for modifying to call light.turn_on and adjust brightness ?

image
regevbr commented 5 months ago

just practice the service call in the dev dashboard and see what works for you