2019-09-22 20:46:50 -07:00
"""Print links to relevant docs."""
2024-03-08 16:36:11 +01:00
2019-09-22 20:46:50 -07:00
from .model import Info
2019-10-29 20:34:03 -07:00
DATA = {
2022-03-31 14:18:45 +02:00
"backup" : {
"title" : "Backup" ,
"docs" : "https://developers.home-assistant.io/docs/core/platform/backup" ,
},
2019-10-29 20:34:03 -07:00
"config_flow" : {
"title" : "Config Flow" ,
"docs" : "https://developers.home-assistant.io/docs/en/config_entries_config_flow_handler.html" ,
},
2022-03-16 12:57:56 +01:00
"config_flow_helper" : {
"title" : "Helper Config Flow" ,
"docs" : "https://developers.home-assistant.io/docs/en/config_entries_config_flow_handler.html#helper" ,
},
2019-10-29 20:34:03 -07:00
"config_flow_discovery" : {
"title" : "Discoverable Config Flow" ,
"docs" : "https://developers.home-assistant.io/docs/en/config_entries_config_flow_handler.html#discoverable-integrations-that-require-no-authentication" ,
},
"config_flow_oauth2" : {
"title" : "OAuth2 Config Flow" ,
"docs" : "https://developers.home-assistant.io/docs/en/next/config_entries_config_flow_handler.html#configuration-via-oauth2" ,
},
"device_action" : {
"title" : "Device Action" ,
"docs" : "https://developers.home-assistant.io/docs/en/device_automation_action.html" ,
},
"device_condition" : {
"title" : "Device Condition" ,
"docs" : "https://developers.home-assistant.io/docs/en/device_automation_condition.html" ,
},
"device_trigger" : {
"title" : "Device Trigger" ,
"docs" : "https://developers.home-assistant.io/docs/en/device_automation_trigger.html" ,
},
"integration" : {
"title" : "Integration" ,
"docs" : "https://developers.home-assistant.io/docs/en/creating_integration_file_structure.html" ,
},
"reproduce_state" : {
"title" : "Reproduce State" ,
2022-03-31 14:18:45 +02:00
"docs" : "https://developers.home-assistant.io/docs/core/platform/reproduce_state" ,
2019-10-29 20:34:03 -07:00
"extra" : "You will now need to update the code to make sure that every attribute that can occur in the state will cause the right service to be called." ,
},
2021-01-26 14:13:27 +01:00
"significant_change" : {
"title" : "Significant Change" ,
2022-03-31 14:18:45 +02:00
"docs" : "https://developers.home-assistant.io/docs/core/platform/significant_change" ,
2021-01-26 14:13:27 +01:00
"extra" : "You will now need to update the code to make sure that entities with different device classes are correctly considered." ,
},
2019-10-29 20:34:03 -07:00
}
2019-09-22 20:46:50 -07:00
def print_relevant_docs ( template : str , info : Info ) -> None :
"""Print relevant docs."""
2019-10-29 20:34:03 -07:00
data = DATA [ template ]
print ()
print ( "**************************" )
print ()
print ()
print ( f " { data [ 'title' ] } code has been generated" )
print ()
if info . files_added :
print ( "Added the following files:" )
for file in info . files_added :
print ( f "- { file } " )
print ()
if info . tests_added :
print ( "Added the following tests:" )
for file in info . tests_added :
print ( f "- { file } " )
print ()
if info . examples_added :
2019-09-22 20:46:50 -07:00
print (
2019-10-29 20:34:03 -07:00
"Because some files already existed, we added the following example files. Please copy the relevant code to the existing files."
2019-09-22 20:46:50 -07:00
)
2019-10-29 20:34:03 -07:00
for file in info . examples_added :
print ( f "- { file } " )
print ()
2019-09-22 20:46:50 -07:00
2019-10-29 20:34:03 -07:00
print (
2020-04-30 22:37:58 +03:00
"The next step is to look at the files and deal with all areas marked as TODO."
2019-10-29 20:34:03 -07:00
)
2019-09-23 23:23:53 -07:00
2019-10-29 20:34:03 -07:00
if "extra" in data :
2021-01-26 14:13:27 +01:00
print ()
2019-10-29 20:34:03 -07:00
print ( data [ "extra" ])