Enocean Custom_Component Help

Hi everybody,

I’m new in Enocean world, and try to make more user friendly the Enocean Binary_sensor component.

To test the new profils of my buttons and my project, I made a custom_component.
The problem is after a certain number (not the same every time) of pression on my buttons, I have this error and my custom_component stop working:

WARNING (Thread-2) [enocean.protocol.packet] Replacing Packet.optional with default value.

I don’t understand why I have this error… and I’m absolutely the coder…

I replaced the value in “official” code (https://github.com/home-assistant/home-assistant/blob/d4bd5a180ce9c7dc39b0a00000307148ca6b6303/homeassistant/components/enocean/binary_sensor.py) with this

    def value_changed(self, packet):

        """EEP: F6-02-02 - Nodon Soft Remote"""
        if packet.rorg == 0xF6:
            press = packet.data[1]
            if press == 0x70:
                self._state = 4
                self.schedule_update_ha_state()
                time.sleep(2)
                self._state = 0 """The state return to 0 after 2s to simulate the pression of buttons"""
                self.schedule_update_ha_state()
            elif press == 0x50:
                self._state = 3
                self.schedule_update_ha_state()
                time.sleep(2)
                self._state = 0
                self.schedule_update_ha_state()
            elif press == 0x30:
                self._state = 2
                self.schedule_update_ha_state()
                time.sleep(2)
                self._state = 0
                self.schedule_update_ha_state()
            elif press == 0x10:
                self._state = 1
                self.schedule_update_ha_state()
                time.sleep(2)
                self._state = 0
                self.schedule_update_ha_state()

        """EEP: D2-03-0A - Nodon Soft Button"""
        if packet.rorg == 0xD2:
            press = packet.data[2]
            if press == 0x01:
                self._state = 1
                self.schedule_update_ha_state()
                time.sleep(2)
                self._state = 0 
                self.schedule_update_ha_state()
            elif press == 0x02:
                self._state = 2
                self.schedule_update_ha_state()
                time.sleep(2)
                self._state = 0
                self.schedule_update_ha_state()
            elif press == 0x03:
                self._state = 3
                self.schedule_update_ha_state()
                time.sleep(2)
                self._state = 0
                self.schedule_update_ha_state()

Thank you in advance to your advice on my error ! :slight_smile: