mb-software / esphome-huawei-r4850

EspHome Component to control a huawei r4850 power supply via CAN bus
MIT License
16 stars 4 forks source link

MCP2515 and ESP8266 #2

Open futschikato opened 11 months ago

futschikato commented 11 months ago

Thank you for the code. I have tested it successfully with an ESP32 and a TJA1051 board (with 5V power supply). In contrast, with an Esp8266 and a MCP2515 board via SPI, I could only read data for about 20 seconds, after which no more data arrived. Additional question: I am a newbie in EspHome. How can I control the current along with the button e.g. with a mqtt command?

mager33 commented 7 months ago

voltage/current control works; of course, you have to activated the proper protocols. It was made to interface with HomeAssistant. Look here: https://esphome.io/components/mqtt.html PS: without HomeAssistant it is important to remove "api:", or the ESP will reboot, desperately trying to find a HomeAssistant instance...

jdrescher2006 commented 6 months ago

I am trying to get the same setup to work. So I have a D1 mini and a MCP2515. First I tried to run this project: https://github.com/KlausLi/Esp-HuaweiR4850-Controller/tree/main. The connection is done exactly like supposed: wiring And then everything works just fine, the values from the R4850 can be written and read.

Now with this project I kept the same wiring but there is no data from the R4850. What I noticed is the R4850 has a connection break LED. This LED is off if I disconnect the R4850.

Relevant part of yaml looks like this: spi: id: McpSpi clk_pin: GPIO14 mosi_pin: GPIO13 miso_pin: GPIO12

canbus: - platform: mcp2515 id: my_mcp2515 spi_id: McpSpi cs_pin: GPIO15 can_id: 0 use_extended_id: true bit_rate: 125kbps

huawei_r4850: canbus_id: my_mcp2515 update_interval: 5s

image

mager33 commented 6 months ago

I succeeded with the recommended transceiver sn65hvd230

jdrescher2006 commented 6 months ago

No the sn65hvd230 cannot be used for the esp8266. This is because the 8266 does not have a build in can controller.

mager33 commented 6 months ago

The ESP32 is so cheap, just go for that and use your time to solve other problems :-)

jdrescher2006 commented 6 months ago

Yeah its cheap but has also more power consumption as esp8266. Anyway it seems the best solution to give up on that and stick with esp32. But that does not work either, see my new issue.