Sha256: 95358f537224d5f0a83cf62047641e92a5ad988f5169956980735b166c3cabc4
Contents?: true
Size: 631 Bytes
Versions: 1
Compression:
Stored size: 631 Bytes
Contents
# frozen_string_literal: true require_relative '../../shared/events/base' module Wizrb module Lighting module Events class SetBrightnessEvent < Wizrb::Shared::Events::Base MIN_VALUE = 10 MAX_VALUE = 100 def initialize(value) validate!(value) super(method: 'setState', params: { dimming: value.to_i }) end private def validate!(value) return if value && value >= MIN_VALUE && value <= MAX_VALUE raise ArgumentError, "Brightness must be an integer between #{MIN_VALUE} and #{MAX_VALUE}" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wizrb-1.1.2 | lib/wizrb/lighting/events/set_brightness_event.rb |