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