def state_changed(self, state_message):
     Entity.state_changed(self, state_message)
     
     state = state_message[0]
     if state == 0x00:
         if 0 != self.state_value:
             self.set_state(STATE_OFF, 0)
             return True
     elif state == 0x01:
         if 1 != self.state_value:
             self.set_state(STATE_ON, 1)
             return True
     
     return False
 def state_changed(self, state_message):
     Entity.state_changed(self, state_message)
     
     state = state_message[0]
     if 0x00 < state < 0xFF:
         state = int(round((state * 100.0) / 255.0))
         if self.state_value != state:
             self.set_state(STATE_ON, state)
             return True
     elif state == 0x00 and 0 != self.state_value:
         self.set_state(STATE_OFF, 0)
         return True
     elif state == 0xFF and 100 != self.state_value:
         self.set_state(STATE_ON, 100)
         return True
     
     return False