mirror of
				https://github.com/Tediore/battery2mqtt.git
				synced 2025-11-04 04:46:35 +01:00 
			
		
		
		
	Merge branch 'main' of github.com:Tediore/battery2mqtt into main
This commit is contained in:
		
							
								
								
									
										24
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								README.md
									
									
									
									
									
								
							@@ -54,10 +54,10 @@ services:
 | 
				
			|||||||
| `MQTT_QOS` | `1` | The MQTT QoS level. |
 | 
					| `MQTT_QOS` | `1` | The MQTT QoS level. |
 | 
				
			||||||
| `INTERVAL` | `60` | How often (in seconds) battery2mqtt polls for battery info. |
 | 
					| `INTERVAL` | `60` | How often (in seconds) battery2mqtt polls for battery info. |
 | 
				
			||||||
| `MONITORED_CONDITIONS` | (See below) | Battery properties to send to MQTT (must be a comma-separated string). |
 | 
					| `MONITORED_CONDITIONS` | (See below) | Battery properties to send to MQTT (must be a comma-separated string). |
 | 
				
			||||||
| `BATTERY_HEALTH` | `1` | Set to 1 or leave blank to enable battery health percentage calculation or 0 to disable. |
 | 
					| `BATTERY_HEALTH` | `1` | Enable/disable battery health percentage calculation. Set to 0 to disable. |
 | 
				
			||||||
| `TIME_REMAINING` | `1` | Set to 1 or leave blank to enable time remaining estimate (in hours) or 0 to disable. |
 | 
					| `TIME_REMAINING` | `1` | Enable/disable time remaining estimate (in hours). Set to 0 to disable. |
 | 
				
			||||||
| `SHOW_UNITS` | `1` | Set to 1 or leave blank to show power units in the MQTT payload or 0 to disable. |
 | 
					| `SHOW_UNITS` | `1` | Enable/disable power units in the MQTT payload. Set to 0 to disable. |
 | 
				
			||||||
| `AC_ADAPTER` | `0` | Set to 1 to show AC adapter status. |
 | 
					| `AC_ADAPTER` | `0` | Enable/disable AC adapter status. Set to 1 to enable. |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Monitored conditions
 | 
					# Monitored conditions
 | 
				
			||||||
You can specify only those conditions that you'd like to track. The default is to track `status, capacity, energy_now, energy_full, energy_full_design, power_now, voltage_now`. You can add more conditions (found at `/sys/class/power_supply/$NAME`) or choose only those you want to track. The variable in your `docker-compose.yaml` must follow this comma-separated format:
 | 
					You can specify only those conditions that you'd like to track. The default is to track `status, capacity, energy_now, energy_full, energy_full_design, power_now, voltage_now`. You can add more conditions (found at `/sys/class/power_supply/$NAME`) or choose only those you want to track. The variable in your `docker-compose.yaml` must follow this comma-separated format:
 | 
				
			||||||
@@ -75,8 +75,6 @@ A summary of these conditions is below.
 | 
				
			|||||||
| Energy full design | Original battery capacity when full* | Wh |
 | 
					| Energy full design | Original battery capacity when full* | Wh |
 | 
				
			||||||
| Power now | Current power consumption | W |
 | 
					| Power now | Current power consumption | W |
 | 
				
			||||||
| Voltage now | Current battery voltage | V |
 | 
					| Voltage now | Current battery voltage | V |
 | 
				
			||||||
| Battery health | (See next section) | % |
 | 
					 | 
				
			||||||
| Time remaining | (See next section) | Hr |
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
\* Batteries lose capacity with each charge cycle. *Energy full* shows the actual full capacity of the battery due to wear; *Energy full design* shows the capacity the battery was able to hold when factory fresh.
 | 
					\* Batteries lose capacity with each charge cycle. *Energy full* shows the actual full capacity of the battery due to wear; *Energy full design* shows the capacity the battery was able to hold when factory fresh.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -84,6 +82,9 @@ A summary of these conditions is below.
 | 
				
			|||||||
The default is to also provide a battery health percentage calculation by dividing `energy_full` by `energy_full_design`. This can be disabled by setting `BATTERY_HEALTH` to `0` in your `docker-compose.yaml`. 
 | 
					The default is to also provide a battery health percentage calculation by dividing `energy_full` by `energy_full_design`. This can be disabled by setting `BATTERY_HEALTH` to `0` in your `docker-compose.yaml`. 
 | 
				
			||||||
Similiarly, an estimate of time remaining on battery (in hours) is calculated by dividing `energy_now` by `power_now`. This can be disabled by setting `TIME_REMAINING` to `0` in your `docker-compose.yaml`.
 | 
					Similiarly, an estimate of time remaining on battery (in hours) is calculated by dividing `energy_now` by `power_now`. This can be disabled by setting `TIME_REMAINING` to `0` in your `docker-compose.yaml`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# AC adapter monitoring
 | 
				
			||||||
 | 
					You can monitor the status of the AC adapter (online or offline) by setting `AC_ADAPTER` to `1`. This is disabled by default.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Example Home Assistant configuration
 | 
					# Example Home Assistant configuration
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
sensor:
 | 
					sensor:
 | 
				
			||||||
@@ -96,8 +97,9 @@ sensor:
 | 
				
			|||||||
  device_class: battery
 | 
					  device_class: battery
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO:
 | 
					# TODO
 | 
				
			||||||
1. Add proper logging
 | 
					1. Implement LWT
 | 
				
			||||||
2. Add Home Assistant MQTT autodiscovery?
 | 
					2. Add proper logging
 | 
				
			||||||
3. ???
 | 
					3. Add Home Assistant MQTT autodiscovery?
 | 
				
			||||||
4. Profit
 | 
					4. ???
 | 
				
			||||||
 | 
					5. Profit
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user