You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.6 KiB

  1. # Upgrading to version 2021.10.0
  2. Quite a few things have been changed in order to make the Xiaomi Bedside Lamp 2 firmware code compatible with
  3. ESPHome version 2021.10.0. As a result, configuration changes are needed to make the configuration work with
  4. the new code.
  5. There are basically two ways in which you can upgrade:
  6. 1. Start a new configuration
  7. 2. Upgrade your existing configuration
  8. ## 1. Start a new configuration
  9. *This is definitely the simplest way*.
  10. Copy the new `example.yaml` configuration file from the GitHub repository and start a new configuration based
  11. on that. When this configuration is working, you can extend your configuration to tweak the configuration to
  12. your needs.
  13. ## 2. Upgrade your existing configuration
  14. If you have done extensive customization, it might be easier to upgrade your existing configuration. Below
  15. you find a list of changse that have to be applied, and that should get your configuration ready for 2021.10.0.
  16. **Setup the following substitutions in your configuration file:**
  17. ```yaml
  18. substitutions:
  19. name: bedside-lamp
  20. friendly_name: Bedside Lamp
  21. light_name: ${friendly_name} RGBWW Light
  22. light_mode_text_sensor_name: ${friendly_name} Light Mode
  23. default_transition_length: 800ms
  24. ```
  25. Other substitutions are not in use anymore, so you can delete them.
  26. **Modify the existing `external_components:` configuration to:**
  27. ```yaml
  28. external_components:
  29. - source:
  30. type: git
  31. url: https://github.com/mmakaay/esphome-xiaomi_bslamp2
  32. ref: release/2021.10.0
  33. refresh: 60s
  34. ```
  35. **Add the new core configuration package:**
  36. ```yaml
  37. packages:
  38. bslamp2:
  39. url: https://github.com/mmakaay/esphome-xiaomi_bslamp2
  40. ref: release/2021.10.0
  41. files:
  42. - packages/core.yaml
  43. refresh: 0s
  44. ```
  45. You can omit the ones that represent the required value already.
  46. **Fully remove the existing `esphome:` configuration section**
  47. Remove the following block from your configuration. The `core.yaml` configuration
  48. package provides the required configuration, so you don't need it in your
  49. configuration file anymore.
  50. ```yaml
  51. esphome:
  52. name: ${name}
  53. ...
  54. etc.
  55. ```
  56. **Modfy all instances of id's from a variable to a string value:**
  57. - `${id_light}` -> `my_light`
  58. - `${id_front_panel_illumination}` -> `my_front_panel_illumination`
  59. - `${id_light_mode}` -> `my_light_mode`
  60. - `${id_power_button}` -> `my_power_button`
  61. - `${id_color_button}` -> `my_color_button`
  62. - `${id_slider_level}` -> `my_slider_level`
  63. These are the identifiers that I will be using from now on in the configuration
  64. packages as well. By using these identifiers in all places, it will be easy to
  65. distribute configuration packages that can be added to your configuration.
  66. **Fully remove the front panel illumination output from the config**
  67. This configuration is already being setup as part of the `core.yaml` configuration package.
  68. When not removing it, you would get an error about the component being redefined. So simply
  69. remove this block from your configuration:
  70. ```yaml
  71. output:
  72. - platform: xiaomi_bslamp2
  73. id: my_front_panel_illumination
  74. ```
  75. **Optionally, modify the the name of the light component**
  76. For the name of the light, you can replace `${friendly_name} RGBWW Light` with
  77. the new `${light_name}` substitution variable.
  78. ```yaml
  79. light:
  80. - platform: xiaomi_bslamp2
  81. id: my_light
  82. name: ${light_name}
  83. ...
  84. ```
  85. ** Optionally, modify the name of the text sensor**
  86. Likewise, you can change the text sensor that publishes the current light mode as text.
  87. The name can be changed from `${fiendly_name} Light Mode` to `${light_mode_text_sensor_name}`.
  88. ```yaml
  89. text_sensor:
  90. - platform: xiaomi_bslamp2
  91. id: my_light_mode
  92. name: ${light_mode_text_sensor_name}
  93. ```