al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.59k stars 654 forks source link

File name Windows compatibility #1050

Open jlssmt opened 1 year ago

jlssmt commented 1 year ago

Hello, Windows is not able to create filenames with a : in them. Maybe it is possible to change them?

f.e.: hass\config\.storage\xiaomi_miot\urn:miot-spec-v2:device:fan:0000A005:dmaker-p15:1.json

Thanks 😉

al-one commented 1 year ago
python -c "import platform; print(platform.system())"

Please get your system platform through this shell. This component already handles filename for Windows.

https://github.com/al-one/hass-xiaomi-miot/blob/28881ec5a6ed0bd708c0ffa5fb0af01406015a49/custom_components/xiaomi_miot/core/miot_spec.py#L295-L299

jlssmt commented 1 year ago

My system is on Linux. I backup to different locations like windows. Is it possible to switch to underscore always?

al-one commented 1 year ago

You can remove all files in the .storage/xiaomi_miot directory before restoring the backup. Maybe I'll replace it with an underscore in the future.