@@ -43,7 +43,7 @@ Instead, test from another location, e.g.:
4343
4444` ` ` sh
4545cd ..
46- sudo python -c " import pyectool; print(pyectool .is_on_ac())"
46+ sudo python -c " from pyectool import ECController; ec = ECController(); print(ec .is_on_ac())"
4747` ` `
4848
4949# # VENV INSTALLATION
@@ -66,15 +66,47 @@ pip install .
6666# ## Test from outside the repo dir
6767` ` ` bash
6868cd ..
69- sudo env " PATH=$PATH " python -c " import pyectool; print(pyectool .is_on_ac())"
69+ sudo env " PATH=$PATH " python -c " from pyectool import ECController; ec = ECController(); print(ec .is_on_ac())"
7070` ` `
7171
7272# ## Available Functions
7373
74- | Function | Description |
75- | ------------------------------------------ | -------------------------------------------------------------------------------- |
76- | `auto_fan_control ()` | Enables automatic fan control by the EC. |
77- | ` get_max_non_battery_temperature() -> float` | Returns the highest temperature (in °C) from all sensors except the battery. |
78- | ` get_max_temperature() -> float` | Returns the highest temperature (in °C) from all EC sensors including battery. |
79- | ` is_on_ac() -> bool` | Checks whether the device is running on AC power. |
80- | ` set_fan_duty(percent: int)` | Sets the fan duty cycle manually (0–100%). |
74+ All functions are methods of the ` ECController` class. Instantiate it like so:
75+
76+ ` ` ` python
77+ from pyectool import ECController
78+ ec = ECController ()
79+ ` ` `
80+
81+ Then use the methods as shown below:
82+
83+ | Method | Description |
84+ | ------------------------------------------------------- | ------------------------------------------------------------------------- |
85+ | `ec.is_on_ac () -> bool` | Returns ` True` if the system is on AC power, else ` False` . |
86+ | `ec.get_num_fans () -> int` | Returns the number of fan devices detected. |
87+ | ` ec.enable_fan_auto_ctrl(fan_idx: int) -> None` | Enables automatic fan control for a specific fan. |
88+ | ` ec.enable_all_fans_auto_ctrl() -> None` | Enables automatic control for all fans. |
89+ | ` ec.set_fan_duty(percent: int, fan_idx: int) -> None` | Sets fan duty (speed) as a percentage for a specific fan. |
90+ | ` ec.set_all_fans_duty(percent: int) -> None` | Sets the same duty percentage for all fans. |
91+ | ` ec.set_fan_rpm(target_rpm: int, fan_idx: int) -> None` | Sets a specific RPM target for a specific fan. |
92+ | ` ec.set_all_fans_rpm(target_rpm: int) -> None` | Sets the same RPM target for all fans. |
93+ | ` ec.get_fan_rpm(fan_idx: int) -> int` | Returns current RPM of a specific fan. |
94+ | ` ec.get_all_fans_rpm() -> list[int]` | Returns a list of current RPM values for all fans. |
95+ | ` ec.get_num_temp_sensors() -> int` | Returns the total number of temperature sensors detected. |
96+ | ` ec.get_temp(sensor_idx: int) -> int` | Returns the temperature (in °C) for the given sensor index. |
97+ | ` ec.get_all_temps() -> list[int]` | Returns a list of all sensor temperatures (in °C). |
98+ | ` ec.get_max_temp() -> int` | Returns the highest temperature across all sensors. |
99+ | ` ec.get_max_non_battery_temp() -> int` | Returns the highest temperature excluding battery-related sensors. |
100+ | ` ec.get_temp_info(sensor_idx: int) -> ECTempInfo` | Returns detailed info for a sensor, including name, type, and thresholds. |
101+
102+ ---
103+
104+ # ## `ECTempInfo`
105+
106+ Returned by ` get_temp_info()` , acts like a ` dict` with:
107+
108+ * ` sensor_name` : str
109+ * ` sensor_type` : int
110+ * ` temp` : int
111+ * ` temp_fan_off` : int
112+ * ` temp_fan_max` : int
0 commit comments