Tips welcome, ESP for ESPHome with serial Interface to Arduino MEGA for Pins

So from a conservative standpoint I am totally with you. Especially since I have the cables already in place. I am/was searching for a different solution that allows me to use code from a group of capable programmers instead of my own less pair programmed and checked code.

We will see what solutions it will be, but it seems that I will stick to Ethernet…

No ignorance :wink:

In my point of view, it works already, have all the mechanism for json publishing/receiving, discovery, system monitoring, log management …
And has been proven by users.

Sounds good, I’ll have a read tomorrow to ask more specific questions… :wink:

1 Like

Some tracks to follow:

  • ZactuatorONOFF enables to control the GPIO output by pushing a json with the gpio number and the state

  • ZsensorADC for ADC reading

  • A PWM implementation for LED

  • ZsensorGPIOinput
    For GPIO reading, currently support one GPIO, we should make it more modular by accepting a list of GPIO from an MQTT command with a json file like used here, if the config message is published as retained it will be stored by the broker.

We can continue the discussion here if you want

Soooo, I had a look at the code and found the following things that I would need to change/add:

  • There is no support for an Ethernet shield yet, this needs to be coded
  • Adding Pins seems to be limited to a few/one pin per “addon”
  • My DHT sensors are supported, but with limited pins
  • There is a fastled implementation (WS2812)

I found the following features:

  • Autodiscovery in Home Assistant is implemented
  • MQTT is implemented with functions to monitor the MQTT state and the ability to reconnect on failure
  • WLan is implemented with reconnection features

Which leads to this:

  • Is the code able to handle more than one pin per “Addon” (ADC,GPIO,PWM,…)
  • I am able to code the Ethernet functionality. Still this code will need poishing to be able to be committed. How do you handle this over at OpenMQTTGateway?

Cheers,
Christian

PS.: Yes we should continue afterwards in the right forum :wink:

You have support for the W5100 on Arduino UNO or MEGA. For ESP32 it has to be done.

Yes

Yes

We need to modify it for that, I can help you if needed, note that PWM is in progress, I encourage you to give comments in the PR if you have.

PS.: Yes we should continue afterwards in the right forum :wink:

It will avoid some spam :wink:

Florian

Hey @CeeCee thought I’d go ahead and try to create an MQTT set up with an esp32, few headaches having no idea what I was doing but got there in the end: MQTT no callback - PubSubClient - ESP32 snippet of the Arduino code/some pointers.

had to set anonymous: from false to true in the configuration for MQTT in the supervisor menu

logins: []
anonymous: true
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

added the following to the configuration.yaml:

mqtt:
    broker: 192.168.0.200
    username: !secret mqttUserName
    password: !secret mqttPassword
    
light:
  - platform: mqtt
    name: "Office light"
    state_topic: "office/light1/status"
    command_topic: "office/light1/switch"
    payload_on: "ON"
    payload_off: "OFF"
    optimistic: false

Dear @mishaVee,

thanks for your code. My problem is not to get MQTT running on my Arduino, this works happily until the reset is necessary.
I am thniking of shifting to another form of code to gain more stability. OpenMQTTGateway seems to be a good solution, since it handles all the maintenance (still connected? reconnect necessary? reconning,…) out of the box, and it integrates well into HA (so they say :wink:).

If I go for ESPHome, I will use arduino code for the low level functions and communication to the ESP and the ESP presents Sensors to HA as usually done by ESPHome.

Hi
Have you got you system to work?
what way did you choose to go?