diff --git a/mqtt_io/modules/sensor/ina219.py b/mqtt_io/modules/sensor/ina219.py index cf02c5d8..8cac1275 100644 --- a/mqtt_io/modules/sensor/ina219.py +++ b/mqtt_io/modules/sensor/ina219.py @@ -11,6 +11,7 @@ # - gain (40, 80, 160 or 320) -> maximum shunt voltage (milli volt) # Optional: # - low_power: send ina219 to sleep between readings +# - i2c_bus_num: if auto detection fails - like on Pi4 # Output: # - power (in watt) @@ -30,7 +31,8 @@ REQUIREMENTS = ("pi-ina219",) CONFIG_SCHEMA: CerberusSchemaType = { "chip_addr": dict(type="integer", required=True), - "shunt_ohms": dict(type="float", required=False, empty=False, default=100), + "i2c_bus_num": dict(type="integer", required=False, default=1), + "shunt_ohms": dict(type="float", required=False, empty=False, default=0.1), "max_amps": dict(type="float", required=False, empty=False), "voltage_range": dict( type="integer", required=False, empty=False, allowed=[16, 32], default=32 @@ -71,6 +73,7 @@ def setup_module(self) -> None: self.config["shunt_ohms"], max_expected_amps=self.config.get("max_amps"), address=self.config["chip_addr"], + busnum=self.config["i2c_bus_num"], ) ## Configure ina sensor with range and gain from config or default