homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 307 forks source link

Sonoff Basic configuration issue #541

Open IamJanS opened 6 years ago

IamJanS commented 6 years ago

Hello, I have a problem that keeps me busy for some days. I have several Homie devices running at version 2.0. Thank you for creating Homie!

I try to setup a Sonoff Basic with Homie, flashing works fine, but I can’t get the device configured with the config.json file.

If I configure the device and it reboots into normal mode I get these errors in exactly these order:

I write the config.json with curl after the first reboot that follows upon a fresh flash (every write described below succeeds with {"success":true} ):

✔ Configured ↻ Rebooting into normal mode... ✖ /homie/config.json doesn't exist

Second try, writing config.json with curl again:

✔ Configured ↻ Rebooting into normal mode… ✖ Config file too big

Third try, writing config.json with curl again:

✔ Configured ↻ Rebooting into normal mode… ✖ Invalid JSON in the config file

Fourth try, writing config.json with curl again:

✔ Configured ↻ Rebooting into normal mode… ✖ Invalid JSON in the config file

Starting from the third write only the message “✖ Invalid JSON in the config file” shows up. This is 100% reproducible for both the Arduino IDE and PlatformIO.

Minimal Homie:

#include <Homie.h>

void setup() {
  Serial.begin(115200);
  Serial << endl << endl;

  Homie_setFirmware("bare-minimum", "1.0.0"); 

  Homie.setLedPin(13, LOW);
  Homie.setup();
}

void loop() {
  Homie.loop();
}

Config.json:

{
  "name": "i034-son-basic",
  "device_id": "i034",
  "device_stats_interval": 60,
  "wifi": {
    "ssid": "XXXXXX",
    "password": "XXXXXXX"
  },
  "mqtt": {
    "host": "192.168.128.7",
    "port": 8883,
    "base_topic": "athome/",
    "auth": true,
    "username": "XXXXXXX",
    "password": "XXXXXXX"
  },
  "ota": {
    "enabled": true
  }
}
timpur commented 6 years ago

Can you try uploading the config.json via spiffs image flashing

timpur commented 6 years ago

This should help: https://homieiot.github.io/homie-esp8266/docs/2.0.0/configuration/json-configuration-file/

carlosarmentac commented 5 years ago

I have the same issue, when I upload tue config via spiffs works ok. But if I delete the config trough Reset Button, then the sonoff enter in config mode, and the issue ocurs again.