Introduced support for Passive DPS devices, restoring state after power off, and NumberEntity enhancements
This release adds some features and addresses some issues introduced by HA updates. A number of these changes are focused around 'passive DPS' devices; which require a known DPS to be set to a valid value before they will start being returned as part of the status updates. I've debugged the communications between the Tuya App and the device (in my case an Arlec Security Light) and this is how the device is initialised.
Incorporated zombie fix changes from PR #817 and #491 as in further testing with Kogan and Arlec devices, the RESET command was needed to make these 'wake up' when they are disconnected from the internet.
The exact DPIDs passed to the RESET command need to be exactly correct or the devices don't wake up. So a configuration item was added to allow a user to specify the DPIDs to be used to RESET the device, which should allow this change to work with a wider variety of devices. The real credit for this change goes to @Elendilon who did the initial RESET implementation and @lloydw who did a recent port of changes, which made it a lot easier to integrate into this service.
With the Zombie and passive device changes in this PR, it was possible to successfully test/integrate the following devices without them requiring internet access:
Arlec Security Light - MAL315HA
Arlec Smart Plug-in Socket PC399HA
Kogan Smart Powerboard
Kogan Smart PowerPlug with USB
New Features:
Manually specify DPS to setup - used where automatic detection doesn't work.
Manually specify DPS to be used in RESET command - used when device doesn't respond to status requests
Specify default value - Used to initialise a device when reconnecting/after power loss. If not specified, the entity type will default to an appropriate value (either off, a minimum value, or the first state in a select)
Restore state on reconnect - Used to restore the state last seen by HA when a device reconnects. This is useful where a device doesn't persist states between power offs. Currently configured for basic entities (Switch, Number, Select), but can be extended to others in the future.
Step size to NumberEntity - Allow configuring the increment between numbers.
Thank you @sibowler (and all the other mentioned contributors) for the huge work!!