Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
odya committed Nov 11, 2024
2 parents ee22d68 + e6b471e commit c67dd55
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,26 +144,33 @@ $ sudo reboot

You may use [HassOS I2C Configurator](https://community.home-assistant.io/t/add-on-hassos-i2c-configurator/264167) to activate i2c on your Hass host and search available devices addresses

#### Check the i2c address of the sensor (using i2c-tools)
## How to scan i2c buses to find your device addr

After installing `i2c-tools`, a new utility is available to scan the addresses of the connected sensors:
1. Install addon `Advanced SSH & Web Terminal`
2. Enter the web interface and execute `docker exec -it homeassistant bash -c "apk add i2c-tools && i2cdetect -y 0 && i2cdetect -y 1"`

```bash
/usr/sbin/i2cdetect -y 1
After that you'll get list of found i2c devices. First table is for channel 0, second for channel 1.
```

It will output a table like this:

```text
➜ ~ docker exec -it homeassistant bash -c "apk add i2c-tools && i2cdetect -y 0 && i2cdetect -y 1"
OK: 267 MiB in 224 packages
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- UU -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- 41 -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
```
## Thanks
Expand Down
4 changes: 2 additions & 2 deletions custom_components/ina219_ups_hat/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def _update_data(self):
# power = ina219_wrapper.getPowerSMA_W() # power in W

smooth_bus_voltage = ina219_wrapper.getBusVoltageSMAx2_V()
# smooth_current = ina219_wrapper.getCurrentSMAx2_mA()
smooth_current = ina219_wrapper.getCurrentSMAx2_mA()

soc = self._socOcvProvider.get_soc_from_voltage(
smooth_bus_voltage / self._batteries_count
Expand All @@ -90,7 +90,7 @@ async def _update_data(self):
remaining_time = round(
10
* (remaining_battery_capacity / 1000)
/ -(bus_voltage * (current / 1000)), # Smooth power
/ -(smooth_bus_voltage * (smooth_current / 1000)), # Smooth power
1,
)
else:
Expand Down

0 comments on commit c67dd55

Please sign in to comment.