Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes it easier for developers without a real test device to perform some development and testing on device integrations.
To use the simulator, one needs to create a definition file with available properties, their types, initial values and methods that can be used to change them.
Uses currently pydantic for file parsing, the imports should be guarded if a new dependency for non-developers is unwanted.
These files could be later on used for unit-testing the implementations without custom test files, and maybe more (creating list of supported models, ..).
At the moment, this basic implementation only allows simulating devices that use get_prop for getting the properties and a single setter to change their state.
The token is currently hardcoded to full of 0s.
The MAC address will be generated using the model name to allow make instances on the same host unique (e.g., for homeassistant testing).
Example usage:
miiocli devtools miio-simulator --file zhimi_fan.yaml --model zhimi.fan.v2
TBD: