@@ -122,6 +122,7 @@ ZHA Toolkit can also:
122
122
- [ ` zha_devices ` : Device Information to Event or CSV or Script variable] ( #zha_devices-device-information-to-event-or-csv-or-script-variable )
123
123
- [ ` register_services ` : Reregister ZHA-Toolkit services] ( #register_services-reregister-zha-toolkit-services )
124
124
- [ ` ha_set_state ` - Update HA state] ( #ha_set_state---update-ha-state )
125
+ - [ ` misc_energy_scan ` : Perform an energy scan] ( #misc_energy_scan-perform-an-energy-scan )
125
126
- [ User method] ( #user-method )
126
127
- [ Manufacturers] ( #manufacturers )
127
128
- [ Tuya] ( #tuya )
@@ -1921,6 +1922,49 @@ service code is entered which is incompatible with this functionality.
1921
1922
This is not strictly a `zha` specific tool, but useful in some scripting
1922
1923
situations.
1923
1924
1925
+ # ## `misc_energy_scan`: Perform an energy scan
1926
+
1927
+ Scan Zigbee channels for congestion level. The value is a percentage from
1928
+ zero to 100. A lower value is less congested.
1929
+
1930
+ ` ` ` yaml
1931
+ service: zha_toolkit.misc_energy_scan
1932
+ data:
1933
+ # Optional: CSV file to write attribute to - located in /config/csv/...
1934
+ csvout: energy_scan.csv
1935
+ ` ` `
1936
+
1937
+ The values can vary quite a bit between scans. You can create helpers to
1938
+ store results which will allow you to see trends via the History tab. This
1939
+ automation runs each hour :
1940
+
1941
+ ` ` `
1942
+ - id: zigbee_energy_scan
1943
+ alias: Zigbee Energy Scan
1944
+ mode: single
1945
+ triggers:
1946
+ - trigger: time_pattern
1947
+ # Matches every hour at 17 minutes past the hour
1948
+ minutes: 17
1949
+ actions:
1950
+ - action: zha_toolkit.execute
1951
+ data:
1952
+ command: misc_energy_scan
1953
+ response_variable: scan
1954
+ - repeat:
1955
+ for_each: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
1956
+ sequence:
1957
+ - action: input_number.set_value
1958
+ target:
1959
+ entity_id: "input_number.zigbee_energy_channel_{{ repeat.item }}"
1960
+ data:
1961
+ value: "{{ scan['energy_scan'][repeat.item] | round }}"
1962
+ ` ` `
1963
+
1964
+ Creating 16 input_number helpers can be tedious. ZHA recommends only
1965
+ channels 15, 20, and 25 be used. Alternatively you can create just three
1966
+ helpers and reduce the for_each list to only those three channels.
1967
+
1924
1968
# # User method
1925
1969
1926
1970
You can add your own Python commands in `local/user.py`. Your file is
0 commit comments