WouterTuinstra / Homeassistant-Growatt-Local-Modbus

Provides Home Assistant sensors for Growatt inverters that you can connect directly using modbus protocol
Apache License 2.0
25 stars 13 forks source link

Growatt modbus serial #23

Open okanano opened 7 months ago

okanano commented 7 months ago

Hi,

I'm creating a new integration to Growatt Model M6000HX-48-BP using Home Assistant and serial port /dev/ttyUSB0. Once I defined the serial port parameters I checked the log and found the following error:

WARNING (MainThread) [custom_components.growatt_local.API.growatt] Inverter Modbus version not default supported.

Any hints?

Saentist commented 7 months ago

Under "Serial" what are you men RS232 ? Because Growatt use Modbus RS485

okanano commented 7 months ago

Under "Serial" what are you men RS232 ? Because Growatt use Modbus RS485

I'm using RS485, I mean Serial during the configuration as Communication Layer, then I defined the serial port parameters, but I checked the log and found this warning:

WARNING (MainThread) [custom_components.growatt_local.API.growatt] Inverter Modbus version not default supported.

WouterTuinstra commented 7 months ago

The full logs should actually give you more info about the device data received.

You could also make an example.py with the following code which should be located in in the growatt_local/API folder. In order to run it make sure you have the dependencies installed

import asyncio
from growatt import GrowattSerial, get_device_info 

growatt = GrowattSerial("/dev/ttyUSB0") # optional other serial port configrations

    1 # Inverter modbus adress 

async def main():
    await growatt.connect()
    modbus_address = 1 # default address should be 1 but depends on inverter
    result = await get_device_info(growatt, modbus_address)

    print(result)

asyncio.run(main())

If the result from the above example is nothing check modbus_address or the physical connection

okanano commented 7 months ago

The full logs should actually give you more info about the device data received.

You could also make an example.py with the following code which should be located in in the growatt_local/API folder. In order to run it make sure you have the dependencies installed

import asyncio
from growatt import GrowattSerial, get_device_info 

growatt = GrowattSerial("/dev/ttyUSB0") # optional other serial port configrations

    1 # Inverter modbus adress 

async def main():
    await growatt.connect()
    modbus_address = 1 # default address should be 1 but depends on inverter
    result = await get_device_info(growatt, modbus_address)

    print(result)

asyncio.run(main())

If the result from the above example is nothing check modbus_address or the physical connection

Hi @WouterTuinstra,

I created and executed the python file, and got the following error:

WARNING growatt:368 Inverter Modbus version not default supported. Check full logs to get device information using the supported protocols. None

WouterTuinstra commented 7 months ago

Off course annoying Python default logging starts at warning while on info level it would actually show you the device info it gets. Do you get to the device info screen? because if configure your protocol it should make a entry.

Only other reason I can think of does Home Assistant have rights to access to the device /dev/ttyUSB0?

import asyncio
from growatt import GrowattSerial, get_device_info 
import logging

logging.basicConfig(level=logging.INFO)

growatt = GrowattSerial("/dev/ttyUSB0") # optional other serial port configrations

    1 # Inverter modbus adress 

async def main():
    await growatt.connect()
    modbus_address = 1 # default address should be 1 but depends on inverter
    result = await get_device_info(growatt, modbus_address)

    print(result)

asyncio.run(main())