custom_components/vizio/media_player.py
def update(self):
        """Retrieve latest state of the device."""
        is_on = self._device.get_power_state()

        if is_on:
            self._state = STATE_ON

            volume = self._device.get_current_volume()
            if volume is not None:
                self._volume_level = float(volume) / self._max_volume

            input_ = self._device.get_current_input()
            if input_ is not None:
                self._current_input = input_.meta_name

            inputs = self._device.get_inputs()
            if inputs is not None:
                self._available_inputs = [input_.name for input_ in inputs]

        else:
            if is_on is None:
                self._state = None
            else:
                self._state = STATE_OFF

            self._volume_level = None
            self._current_input = None
            self._available_inputs = None
def update(self):
        """Retrieve latest state of the device."""
        is_on = self._device.get_power_state()

        if is_on:
            self._state = STATE_ON

            volume = self._device.get_current_volume()
            if volume is not None:
                self._volume_level = float(volume) / self._max_volume

            input_ = self._device.get_current_input()
            if input_ is not None:
                self._current_input = input_.meta_name

            inputs = self._device.get_inputs()
            if inputs is not None:
                self._available_inputs = [input_.name for input_ in inputs]

        else:
            if is_on is None:
                self._state = None
            else:
                self._state = STATE_OFF

            self._volume_level = None
            self._current_input = None
            self._available_inputs = None
def update ( self ) : is_on = self . _device . get_power_state ( ) if is_on : self . _state = STATE_ON volume = self . _device . get_current_volume ( ) if volume is not None : self . _volume_level = float ( volume ) / self . _max_volume input_ = self . _device . get_current_input ( ) if input_ is not None : self . _current_input = input_ . meta_name inputs = self . _device . get_inputs ( ) if inputs is not None : self . _available_inputs = [ input_ . name for input_ in inputs ] else : if is_on is None : self . _state = None else : self . _state = STATE_OFF self . _volume_level = None self . _current_input = None self . _available_inputs = None
Retrieve latest state of the device.
Retrieve latest state of the device .