Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mqtt.homeassistant] update config abbreviations #16246

Merged
merged 3 commits into from Jan 22, 2024

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Jan 8, 2024

In particular, this fixed en: false (enabled_by_default) channels not showing up as advanced for me from ESPHome.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
@ccutrer ccutrer requested a review from antroids as a code owner January 8, 2024 15:54
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better but it is still out of sync, e.g. it seems to be missing

  • max
  • max_temp
  • min
  • min_temp
  • mode
  • modes

There are also other differences like abbreviations that are named wrong such as hum_val_tpl instead of hum_state_tpl.

Maybe just copy/paste the table and use search and replace to transform it into Java code? Than you'd get:

ABBREVIATIONS.put("act_t", "action_topic");
ABBREVIATIONS.put("act_tpl", "action_template");
ABBREVIATIONS.put("atype", "automation_type");
ABBREVIATIONS.put("aux_cmd_t", "aux_command_topic");
ABBREVIATIONS.put("aux_stat_t", "aux_state_topic");
ABBREVIATIONS.put("aux_stat_tpl", "aux_state_template");
ABBREVIATIONS.put("av_tones", "available_tones");
ABBREVIATIONS.put("avty", "availability");
ABBREVIATIONS.put("avty_mode", "availability_mode");
ABBREVIATIONS.put("avty_t", "availability_topic");
ABBREVIATIONS.put("avty_tpl", "availability_template");
ABBREVIATIONS.put("away_mode_cmd_t", "away_mode_command_topic");
ABBREVIATIONS.put("away_mode_stat_t", "away_mode_state_topic");
ABBREVIATIONS.put("away_mode_stat_tpl", "away_mode_state_template");
ABBREVIATIONS.put("bat_lev_t", "battery_level_topic");
ABBREVIATIONS.put("bat_lev_tpl", "battery_level_template");
ABBREVIATIONS.put("bri_cmd_t", "brightness_command_topic");
ABBREVIATIONS.put("bri_cmd_tpl", "brightness_command_template");
ABBREVIATIONS.put("bri_scl", "brightness_scale");
ABBREVIATIONS.put("bri_stat_t", "brightness_state_topic");
ABBREVIATIONS.put("bri_tpl", "brightness_template");
ABBREVIATIONS.put("bri_val_tpl", "brightness_value_template");
ABBREVIATIONS.put("b_tpl", "blue_template");
ABBREVIATIONS.put("chrg_t", "charging_topic");
ABBREVIATIONS.put("chrg_tpl", "charging_template");
ABBREVIATIONS.put("cln_t", "cleaning_topic");
ABBREVIATIONS.put("cln_tpl", "cleaning_template");
ABBREVIATIONS.put("clrm", "color_mode");
ABBREVIATIONS.put("clrm_stat_t", "color_mode_state_topic");
ABBREVIATIONS.put("clrm_val_tpl", "color_mode_value_template");
ABBREVIATIONS.put("clr_temp_cmd_t", "color_temp_command_topic");
ABBREVIATIONS.put("clr_temp_cmd_tpl", "color_temp_command_template");
ABBREVIATIONS.put("clr_temp_stat_t", "color_temp_state_topic");
ABBREVIATIONS.put("clr_temp_tpl", "color_temp_template");
ABBREVIATIONS.put("clr_temp_val_tpl", "color_temp_value_template");
ABBREVIATIONS.put("cmd_off_tpl", "command_off_template");
ABBREVIATIONS.put("cmd_on_tpl", "command_on_template");
ABBREVIATIONS.put("cmd_t", "command_topic");
ABBREVIATIONS.put("cmd_tpl", "command_template");
ABBREVIATIONS.put("cod_arm_req", "code_arm_required");
ABBREVIATIONS.put("cod_dis_req", "code_disarm_required");
ABBREVIATIONS.put("cod_trig_req", "code_trigger_required");
ABBREVIATIONS.put("cont_type", "content_type");
ABBREVIATIONS.put("curr_temp_t", "current_temperature_topic");
ABBREVIATIONS.put("curr_temp_tpl", "current_temperature_template");
ABBREVIATIONS.put("dev_cla", "device_class");
ABBREVIATIONS.put("dev", "device");
ABBREVIATIONS.put("dir_cmd_t", "direction_command_topic");
ABBREVIATIONS.put("dir_cmd_tpl", "direction_command_template");
ABBREVIATIONS.put("dir_stat_t", "direction_state_topic");
ABBREVIATIONS.put("dir_val_tpl", "direction_value_template");
ABBREVIATIONS.put("dock_t", "docked_topic");
ABBREVIATIONS.put("dock_tpl", "docked_template");
ABBREVIATIONS.put("e", "encoding");
ABBREVIATIONS.put("en", "enabled_by_default");
ABBREVIATIONS.put("ent_cat", "entity_category");
ABBREVIATIONS.put("ent_pic", "entity_picture");
ABBREVIATIONS.put("err_t", "error_topic");
ABBREVIATIONS.put("err_tpl", "error_template");
ABBREVIATIONS.put("evt_typ", "event_types");
ABBREVIATIONS.put("exp_aft", "expire_after");
ABBREVIATIONS.put("fan_mode_cmd_t", "fan_mode_command_topic");
ABBREVIATIONS.put("fan_mode_cmd_tpl", "fan_mode_command_template");
ABBREVIATIONS.put("fan_mode_stat_t", "fan_mode_state_topic");
ABBREVIATIONS.put("fan_mode_stat_tpl", "fan_mode_state_template");
ABBREVIATIONS.put("fanspd_lst", "fan_speed_list");
ABBREVIATIONS.put("fanspd_t", "fan_speed_topic");
ABBREVIATIONS.put("fanspd_tpl", "fan_speed_template");
ABBREVIATIONS.put("flsh_tlng", "flash_time_long");
ABBREVIATIONS.put("flsh_tsht", "flash_time_short");
ABBREVIATIONS.put("frc_upd", "force_update");
ABBREVIATIONS.put("fx_cmd_t", "effect_command_topic");
ABBREVIATIONS.put("fx_cmd_tpl", "effect_command_template");
ABBREVIATIONS.put("fx_list", "effect_list");
ABBREVIATIONS.put("fx_stat_t", "effect_state_topic");
ABBREVIATIONS.put("fx_tpl", "effect_template");
ABBREVIATIONS.put("fx_val_tpl", "effect_value_template");
ABBREVIATIONS.put("g_tpl", "green_template");
ABBREVIATIONS.put("hs_cmd_t", "hs_command_topic");
ABBREVIATIONS.put("hs_cmd_tpl", "hs_command_template");
ABBREVIATIONS.put("hs_stat_t", "hs_state_topic");
ABBREVIATIONS.put("hs_val_tpl", "hs_value_template");
ABBREVIATIONS.put("hum_cmd_tpl", "target_humidity_command_template");
ABBREVIATIONS.put("hum_cmd_t", "target_humidity_command_topic");
ABBREVIATIONS.put("hum_state_tpl", "target_humidity_state_template");
ABBREVIATIONS.put("hum_stat_t", "target_humidity_state_topic");
ABBREVIATIONS.put("ic", "icon");
ABBREVIATIONS.put("img_e", "image_encoding");
ABBREVIATIONS.put("img_t", "image_topic");
ABBREVIATIONS.put("init", "initial");
ABBREVIATIONS.put("json_attr", "json_attributes");
ABBREVIATIONS.put("json_attr_t", "json_attributes_topic");
ABBREVIATIONS.put("json_attr_tpl", "json_attributes_template");
ABBREVIATIONS.put("lrst_t", "last_reset_topic");
ABBREVIATIONS.put("lrst_val_tpl", "last_reset_value_template");
ABBREVIATIONS.put("l_ver_t", "latest_version_topic");
ABBREVIATIONS.put("l_ver_tpl", "latest_version_template");
ABBREVIATIONS.put("max_hum", "max_humidity");
ABBREVIATIONS.put("max", "max");
ABBREVIATIONS.put("max_mirs", "max_mireds");
ABBREVIATIONS.put("max_temp", "max_temp");
ABBREVIATIONS.put("min_hum", "min_humidity");
ABBREVIATIONS.put("min", "min");
ABBREVIATIONS.put("min_mirs", "min_mireds");
ABBREVIATIONS.put("min_temp", "min_temp");
ABBREVIATIONS.put("mode_cmd_t", "mode_command_topic");
ABBREVIATIONS.put("mode_cmd_tpl", "mode_command_template");
ABBREVIATIONS.put("mode", "mode");
ABBREVIATIONS.put("modes", "modes");
ABBREVIATIONS.put("mode_stat_t", "mode_state_topic");
ABBREVIATIONS.put("mode_stat_tpl", "mode_state_template");
ABBREVIATIONS.put("name", "name");
ABBREVIATIONS.put("obj_id", "object_id");
ABBREVIATIONS.put("off_dly", "off_delay");
ABBREVIATIONS.put("on_cmd_type", "on_command_type");
ABBREVIATIONS.put("o", "origin");
ABBREVIATIONS.put("ops", "options");
ABBREVIATIONS.put("opt", "optimistic");
ABBREVIATIONS.put("osc_cmd_t", "oscillation_command_topic");
ABBREVIATIONS.put("osc_cmd_tpl", "oscillation_command_template");
ABBREVIATIONS.put("osc_stat_t", "oscillation_state_topic");
ABBREVIATIONS.put("osc_val_tpl", "oscillation_value_template");
ABBREVIATIONS.put("pct_cmd_t", "percentage_command_topic");
ABBREVIATIONS.put("pct_cmd_tpl", "percentage_command_template");
ABBREVIATIONS.put("pct_stat_t", "percentage_state_topic");
ABBREVIATIONS.put("pct_val_tpl", "percentage_value_template");
ABBREVIATIONS.put("pl_arm_away", "payload_arm_away");
ABBREVIATIONS.put("pl_arm_custom_b", "payload_arm_custom_bypass");
ABBREVIATIONS.put("pl_arm_home", "payload_arm_home");
ABBREVIATIONS.put("pl_arm_nite", "payload_arm_night");
ABBREVIATIONS.put("pl_arm_vacation", "payload_arm_vacation");
ABBREVIATIONS.put("pl_avail", "payload_available");
ABBREVIATIONS.put("pl_cln_sp", "payload_clean_spot");
ABBREVIATIONS.put("pl_cls", "payload_close");
ABBREVIATIONS.put("pl_dir_fwd", "payload_direction_forward");
ABBREVIATIONS.put("pl_dir_rev", "payload_direction_reverse");
ABBREVIATIONS.put("pl_disarm", "payload_disarm");
ABBREVIATIONS.put("pl_home", "payload_home");
ABBREVIATIONS.put("pl_inst", "payload_install");
ABBREVIATIONS.put("pl_lock", "payload_lock");
ABBREVIATIONS.put("pl_loc", "payload_locate");
ABBREVIATIONS.put("pl_not_avail", "payload_not_available");
ABBREVIATIONS.put("pl_not_home", "payload_not_home");
ABBREVIATIONS.put("pl_off", "payload_off");
ABBREVIATIONS.put("pl_on", "payload_on");
ABBREVIATIONS.put("pl_open", "payload_open");
ABBREVIATIONS.put("pl_osc_off", "payload_oscillation_off");
ABBREVIATIONS.put("pl_osc_on", "payload_oscillation_on");
ABBREVIATIONS.put("pl_paus", "payload_pause");
ABBREVIATIONS.put("pl", "payload");
ABBREVIATIONS.put("pl_prs", "payload_press");
ABBREVIATIONS.put("pl_ret", "payload_return_to_base");
ABBREVIATIONS.put("pl_rst_hum", "payload_reset_humidity");
ABBREVIATIONS.put("pl_rst_mode", "payload_reset_mode");
ABBREVIATIONS.put("pl_rst", "payload_reset");
ABBREVIATIONS.put("pl_rst_pct", "payload_reset_percentage");
ABBREVIATIONS.put("pl_rst_pr_mode", "payload_reset_preset_mode");
ABBREVIATIONS.put("pl_stop", "payload_stop");
ABBREVIATIONS.put("pl_stpa", "payload_start_pause");
ABBREVIATIONS.put("pl_strt", "payload_start");
ABBREVIATIONS.put("pl_toff", "payload_turn_off");
ABBREVIATIONS.put("pl_ton", "payload_turn_on");
ABBREVIATIONS.put("pl_trig", "payload_trigger");
ABBREVIATIONS.put("pl_unlk", "payload_unlock");
ABBREVIATIONS.put("pos_clsd", "position_closed");
ABBREVIATIONS.put("pos_open", "position_open");
ABBREVIATIONS.put("pos", "reports_position");
ABBREVIATIONS.put("pos_tpl", "position_template");
ABBREVIATIONS.put("pos_t", "position_topic");
ABBREVIATIONS.put("pr_mode_cmd_tpl", "preset_mode_command_template");
ABBREVIATIONS.put("pr_mode_cmd_t", "preset_mode_command_topic");
ABBREVIATIONS.put("pr_modes", "preset_modes");
ABBREVIATIONS.put("pr_mode_stat_t", "preset_mode_state_topic");
ABBREVIATIONS.put("pr_mode_val_tpl", "preset_mode_value_template");
ABBREVIATIONS.put("ptrn", "pattern");
ABBREVIATIONS.put("rel_s", "release_summary");
ABBREVIATIONS.put("rel_u", "release_url");
ABBREVIATIONS.put("ret", "retain");
ABBREVIATIONS.put("rgb_cmd_tpl", "rgb_command_template");
ABBREVIATIONS.put("rgb_cmd_t", "rgb_command_topic");
ABBREVIATIONS.put("rgb_stat_t", "rgb_state_topic");
ABBREVIATIONS.put("rgb_val_tpl", "rgb_value_template");
ABBREVIATIONS.put("rgbw_cmd_tpl", "rgbw_command_template");
ABBREVIATIONS.put("rgbw_cmd_t", "rgbw_command_topic");
ABBREVIATIONS.put("rgbw_stat_t", "rgbw_state_topic");
ABBREVIATIONS.put("rgbw_val_tpl", "rgbw_value_template");
ABBREVIATIONS.put("rgbww_cmd_tpl", "rgbww_command_template");
ABBREVIATIONS.put("rgbww_cmd_t", "rgbww_command_topic");
ABBREVIATIONS.put("rgbww_stat_t", "rgbww_state_topic");
ABBREVIATIONS.put("rgbww_val_tpl", "rgbww_value_template");
ABBREVIATIONS.put("r_tpl", "red_template");
ABBREVIATIONS.put("send_cmd_t", "send_command_topic");
ABBREVIATIONS.put("send_if_off", "send_if_off");
ABBREVIATIONS.put("set_fan_spd_t", "set_fan_speed_topic");
ABBREVIATIONS.put("set_pos_tpl", "set_position_template");
ABBREVIATIONS.put("set_pos_t", "set_position_topic");
ABBREVIATIONS.put("spd_rng_max", "speed_range_max");
ABBREVIATIONS.put("spd_rng_min", "speed_range_min");
ABBREVIATIONS.put("src_type", "source_type");
ABBREVIATIONS.put("stat_cla", "state_class");
ABBREVIATIONS.put("stat_closing", "state_closing");
ABBREVIATIONS.put("stat_clsd", "state_closed");
ABBREVIATIONS.put("stat_jam", "state_jammed");
ABBREVIATIONS.put("stat_locked", "state_locked");
ABBREVIATIONS.put("stat_locking", "state_locking");
ABBREVIATIONS.put("stat_off", "state_off");
ABBREVIATIONS.put("stat_on", "state_on");
ABBREVIATIONS.put("stat_opening", "state_opening");
ABBREVIATIONS.put("stat_open", "state_open");
ABBREVIATIONS.put("stat_stopped", "state_stopped");
ABBREVIATIONS.put("stat_tpl", "state_template");
ABBREVIATIONS.put("stat_t", "state_topic");
ABBREVIATIONS.put("stat_unlocked", "state_unlocked");
ABBREVIATIONS.put("stat_unlocking", "state_unlocking");
ABBREVIATIONS.put("stat_val_tpl", "state_value_template");
ABBREVIATIONS.put("step", "step");
ABBREVIATIONS.put("stype", "subtype");
ABBREVIATIONS.put("sug_dsp_prc", "suggested_display_precision");
ABBREVIATIONS.put("sup_clrm", "supported_color_modes");
ABBREVIATIONS.put("sup_dur", "support_duration");
ABBREVIATIONS.put("sup_feat", "supported_features");
ABBREVIATIONS.put("sup_vol", "support_volume_set");
ABBREVIATIONS.put("swing_mode_cmd_tpl", "swing_mode_command_template");
ABBREVIATIONS.put("swing_mode_cmd_t", "swing_mode_command_topic");
ABBREVIATIONS.put("swing_mode_stat_tpl", "swing_mode_state_template");
ABBREVIATIONS.put("swing_mode_stat_t", "swing_mode_state_topic");
ABBREVIATIONS.put("temp_cmd_tpl", "temperature_command_template");
ABBREVIATIONS.put("temp_cmd_t", "temperature_command_topic");
ABBREVIATIONS.put("temp_hi_cmd_tpl", "temperature_high_command_template");
ABBREVIATIONS.put("temp_hi_cmd_t", "temperature_high_command_topic");
ABBREVIATIONS.put("temp_hi_stat_tpl", "temperature_high_state_template");
ABBREVIATIONS.put("temp_hi_stat_t", "temperature_high_state_topic");
ABBREVIATIONS.put("temp_lo_cmd_tpl", "temperature_low_command_template");
ABBREVIATIONS.put("temp_lo_cmd_t", "temperature_low_command_topic");
ABBREVIATIONS.put("temp_lo_stat_tpl", "temperature_low_state_template");
ABBREVIATIONS.put("temp_lo_stat_t", "temperature_low_state_topic");
ABBREVIATIONS.put("temp_stat_tpl", "temperature_state_template");
ABBREVIATIONS.put("temp_stat_t", "temperature_state_topic");
ABBREVIATIONS.put("temp_unit", "temperature_unit");
ABBREVIATIONS.put("tilt_clsd_val", "tilt_closed_value");
ABBREVIATIONS.put("tilt_cmd_tpl", "tilt_command_template");
ABBREVIATIONS.put("tilt_cmd_t", "tilt_command_topic");
ABBREVIATIONS.put("tilt_max", "tilt_max");
ABBREVIATIONS.put("tilt_min", "tilt_min");
ABBREVIATIONS.put("tilt_opnd_val", "tilt_opened_value");
ABBREVIATIONS.put("tilt_opt", "tilt_optimistic");
ABBREVIATIONS.put("tilt_status_tpl", "tilt_status_template");
ABBREVIATIONS.put("tilt_status_t", "tilt_status_topic");
ABBREVIATIONS.put("tit", "title");
ABBREVIATIONS.put("t", "topic");
ABBREVIATIONS.put("uniq_id", "unique_id");
ABBREVIATIONS.put("unit_of_meas", "unit_of_measurement");
ABBREVIATIONS.put("url_tpl", "url_template");
ABBREVIATIONS.put("url_t", "url_topic");
ABBREVIATIONS.put("val_tpl", "value_template");
ABBREVIATIONS.put("whit_cmd_t", "white_command_topic");
ABBREVIATIONS.put("whit_scl", "white_scale");
ABBREVIATIONS.put("xy_cmd_tpl", "xy_command_template");
ABBREVIATIONS.put("xy_cmd_t", "xy_command_topic");
ABBREVIATIONS.put("xy_stat_t", "xy_state_topic");
ABBREVIATIONS.put("xy_val_tpl", "xy_value_template");

@ccutrer
Copy link
Contributor Author

ccutrer commented Jan 19, 2024

I ended up re-doing as you suggested, but from the actual source at https://github.com/home-assistant/core/blob/dev/homeassistant/components/mqtt/abbreviations.py, instead of the docs, which seemed to be missing several. The specific ones you mentioned are not actually abbreviations, so are unnecessary, but I ended up with them anyway since that was easiest for copy/pasting from source, which also has them.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. All the abbreviations are there now. 👍

@wborn wborn merged commit f99d977 into openhab:main Jan 22, 2024
2 of 3 checks passed
@wborn wborn added this to the 4.2 milestone Jan 22, 2024
@wborn wborn added the enhancement An enhancement or new feature for an existing add-on label Jan 22, 2024
@ccutrer ccutrer deleted the mqtt-homeassistant-abbreviations branch January 22, 2024 20:19
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Jan 27, 2024
Signed-off-by: Cody Cutrer <cody@cutrer.us>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
ulbi pushed a commit to ulbi/openhab-addons that referenced this pull request Jan 28, 2024
Signed-off-by: Cody Cutrer <cody@cutrer.us>
Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
Signed-off-by: Cody Cutrer <cody@cutrer.us>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants