Hi there,
I have a Growatt Mic600 Inverter and I can read and control a lot of it over Modbus. I’m also able to switch off the inverter with a switch, but I can’t turn it back on. From Growatt cloud website, it’s possible to shut off and on, so I think ESPHome is messing up the register value.
Is it possible to send custom values for “on”, as example 01 or 0101 instead of 1?
Here’s my relevant config: (could post full yaml, but all other values work)
It’s a switch, so it’s either on, or off.
It’s possible to switch off and on within the Growatt Cloud, this is communication to esp07 and send command over USB port. All other commands, like set max % power, set inverter model (2kw instead of 600w ), read values and so on working without problems.
If you look into different PDFs, it could be they have 0/1, 00/01, 0000/0001 or 0000/0101. I just wanna try which value could work because more then me can confirm, the switch is only possible to switch off and the cloud is able to switch on again.
I’m not beginner with modbus devices. But newer tried to use “switch” to write register. Hell knows how it’s implemented…
Do you have some “pdf” for your protocol?
Can you show yaml for one of your holding register write commands, that works?
and from the switch, “turn off” is working too. I also tried “coil” instead of holding.
But if you know a bit about modbus, to you might know how to log when I set the register over cloud interface? (Not sure if I can turn on standby on mobile app.)
You are a genius! You gave me exactly the right input to solve 90% of my problem! The problem is the switch and holding register.
I created a new select drop-down, mapped to on:1, off:0 and that works!
I would need to dig into the Modbus components to find out. Maybe it’s the difference between writing to coil or holding register vs value type u_word. The actual value 0/1 is the same in both, so it has to be the way it’s written.
Modbus select is
U_WORD: unsigned 16 bit integer from 1 register = 16bit
And switch holding
holding: Holding Registers - Holding registers are the most universal 16-bit register. They may be read and/or written. Modbus Function Code 3 (Read Holding Registers) will be used.
I’ll create an issue on GitHub tomorrow and explain the problem there too. Maybe one can explain the difference in writing.
Esphome documentation for writing registers is really awful, I wouldn’t be surprised if somebody wrote to (for example calibration) register when intended to read them.
Anyway, this should do it if component implementations are getting too weird…
custom_command: [ 0x01, 0x06, 0x00, 0x00, 0x00, 0x01]
Not that reading is so clear either…
For example, You want read holding register:
If you check the full yaml, you’ll see switch with bit mask 0 and select with on/off. I have both in my code, both work.
But actually I think, using the switch is better then select because it’s a more default behavior.