assembly12 / Foxess-T-series-ESPHome-Home-Assistant

Read out Foxess T-Series Inverter to Home Assistant by using ESPHome
34 stars 7 forks source link

Regarding compatibility with F and S series #14

Open pablonajarrofever opened 1 year ago

pablonajarrofever commented 1 year ago

Hi,

In the project's wiki it's mentioned that, though not tested, it probably works also in F and S-series.

However, the pinout for the invertor connector seems to be different, as can be read in the User Manuals of the different series (https://www.fox-ess.com/downloads/#1608629474343-a4d4beb2-71e3; page 16 of F Series User Manual, for instance).

In F and S-series pin 7 is “NC” (not connected), it doesn’t supply the +12V as in T. And pins 1 and 2 are used for CT (the Current Transformer sensor of the AC line); so we cannot access RS485 through these pins. Pins 3 and 4 are, in all three series, assigned to Meter 485. I wonder if their usage is restricted to the connection of a limiting meter, as explained in the manuals, or they are also available for plain RS485 connection. That would allow me to use this setup, though wiring (and powering of circuits) should be different.

Thanks and regards

assembly12 commented 1 year ago

Hi, yes sadly you are correct. It probably doesn't work with F and S series. At the time I thought the pins labeled with 485- and 485+ would broadcast the serial connection of the inverter. But as it seems, these contacts are meant to be connected to an export limiting meter. I will remove the suggestion that this might work with F and S series from the wiki. Thanks for bringing this to my attention and I'm really sorry if I caused you to have false hope! You might still be able to tap into the RS485 line of the wifi dongle, but thats something I'm not willing to try out for myself at this moment.

Eng65745 commented 1 year ago

Hi,

I also have a Photovoltaic installation with a FoxESS F-Series inverter installed recently, and have just found this thread. Could you clarify the point of "tapping into the RS485 line of the wifi dongle" in the previous post? Does the dongle connect to the inverter through a RS485 connection? or does it provide a RS485 line itself ? (how?, where?)

Let me cling to the hope you so kindly mentioned above...

Regards

assembly12 commented 1 year ago

Hi, the dongle probably connects to the inverter via RS485. I don't have an F-Series, so I can not say for sure. Even if you are able to connect to this serial, the protocol on this connection must be same. So no guarantee of succes. One way to go about it, might be the following. If you can get hold of a second wifi dongle (for cheap), you could flash it with esphome. If you're lucky it should work right away. But still no guarantees whatsoever. Only downside is, you can't connect to the Foxess cloud anymore.

SibrenVasse commented 1 year ago

Hi! I also have a F-series inverter. I have captured the network traffic between the WIFI dongle and the cloud server. One of the data packets that I captured seemed to match the specification in the header file. (Size 165 and 0x7E7E ... E7E7) Next I tried decoding some fields that were of interest to me: pv1_voltage_value, pv1_current_value, today_yield_value, total_yield_value. The resulting values all matched those displayed in the app. So the protocol seems to be at least very similar.

The dongle is connected by 4 pins to the inverter. So probably those would be two data lines, VCC (probably 12V, as the side of the dongle says 7v-12v dc) and ground? This would suggest it would be possible to wire the hardware setup on the wiki to this port.

SibrenVasse commented 1 year ago

Update: The dongle has 4 connectors. Outside, on the connector they are labeled 1-4. Inside, on the PCB they are labeled: 1: + 2: - 3: A 4: B

There is a SMD ESP-WROOM-02U inside.

Eng65745 commented 1 year ago

Hi,

This is to confirm the assumption by assembly12 that wifi dongle connects to inverter by RS485, as stated in a FoxESS official datasheet, product specifications, last line: "Communications Method: RS485".

smart-wifi datasheet.pdf

Thanks to both assembly12 and SibrenVasse, your posts are very helpful to achieve data collection directly from the inverter instead of FoxESS Cloud that, by the way, seems to experience frequent outages not being accessible for several hours (though it keeps collecting data). Last time, yesterday May 1st.

assembly12 commented 1 year ago

ok. That looks very promising! It looks like this repo will work on the wifi (usb) bus as well. The hardware setup as described in the wiki should work, only the connector has to be swapped to usb. If anyone is willing to try this out, im happy to assist.

SibrenVasse commented 1 year ago

Just to be clear: the wifi dongle is not connected via the USB port of the device! The USB port is only for mass storage devices for a fimware upgrade of the inverter.

The connector is screwed into the inverter with a connector that looks like this one: https://m.media-amazon.com/images/I/61-1h5O01KL._AC_UF1000,1000_QL80_FMwebp_.jpg The dongle is the female side, the inverter has the male connector.

I'm looking into the exact size of this connector and see if I can order one and try it with the hardware described on the wiki.

Eng65745 commented 1 year ago

In case it helps: I found these drawings with the exact sizes of the connectors SibrenVasse show (it seems they are commonly used for microphones and in aviation, in a local store they cost between 2 and 3 euros). I attach two versions of the male connector, the one to mount on a chassis and the one to attach to a cable (exactly the same dimensions as the female, it seems).

connector_4pins_female_for_cable connector_4pins_male_for_chassis connector_4pins_male_for_cable

Eng65745 commented 1 year ago

Sorry, dimensions for male and female cable connectors are NOT the same (they shouldn't or they won't fit!)

Eng65745 commented 1 year ago

Hello,

I had the chance to measure the Wifi dongle and compare to the audio-type connectors shown by SibrenVasse or myself in previous posts.

The body of the dongle connector is sligthly larger (by 0.2 mm, aprox) than the audio-type connectors. In fact, I tried to plug one audio-type connector into the inverter and it fits, pins match, but the slight difference leaves the connector a bit loose; in vertical position it would slip out. Maybe a couple of turns of tape would make for the difference and the connector would stick.

The real difference is on the fastening nut; the dongle's nut is 22.4 mm in diameter, the audio-type connector's nut 18 mm.

Also, labelling of pins is different - pairs 1 & 2 and 3&4 are reversed.

In summary: one of these conventional audio-type connectors can be plugged into the inverter, pins will match, but it cannot be fastened, so it would require some element to keep it firmly in place.

SibrenVasse commented 1 year ago

I have ordered this connector: https://nl.aliexpress.com/item/1005005256853917.html

Unfortunately, this listing on AliExpress has become much more expensive since I ordered.

This connector fits on the inverter and you can tighten the screw. The only thing is the indentation on the side of the connector is a little bit too small, so disconnecting it from the inverter is a little bit difficult. You can probably widen this indentation by filing it down to make it fit better.

Eng65745 commented 1 year ago

Hello SibrenVasse,

I've noticed the reference from aliexpress is a package of 10 pairs of male-female connectors. If after you've completed your project you don't have an use for some of them, I'd be glad to purchase a pair from you and help you to recover costs.

SibrenVasse commented 1 year ago

I'm sorry but there used to be an option to only buy one. So I only ordered one connector!

SibrenVasse commented 1 year ago

All parts have arrived, so I have completed building the hardware as specified on the wiki. I will report back with my results.

build

SibrenVasse commented 1 year ago

Seems like the lines that output 12V when the dongle is connected, do not supply VCC when I only connect the buck converter. Any ideas? Maybe some form of communication over the RS485 connection is required for it to start supplying 12V?

SibrenVasse commented 1 year ago

Success! My ESP is connected to the inverter and is supplying Home Assistant with data!

A few notes:

image

assembly12 commented 1 year ago

Very well done! So to verify; you are using the exact same code, or have you altered anything?

So it should probaly be possible to flash the orignal Wifi dongle with ESPhome as well. Perhaps that's an option for the hardware issues (expensive connector, power supply).

SibrenVasse commented 1 year ago

Yes, exactly the same code. No alterations. I only changed the SSID etc. in the .yml file.

Flashing the original dongle is definitely something that should be possible. It looks like there is a TTL 'port' on the PCB. (Four unpopulated holes)

bubupol commented 1 year ago

Great Work ! Thank you for Sharing.

Have you tried The Wifi dongle and the ESP32 connected at the same time ? (that keeps the FOXESS cloud data as back up and software upgrade possible, alarms etc...)

SibrenVasse commented 1 year ago

I have not. I believe RS485 should be able to handle multiple devices. Not sure if it will work in this case though.

Eng65745 commented 1 year ago

I want to add my thanks to SibrenVasse for his contribution to this topic. Now it's possible to feed inverter data directly to our HA (or other platforms) installation.

Also it opens the door to other possibilities: hacking the wifi dongle to send data directly to HA instead of to FoxESS cloud, as assembly12 suggested (so no extra hardware would be neccesary). Or connecting both wifi dongle and our local ESP-based hardware (it would requires some expert knowledge on how RS-485 multidrop works), so we feed both our HA and FoxESS cloud, as bubupol mentions. Or using our local ESP to send data both to our HA and FoxESS cloud (keeping the manufacturer connected could be important for support and warranty issues).

Thanks a lot to all who show the way to those of us with less skills!

bubupol commented 1 year ago

Hello, success too ! on a F-series inverter (F6000). The data is received every 90 seconds. For now i used an extra power supply for testing, I wired it in parallel to the wifi dongle. so both are working.

thank you all.

velk101 commented 1 year ago

Also working on a F3600 with the same delay of about 90 seconds, just connect to the solder pads black and white wires rs485

IMAG0362

WiFi dongle IMAG0361

mattwilson1066 commented 1 year ago

When you say you wired in parallel, have you got any photos of how you did this? do you mean you have the original dongle connected, but then taken A/B feed from the dongle? And do you think that would work by then connecting directly into something like a https://www.waveshare.com/usb-to-rs485-b.htm I currently use one to connect to my H1, so could try that or get another and wire up the F4600 into a 2nd one.

velk101 commented 1 year ago

If you open up the dongle with the two screws, you'll see the four wires soldered to the PC Connect to the white wire which is A on the RS485 Connect to the black wire which is B on the RS485 You then can run the WiFi and have an RS485 to your PC

mattwilson1066 commented 1 year ago

If you open up the dongle with the two screws, you'll see the four wires soldered to the PC Connect to the white wire which is A on the RS485 Connect to the black wire which is B on the RS485 You then can run the WiFi and have an RS485 to your PC

Amazing thank you, I will have a look over the weekend and see what I can get working.

velk101 commented 1 year ago

I drilled a small hole in the bottom of the case for four wires to come out, i then fitted a small 4way connector so i could disconnect it when i got bored with it lol

mattwilson1066 commented 1 year ago

Hi All, I have drilled the hole in the wifi dongle and soldered the cables to the A/B cables. Can I take these cables directly from the Dongle to a https://www.waveshare.com/usb-to-rs485-b.htm to access the data from the F series inverter? Is anyone able to advise how or which integration I should use to access the data via this method? (if its possibe) I can see there is mention of the ESP board, but does the code need modifying to work with USB to RS485 board? Sorry this is a little out of my ability, but am happy to try and report back. Thanks All

frankol commented 11 months ago

ive got a S-series and the communication datasheet from fox. Seems to be the same as the t-series since it looks similar to t-series. @assembly12 do you have a datasheet too, so i could send you mine to compare? Because the names in my document look little bit different. In your .h file it calls loads_power and in my recieved document its called loadspower

EDIT: i connected it to the usb dongle and now i see all values. Seems its possible to speed up the polling inverval, but i need some help. The documentation say:

image image

Request to read command
Slave address       1byte   0x01
Instruction Code    1byte   0x04 Read Holding Register, 0x03 Read Input
Register Register   1byte   high
start address       1byte   low
Number of registers 1byte   high (max. 125)
                    1byte   low (max. 125) 

Answer read command
Slave address 1byte 0x01

i want to make a button and send a hex string to request data, but im not smart enough to get a working one. This i tried yet:

button:
  - platform: restart
    name: "Foxess inverter restart"
  - platform: template
    name: request data # RFSE
    id: inverter_request_data
    on_press:
      - uart.write: [0x7F, 0x7F, 0x11, 0x03, 0x01, 0x7D, 0xF7, 0xF7]

but its not working ofc.

Any ideas?

assembly12 commented 11 months ago

Hi, this protocol doesn't allow polling. You are bound to the 1.5-2 minute update inverval.