diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index dbc9a5cdd..e2ff2f804 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip @@ -39,4 +39,6 @@ jobs: - name: check for changed files run: | git diff --exit-code || (echo "looks like the update_docu_links.py did not run" && false) - \ No newline at end of file + - name: check no custom icon definitions in sources + run: | + ./script/check_icon_use.sh || (echo "looks like some source is not properly configured for icon declaration, check log" && false) diff --git a/custom_components/waste_collection_schedule/const.py b/custom_components/waste_collection_schedule/const.py index 4bbbf6f67..fdfe95639 100644 --- a/custom_components/waste_collection_schedule/const.py +++ b/custom_components/waste_collection_schedule/const.py @@ -1,5 +1,6 @@ """Constants for the Waste Collection Schedule component.""" +from enum import StrEnum from typing import Final # Component domain, used to store component data in hass data. @@ -53,3 +54,21 @@ CONF_SENSORS: Final = "sensors" + + +class Icons(StrEnum): + """Standard icons for sensors.""" + + ICON_BIOHAZARD = "mdi:biohazard" + ICON_CLEAR_GLASS = "mdi:bottle-wine-outline" + ICON_COLORED_GLASS = "mdi:bottle-wine" + ICON_COMPOST = "mdi:food" + ICON_ELECTRONICS = "mdi:desktop-classic" + ICON_GARDEN_WASTE = "mdi:leaf" + ICON_GENERAL_TRASH = "mdi:trash-can" + ICON_LANDFILL = "mdi:delete-empty" + ICON_METAL = "mdi:nail" + ICON_NEWSPAPER = "mdi:newspaper" + ICON_PAPER_PACKAGING = "mdi:package-variant" + ICON_PLASTIC = "mdi:bottle-soda-classic-outline" + ICON_RECYCLE = "mdi:recycle" diff --git a/custom_components/waste_collection_schedule/sensor.py b/custom_components/waste_collection_schedule/sensor.py index c4a81c7f3..c0832fb91 100644 --- a/custom_components/waste_collection_schedule/sensor.py +++ b/custom_components/waste_collection_schedule/sensor.py @@ -20,6 +20,7 @@ ) from .const import ( + Icons, CONF_ADD_DAYS_TO, CONF_COLLECTION_TYPES, CONF_COUNT, @@ -83,15 +84,11 @@ async def async_setup_entry(hass, config: ConfigEntry, async_add_entities): date_template = sensor.get(CONF_DATE_TEMPLATE) try: value_template = cv.template(value_template) - except ( - vol.Invalid - ): # should only happen if value_template = None, as it is already validated in the config flow if it is not None + except vol.Invalid: # should only happen if value_template = None, as it is already validated in the config flow if it is not None value_template = None try: date_template = cv.template(date_template) - except ( - vol.Invalid - ): # should only happen if value_template = None, as it is already validated in the config flow if it is not None + except vol.Invalid: # should only happen if value_template = None, as it is already validated in the config flow if it is not None date_template = None details_format = sensor.get(CONF_DETAILS_FORMAT) if isinstance(details_format, str): @@ -263,7 +260,7 @@ def _set_state(self, upcoming: list[CollectionGroup]): """Set entity state with default format.""" if len(upcoming) == 0: self._value = None - self._attr_icon = "mdi:trash-can" + self._attr_icon = Icons.ICON_GENERAL_TRASH self._attr_entity_picture = None return @@ -279,7 +276,7 @@ def _set_state(self, upcoming: list[CollectionGroup]): f"{self._separator.join(collection.types)} in {collection.daysTo} days" ) - self._attr_icon = collection.icon or "mdi:trash-can" + self._attr_icon = collection.icon or Icons.ICON_GENERAL_TRASH self._attr_entity_picture = collection.picture def _render_date(self, collection: Collection): diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/aberdeenshire_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/aberdeenshire_gov_uk.py index 1c4a7ba0d..ba485b06f 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/aberdeenshire_gov_uk.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/aberdeenshire_gov_uk.py @@ -2,8 +2,12 @@ from bs4 import BeautifulSoup from waste_collection_schedule import Collection # type: ignore[attr-defined] + # Include work around for SSL UNSAFE_LEGACY_RENEGOTIATION_DISABLED error from waste_collection_schedule.service.SSLError import get_legacy_session +from const import ( + Icons, +) TITLE = "Aberdeenshire Council" DESCRIPTION = "Source for Aberdeenshire Council, UK." @@ -15,8 +19,8 @@ "Test_004": {"uprn": 151170625}, } ICON_MAP = { - "Mixed recycling and food waste": "mdi:recycle", - "Refuse and food waste": "mdi:trash-can", + "Mixed recycling and food waste": Icons.ICON_RECYCLE, + "Refuse and food waste": Icons.ICON_GENERAL_TRASH, } PARAM_DESCRIPTIONS = { diff --git a/doc/contributing_source.md b/doc/contributing_source.md index efc31e0fa..494270dab 100644 --- a/doc/contributing_source.md +++ b/doc/contributing_source.md @@ -22,6 +22,7 @@ The script should have the following general structure ```py import datetime from waste_collection_schedule import Collection +from const import Icons TITLE = "My Council" # Title will show up in README.md and info.md DESCRIPTION = "Source script for abc.com" # Describe your source @@ -33,10 +34,10 @@ TEST_CASES = { # Insert arguments for test cases to be used by test_sources.py } API_URL = "https://abc.com/search/" -ICON_MAP = { # Optional: Dict of waste types and suitable mdi icons - "DOMESTIC": "mdi:trash-can", - "RECYCLE": "mdi:recycle", - "ORGANIC": "mdi:leaf", +ICON_MAP = { # Optional: Dict of waste types and suitable icons + "DOMESTIC": Icons.ICON_GENERAL_TRASH, + "RECYCLE": Icons.ICON_RECYCLE, + "ORGANIC": Icond.ICON_COMPOST, } #### Arguments affecting the configuration GUI #### diff --git a/script/check_icon_use.sh b/script/check_icon_use.sh new file mode 100755 index 000000000..f885dea6c --- /dev/null +++ b/script/check_icon_use.sh @@ -0,0 +1,498 @@ +#!/bin/bash + +verbose=true +# if [ "$1" == "-v" ] +# then +# verbose=true +# fi + +checkpath="custom_components/waste_collection_schedule/waste_collection_schedule/source/" + +whitelist=( + "abfall_havelland_de.py" + "abfall_lippe_de.py" + "abfall_lro_de.py" + "abfallkalender_gifhorn_de.py" + "abfallwirtschaft_fuerth_eu.py" + "abfallwirtschaft_pforzheim_de.py" + "abfallwirtschaft_vechta_de.py" + "abfuhrplan_landkreis_neumarkt_de.py" + "abfuhrplan_schwabach_de.py" + "abki_de.py" + "avfallsapp_se.py" + "act_gov_au.py" + "adur_worthing_gov_uk.py" + "affarsverken_se.py" + "afvalstoffendienst_nl.py" + "aha_region_de.py" + "ahe_de.py" + "alchenstorf_ch.py" + "allerdale_gov_uk.py" + "ambervalley_gov_uk.py" + "antrimandnewtownabbey_gov_uk.py" + "api_golemio_cz.py" + "api_hubert_schmid_de.py" + "app_abfallplus_de.py" + "app_my_local_services_au.py" + "apps_imactivate_com.py" + "ardsandnorthdown_gov_uk.py" + "armadale_wa_gov_au.py" + "art_trier_de.py" + "arun_gov_uk.py" + "ashfield_gov_uk.py" + "ashford_gov_uk.py" + "asr_chemnitz_de.py" + "awb_bad_kreuznach_de.py" + "awb_emsland_de.py" + "awb_mainz_bingen_de.py" + "awg_de.py" + "awg_wuppertal_de.py" + "awigo_de.py" + "awlneuss_de.py" + "awm_muenchen_de.py" + "aylesburyvaledc_gov_uk.py" + "bad_eisenkappel_info.py" + "baden_umweltverbaende_at.py" + "ballarat_vic_gov_au.py" + "banyule_vic_gov_au.py" + "barnsley_gov_uk.py" + "basildon_gov_uk.py" + "basingstoke_gov_uk.py" + "bathnes_gov_uk.py" + "bcp_gov_uk.py" + "bedford_gov_uk.py" + "belmont_wa_gov_au.py" + "bexley_gov_uk.py" + "bielefeld_de.py" + "biffaleicester_co_uk.py" + "binzone_uk.py" + "bir_no.py" + "birmingham_gov_uk.py" + "blackburn_gov_uk.py" + "blackpool_gov_uk.py" + "blacktown_nsw_gov_au.py" + "bracknell_forest_gov_uk.py" + "bradford_gov_uk.py" + "braintree_gov_uk.py" + "breckland_gov_uk.py" + "brisbane_qld_gov_au.py" + "bristol_gov_uk.py" + "bromley_gov_uk.py" + "bromsgrove_gov_uk.py" + "broxbourne_gov_uk.py" + "broxtowe_gov_uk.py" + "buergerportal_de.py" + "burnley_gov_uk.py" + "bury_gov_uk.py" + "calgary_ca.py" + "cambridge_gov_uk.py" + "camden_gov_uk.py" + "campbelltown_nsw_gov_au.py" + "canadabay_nsw_gov_au.py" + "cannock_chase_dc_gov_uk.py" + "canterbury_gov_uk.py" + "cardiff_gov_uk.py" + "cardinia_vic_gov_au.py" + "carmarthenshire_gov_wales.py" + "cc-montesquieu_fr.py" + "ceb_coburg_de.py" + "cederbaum_de.py" + "centralbedfordshire_gov_uk.py" + "charnwood_gov_uk.py" + "chelmsford_gov_uk.py" + "cherwell_gov_uk.py" + "cheshire_east_gov_uk.py" + "cheshire_west_and_chester_gov_uk.py" + "chesterfield_gov_uk.py" + "chichester_gov_uk.py" + "chiemgau_recycling_lk_rosenheim.py" + "cidiu_it.py" + "circulus_nl.py" + "citiesapps_com.py" + "cockburn_wa_gov_au.py" + "colchester_gov_uk.py" + "conwy_gov_uk.py" + "cornwall_gov_uk.py" + "crawley_gov_uk.py" + "croydon_gov_uk.py" + "cumberland_nsw_gov_au.py" + "dacorum_gov_uk.py" + "darebin_vic_gov_au.py" + "darlington_gov_uk.py" + "denbighshire_gov_uk.py" + "derby_gov_uk.py" + "dillingen_saar_de.py" + "doncaster_gov_uk.py" + "dorset_gov_uk.py" + "dover_gov_uk.py" + "dudley_gov_uk.py" + "dundeecity_gov_uk.py" + "dunedin_govt_nz.py" + "durham_gov_uk.py" + "ead_darmstadt_de.py" + "ealing_gov_uk.py" + "east_ayrshire_gov_uk.py" + "east_northamptonshire_gov_uk.py" + "east_renfrewshire_gov_uk.py" + "eastcambs_gov_uk.py" + "eastdevon_gov_uk.py" + "eastherts_gov_uk.py" + "eastleigh_gov_uk.py" + "eastlothian_gov_uk.py" + "eastriding_gov_uk.py" + "edlitz_at.py" + "edpevent_se.py" + "egn_abfallkalender_de.py" + "eigenbetrieb_abfallwirtschaft_de.py" + "eko_tom_pl.py" + "ekosystem_wroc_pl.py" + "elmbridge_gov_uk.py" + "environmentfirst_co_uk.py" + "esch_lu.py" + "eth_erd_hu.py" + "exeter_gov_uk.py" + "fareham_gov_uk.py" + "fcc_group_eu.py" + "fccenvironment_co_uk.py" + "fenland_gov_uk.py" + "fife_gov_uk.py" + "fkf_bo_hu.py" + "fkf_bp_hu.py" + "flintshire_gov_uk.py" + "folkestone_hythe_gov_uk.py" + "fosenrenovasjon_no.py" + "frankenberg_de.py" + "frankston_vic_gov_au.py" + "fylde_gov_uk.py" + "gastrikeatervinnare_se.py" + "gateshead_gov_uk.py" + "geelongaustralia_com_au.py" + "gfa_lueneburg_de.py" + "glasgow_gov_uk.py" + "gmina_miekinia_pl.py" + "gojer_at.py" + "goldcoast_qld_gov_au.py" + "gotland_se.py" + "grafikai_svara_lt.py" + "grosswangen_ch.py" + "guildford_gov_uk.py" + "gwynedd_gov_uk.py" + "haringey_gov_uk.py" + "harlow_gov_uk.py" + "harrow_gov_uk.py" + "hart_gov_uk.py" + "hastings_gov_uk.py" + "hausmuell_info.py" + "hawkesbury_nsw_gov_au.py" + "hcc_govt_nz.py" + "heilbronn_de.py" + "herefordshire_gov_uk.py" + "highland_gov_uk.py" + "highpeak_gov_uk.py" + "hobsonsbay_vic_gov_au.py" + "hornsby_nsw_gov_au.py" + "horowhenua_govt_nz.py" + "horsham_gov_uk.py" + "hounslow_gov_uk.py" + "hull_gov_uk.py" + "hume_vic_gov_au.py" + "huntingdonshire_gov_uk.py" + "hvcgroep_nl.py" + "hygea_be.py" + "iapp_itouchvision_com.py" + "ilrifiutologo_it.py" + "impactapps_com_au.py" + "innerwest_nsw_gov_au.py" + "insert_it_de.py" + "ipswich_qld_gov_au.py" + "irenambiente_it.py" + "iris_salten_no.py" + "islington_gov_uk.py" + "isontinambiente_it.py" + "ittre_be.py" + "iweb_itouchvision_com.py" + "jointwastesolutions_org.py" + "jumomind_de.py" + "juneavfall_se.py" + "karlsruhe_de.py" + "kiertokapula_fi.py" + "kingston_gov_uk.py" + "kingston_vic_gov_au.py" + "kirklees_gov_uk.py" + "knox_vic_gov_au.py" + "koeniz_ch.py" + "ks_boerde_de.py" + "kuringgai_nsw_gov_au.py" + "kwb_goslar_de.py" + "kwu_de.py" + "lakemac_nsw_gov_au.py" + "lancaster_gov_uk.py" + "landkreis_kusel_de.py" + "landkreis_rhoen_grabfeld.py" + "lbbd_gov_uk.py" + "lerum_se.py" + "lewisham_gov_uk.py" + "lichfielddc_gov_uk.py" + "lincoln_gov_uk.py" + "lindau_ch.py" + "lisburn_castlereagh_gov_uk.py" + "liverpool_gov_uk.py" + "lobbe_app.py" + "logan_qld_gov_au.py" + "lsr_nu.py" + "lumire_se.py" + "lund_se.py" + "mags_de.py" + "maidstone_gov_uk.py" + "maldon_gov_uk.py" + "mamirolle_info.py" + "manchester_uk.py" + "mansfield_gov_uk.py" + "mansfield_vic_gov_au.py" + "maribyrnong_vic_gov_au.py" + "maroondah_vic_gov_au.py" + "meinawb_de.py" + "melton_vic_gov_au.py" + "merri_bek_vic_gov_au.py" + "merton_gov_uk.py" + "mestorudna_cz.py" + "midandeastantrim_gov_uk.py" + "midsussex_gov_uk.py" + "miljoteknik_se.py" + "milton_keynes_gov_uk.py" + "minrenovasjon_no.py" + "moje_odpady_pl.py" + "mojiodpadki_si.py" + "molndal_se.py" + "monaloga_de.py" + "montreal_ca.py" + "moray_gov_uk.py" + "mosman_nsw_gov_au.py" + "movar_no.py" + "mpgk_com_pl.py" + "mrsc_vic_gov_au.py" + "muellabfuhr_de.py" + "muenchenstein_ch.py" + "mundaring_wa_gov_au.py" + "myutility_winnipeg_ca.py" + "napier_govt_nz.py" + "nawma_sa_gov_au.py" + "newark_sherwooddc_gov_uk.py" + "newcastle_gov_uk.py" + "newcastle_staffs_gov_uk.py" + "newham_gov_uk.py" + "zakb_de.py" + "nillumbik_vic_gov_au.py" + "north_ayrshire_gov_uk.py" + "north_kesteven_org_uk.py" + "northherts_gov_uk.py" + "northlanarkshire_gov_uk.py" + "northlincs_gov_uk.py" + "northnorthants_gov_uk.py" + "northyorks_hambleton_gov_uk.py" + "northyorks_harrogate_gov_uk.py" + "northyorks_scarborough_gov_uk.py" + "northyorks_selby_gov_uk.py" + "nottingham_city_gov_uk.py" + "nsomerset_gov_uk.py" + "nuernberger_land_de.py" + "nvaa_se.py" + "nwleics_gov_uk.py" + "nyc_gov.py" + "oadby_wigston_gov_uk.py" + "odenserenovation_dk.py" + "okc_gov.py" + "onkaparingacity_com.py" + "orillia_ca.py" + "oslokommune_no.py" + "oxford_gov_uk.py" + "pembrokeshire_gov_uk.py" + "peterborough_gov_uk.py" + "pgh_st.py" + "poriruacity_govt_nz.py" + "portenf_sa_gov_au.py" + "portsmouth_gov_uk.py" + "portstephens_nsw_gov_au.py" + "potsdam_de.py" + "poznan_pl.py" + "pronatura_bydgoszcz_pl.py" + "publidata_fr.py" + "rambo_se.py" + "rapperswil_be_ch.py" + "rbwm_gov_uk.py" + "rctcbc_gov_uk.py" + "rd4_nl.py" + "reading_gov_uk.py" + "real_luzern_ch.py" + "recyclecoach_com.py" + "redbridge_gov_uk.py" + "redland_qld_gov_au.py" + "reigatebanstead_gov_uk.py" + "remidt_no.py" + "renfrewshire_gov_uk.py" + "renhallningen_kristianstad_se.py" + "renodjurs_dk.py" + "renosyd_dk.py" + "republicservices_com.py" + "reso_gmbh_de.py" + "richmondshire_gov_uk.py" + "rochdale_gov_uk.py" + "rotherham_gov_uk.py" + "rotorua_lakes_council_nz.py" + "roundlookup_uk.py" + "roundrocktexas_gov.py" + "runnymede_gov_uk.py" + "rushcliffe_gov_uk.py" + "rushmoor_gov_uk.py" + "rv_de.py" + "ryde_nsw_gov_au.py" + "salford_gov_uk.py" + "samiljo_se.py" + "sammelkalender_ch.py" + "sandnes_no.py" + "sbazv_de.py" + "scambs_gov_uk.py" + "scheibbs_umweltverbaende_at.py" + "seattle_gov.py" + "sepan_remondis_pl.py" + "sheffield_gov_uk.py" + "shellharbourwaste_com_au.py" + "sholland_gov_uk.py" + "shropshire_gov_uk.py" + "sica_lu.py" + "sivom_rivedroite_fr.py" + "snaga_mb_si.py" + "solihull_gov_uk.py" + "south_norfolk_and_broadland_gov_uk.py" + "southampton_gov_uk.py" + "southderbyshire_gov_uk.py" + "southglos_gov_uk.py" + "southkesteven_gov_uk.py" + "southtyneside_gov_uk.py" + "stadt_bamberg_de.py" + "staedteservice_de.py" + "staffordbc_gov_uk.py" + "stalbans_gov_uk.py" + "stavanger_no.py" + "stevenage_gov_uk.py" + "stirling_uk.py" + "stirling_wa_gov_au.py" + "stockport_gov_uk.py" + "stockton_gov_uk.py" + "stoke_gov_uk.py" + "stonnington_vic_gov_au.py" + "stratford_gov_uk.py" + "stroud_gov_uk.py" + "sunderland_gov_uk.py" + "sutton_gov_uk.py" + "swansea_gov_uk.py" + "swindon_gov_uk.py" + "sysav_se.py" + "tameside_gov_uk.py" + "tauranga_govt_nz.py" + "tbv_velbert_de.py" + "tekniskaverken_se.py" + "telford_gov_uk.py" + "tewkesbury_gov_uk.py" + "tkeliai_lt.py" + "tmbc_gov_uk.py" + "tonnenleerung_de.py" + "toogoodtowaste_co_nz.py" + "toronto_ca.py" + "townsville_qld_gov_au.py" + "tunbridgewells_gov_uk.py" + "umweltverbaende_at.py" + "unley_sa_gov_au.py" + "uttlesford_gov_uk.py" + "valeofglamorgan_gov_uk.py" + "vasyd_se.py" + "vestfor_dk.py" + "victoriapark_wa_gov_au.py" + "vivab_se.py" + "vmeab_se.py" + "walsall_gov_uk.py" + "wanneroo_wa_gov_au.py" + "warrington_gov_uk.py" + "warwickdc_gov_uk.py" + "was_wolfsburg_de.py" + "wastecollection_mt.py" + "wastenet_org_nz.py" + "waverley_gov_uk.py" + "wealden_gov_uk.py" + "welhat_gov_uk.py" + "wellington_govt_nz.py" + "wermelskirchen_de.py" + "west_dunbartonshire_gov_uk.py" + "west_norfolk_gov_uk.py" + "westberks_gov_uk.py" + "westlothian_gov_uk.py" + "westnorthants_gov_uk.py" + "westoxon_gov_uk.py" + "westsuffolk_gov_uk.py" + "whitehorse_vic_gov_au.py" + "whittlesea_vic_gov_au.py" + "wigan_gov_uk.py" + "wiltshire_gov_uk.py" + "winterthur_ch.py" + "wirral_gov_uk.py" + "wokingham_gov_uk.py" + "wollondilly_nsw_gov_au.py" + "wollongongwaste_com_au.py" + "wychavon_gov_uk.py" + "wyndham_vic_gov_au.py" + "wyre_gov_uk.py" + "wyreforestdc_gov_uk.py" + "yarra_ranges_vic_gov_au.py" + "york_gov_uk.py" +) + +# Build a git-exclude and git-include strings +grep_exclude="" +grep_include="" +for excluded in "${whitelist[@]}" +do + grep_exclude="${grep_exclude} :(exclude)*${excluded}" + grep_include="${grep_include} ${checkpath}${excluded}" +done + +# Initiate pass-state +failed=false + +# Grep for icon definitions in source folder but excude whitelisted +git grep -q mdi: -- "$checkpath" $grep_exclude +if [ $? -eq "0" ]; then + # Exit code == 0 -> match found -> make exit 1 + echo "Found icon definitions direcly in source folder!" + failed=true + if [ $verbose = "true" ] + then + echo "The following files are not complying:" + echo $(git grep --name mdi: -- "$checkpath" $grep_exclude) + fi + echo "" +fi + +# Grep for non-icon definitions in whitelisted +git grep -L -q mdi: -- $grep_include +if [ $? -eq "0" ]; then + # Exit code == 0 -> match found -> make exit 1 + echo "One or more of the whitelisted sources have no icon definitions, remove from whitelist!" + failed=true + if [ $verbose = "true" ] + then + echo "The following files are not complying:" + echo $(git grep -L mdi: -- $grep_include) + fi + echo "" +fi + +# Make exit +if [ "$failed" = "true" ]; +then + if [ $verbose = "false" ] + then + echo "Run \"./script/check_icon_use.sh -v\" to get a list of files that don't comply" + fi + exit 1 +fi +exit 0 diff --git a/script/fix_icon_use.sh b/script/fix_icon_use.sh new file mode 100755 index 000000000..5637f4efe --- /dev/null +++ b/script/fix_icon_use.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +fixpath="custom_components/waste_collection_schedule/waste_collection_schedule/source/" + +for file in $(git grep --name mdi: -- "$fixpath"); do + echo Trying to fix file $file + sed -i -e 's/"mdi:biohazard"/Icons.ICON_BIOHAZARD/g' $file + sed -i -e 's/"mdi:bottle-wine-outline"/Icons.ICON_CLEAR_GLASS/g' $file + sed -i -e 's/"mdi:bottle-wine"/Icons.ICON_COLORED_GLASS/g' $file + sed -i -e 's/"mdi:food"/Icons.ICON_COMPOST/g' $file + sed -i -e 's/"mdi:desktop-classic"/Icons.ICON_ELECTRONICS/g' $file + sed -i -e 's/"mdi:leaf"/Icons.ICON_GARDEN_WASTE/g' $file + sed -i -e 's/"mdi:trash-can"/Icons.ICON_GENERAL_TRASH/g' $file + sed -i -e 's/"mdi:delete-empty"/Icons.ICON_LANDFILL/g' $file + sed -i -e 's/"mdi:nail"/Icons.ICON_METAL/g' $file + sed -i -e 's/"mdi:newspaper"/Icons.ICON_NEWSPAPER/g' $file + sed -i -e 's/"mdi:package-variant"/Icons.ICON_GENERAL_TRASH/g' $file + sed -i -e 's/"mdi:bottle-soda-classic-outline"/Icons.ICON_PLASTIC/g' $file + sed -i -e 's/"mdi:recycle"/Icons.ICON_RECYCLE/g' $file +done + +echo "" +echo "Now manually tidy up the things the script could not fix:" +echo "1. Run \"git status\" to find which filed have been modified" +echo "2. If the file does not contian the following import, add it \"from const import Icons\"" +echo "3. Run \"git grep mdi: -- custom_components/waste_collection_schedule/waste_collection_schedule/source/\" to see if there are any remaining icons that can be manually fixed" +echo "4. Run \"./script/check_icon_use.sh\" to see what files should be removed from whitelist in that script"