665436cd910035b25805fa62b63f357c6eeef37e,homeassistant/components/light/zwave.py,ZwaveDimmer,_value_changed,#ZwaveDimmer#Any#,61

Before Change



    def _value_changed(self, value):
         Called when a value has changed on the network. 
        if self._value.value_id == value.value_id:
            // leoc: Since my multilevel switches dim slowly between
            // brightness levels / states, the value_change event does
            // not return the new end state, but rather the state the
            // the switch was at, before changing. Thus we have to wait
            // 2 seconds until the change is done...
            if self._refreshing:
                self._refreshing = False
                brightness, state = brightness_state(value)
                print("Refresh: ", brightness, ", ", state, ", ", self._expect)
                if self._expect is None or self._expect == state:
                    print("Is expected!")
                    self._brightness, self._state = brightness, state
                    self._expect = None
                    self.update_ha_state()
                else:
                    print("Not expected!")
            else:
                self._refreshing = True
                print("Value change: sleeping")
                sleep(2)
                value.refresh()

    @property
    def should_poll(self):
         No polling needed for a light. 
        return False

After Change


                self._value.refresh()

            if self._timer is not None and self._timer.isAlive():
                self._timer.cancel()

            self._timer = Timer(2, _refresh_value)
            self._timer.start()

        self.update_ha_state()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: home-assistant/home-assistant
Commit Name: 665436cd910035b25805fa62b63f357c6eeef37e
Time: 2015-11-10
Author: leoc.git@gmail.com
File Name: homeassistant/components/light/zwave.py
Class Name: ZwaveDimmer
Method Name: _value_changed


Project Name: eth-cscs/reframe
Commit Name: 8a34b72572353e7e4ce18401cdfb8d5cfa6246eb
Time: 2020-09-16
Author: karakasis@cscs.ch
File Name: reframe/core/schedulers/torque.py
Class Name: TorqueJobScheduler
Method Name: poll


Project Name: ClementPinard/SfmLearner-Pytorch
Commit Name: 2a74e12fec206dd222f98cd3ac2a15c48ebdf0a9
Time: 2019-02-18
Author: clement.pinard@parrot.com
File Name: data/prepare_train_data.py
Class Name:
Method Name: main