hassio yaml save lovelace convert

 avataruser_3364516
Publica year ago7 Snippets
Search
Language
Sort by
📅 Created Date
Order
try:
    import simplejson as json
except ImportError:
    print('simplejson missing, install with "pip install simplejson"')
try:
    import yaml
except ImportError:
    print('yaml missing, install with "pip install pyyaml"')

READFILE = r"E:\hassio\dailies\scratch\lovelace"
WRITEFILE = r"E:\hassio\dailies\scratch\lovelace_todays.yaml"


def convert():
    """Start convertion."""
    try:
        lljson = open(READFILE, "r+")
        lldata = json.load(lljson)
        lljson.close()
        llyaml = open(WRITEFILE, "w+")
        yaml.dump(lldata["data"]["config"], llyaml, default_flow_style=False)
        llyaml.close()
        print("Convertion done!")
    except Exception as error:  # pylint: disable=broad-except
        errormsg = "Something went wrong - {}".format(error)
        print(errormsg)


convert()
@echo off
set "source=E:\hassio\dailies\scratch"
set "destination=E:\hassio\dailies"

REM Get the current date in YYYYMMDD format
for /F "tokens=1-3 delims=/ " %%a in ('date /T') do set "date=%%b-%%c-%%a"
REM "date=%%c%%b%%a"

REM Create a folder with the current date as the title
mkdir "%destination%\%date%"

REM Move files with "lovelace" in the name to the created folder
move "%source%\*lovelace*" "%destination%\%date%"

echo Files moved to "%destination%\%date%\" folder.





lovelace_2_convert_py.bat

batchfilea year ago
@echo off
"C:\Users\SSD-PC\AppData\Local\Programs\Python\Python39\python.exe" "C:\Program Files (x86)\EventGhost\others\move_files\py_scripts\g_lovelace_default_convert.py"

lovelace_1_get_copy.bat

batchfilea year ago
@echo off
set "source=\\192.168.1.114\config\.storage"
set "destination=E:\hassio\dailies\scratch"

REM Get the current date in YYYYMMDD format
REM for /F "tokens=1-3 delims=/ " %%a in ('date /T') do set "date=%%c%%b%%a"

REM Create a folder with the current date as the title
REM Rmkdir "%destination%\%date%"

REM Move files with "lovelace" in the name to the created folder
copy "%source%\*lovelace*" "%destination%"

echo Files copied to "%destination%" folder.





@echo off
set "source=\\192.168.1.114\config\.storage"
set "destination=E:\hassio\dailies"

REM Get the current date in YYYYMMDD format
for /F "tokens=1-3 delims=/ " %%a in ('date /T') do set "date=%%b-%%c-%%a"
REM "date=%%c%%b%%a"

REM Create a folder with the current date as the title
mkdir "%destination%\%date%"

REM Move files with "lovelace" in the name to the created folder
copy "%source%\core.config_entries" "%destination%\%date%"
copy "%source%\core.device_registry" "%destination%\%date%"
copy "%source%\core.entity_registry" "%destination%\%date%"
copy "%source%\core.label_registry" "%destination%\%date%"

echo Files moved to "%destination%\%date%\" folder.





  • Total 7 snippets
  • 1
  • 2