[Framework] Homie for ESP8266

See https://github.com/marvinroger/homie-esp8266/blob/master/docs/9.-Troubleshooting.md#4-my-device-resets-itself-without-me-doing-anything

Just do Homie.disableResetTrigger(); // before Homie.setup() and it should be fine, there are some problems with the default reset trigger on some boards.

There is an issue with Apple products and how they handle CORS, I don’t know what’s wrong. No problems with Windows / Android / Linux…

Thanks, that cured the resets.
Next problem is I can’t get all the nodes I want to work before it crashes. If I have more than 5 nodes, the moment I add the Handler section when it starts to boot it spits a stack dump out on the serial port. If I take it to 8 nodes it doesn’t even try to boot.
Is this a bug or a limitation of the hardware? My plans are:
6 MQTT Operated relays
1 or more 1Wire devices
1 Analogue input.

On the v1.5.0, the max number of nodes is hard-coded (5). You can change this file to change this limit. This limitation will be lifted in the v2.0.0. :wink:

Thanks very much, I’ve found the file on the PC, and will edit it

@marvinroger I have edited the file and it now loads with all the nodes, however once I’ve added the extra items I now see repeatedly on the serial port

 Attempting to connect to MQTT....
 Connected
 Sending initial information... Failed

and on the broker I now only see the $online topic. The temperature value has gone, and I don’t seem to be able to control anything. Removing the additional items makes it work again.

I changed
MAX_REGISTERED_NODES_COUNT = 12;
MAX_SUBSCRIPTIONS_COUNT_PER_NODE = 12;

FURTHER INFORMATION:

It seems that the problem is related to the combined length of all the Nodes added together, by renaming them from names such as Relay1Node to R1N I’ve managed to get the full sketch working, albeit its not as easy to follow now.

Hi @marvinroger,
I’m trying your framework and I think it is great, thanks for you work!
But I have a problem (well, it’s more an openHAB problem):
If you reload your .items file in openHAB, it doesn’t re-read the MQTT retained messages, so I have to reboot the sensors to get them back.
Would it be possible to have them re-set every once in a while (for example every hour)?
Thank you.

im try to load the JSON config file up to the ESP8266 and i get "Invalid JSON in the config file " once the process starts up.

i basically cut/paste the JSON config from the documentation and changed my parameters etc
i have update the associated JSON libraries just incase
here is my config file

{
“name”: “The kitchen light”,
“device_id”: “kitchen-light”,
“wifi”: {
“ssid”: “Ndlink-442C”,
“password”: “"
},
“mqtt”: {
“host”: “192.168.0.150”,
“port”: 1883,
“mdns”: “mqtt”,
“base_topic”: “devices/”,
“auth”: true,
“username”: “leeb”,
“password”: "
”,
“ssl”: false,
“fingerprint”: “CF 05 98 89 CA FF 8E D8 5E 5C E0 C2 E4 F7 E6 C3 C7 50 DD 5C”
},
“ota”: {
“enabled”: false,
“host”: “192.168.1.10”,
“port”: 80,
“mdns”: “ota”,
“path”: “/custom_ota”,
“ssl”: false,
“fingerprint”: “CF 05 98 89 CA FF 8E D8 5E 5C E0 C2 E4 F7 E6 C3 C7 50 DD 5C”
}
}

can anyone see anything wrong with it ?

Regards

LeeB

not sure why but i got the JSON file working
i change the OTA section to the following

“ota”: {
“enabled”: false
}
im not using it any have

but now i get a dump when it is connecting to the MQTT server !! then reboots … con

any ideas ?

Leeb
-------------------------------------- screen dump -----------------------------------------------------------------
• Device ID: kitchen-light
• Boot mode: normal
• Name: The kitchen light
• Wi-Fi
â—¦ SSID: dlink-442C
â—¦ Password not shown
• MQTT
â—¦ mDNS: 192.168.0.147 â—¦ Base topic: devices/
â—¦ Auth? no
â—¦ SSL? no
• OTA
â—¦ Enabled? no
↕ Attempting to connect to Wi-Fi…
Triggering HOMIE_WIFI_CONNECTED event…
↕ Attempting to connect to MQTT…
Querying mDNS service 192.168.0.147

Exception (28):
epc1=0x402163fc epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000004 depc=0x00000000

ctx: cont
sp: 3fff2730 end: 3fff2a40 offset: 01a0

stack>>>
3fff28d0: 4020f9f7 00000030 3fff181c 4020f9ff

Hey @marvinroger, any news on v2?

I’d love to be able to get some battery powered Wemos Di mini temp sensors going… you got any plans/thoughts/advice on how best to approach that without having to replace batteries every few days?

not sure is the Wemos Di mini has the same sleep function as the esp8266 ( software and hardware)

I have used the following technique on a esp8266 12 with a temp monitor …
basically waking up every 30 min to take the temp and post to a server

http://www.esp8266.com/viewtopic.php?f=29&t=2472
https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/example-sketch-goodnight-thing-sleep-mode

hope that helps

anyone help with my crashing JSON file ?

PLEASE :frowning:

finally got it working , the mdns issue

Working on a washer and dryer sensor using a NodeMCU v0.9. I have the basic sketch working for the dryer and am now trying to integrate it with Homie. It connects to WIFI ok, but won’t connect to the broker.

✖ Cannot connect, reason: MQTT_CONNECTION_TIMEOUT 
↕ Attempting to connect to MQTT... 

The test broker is Mosquitto running on a laptop with Mint 16. I am able to connect and publish to it fine using MQTT.fx from a Windows laptop. I have tried flashing with the minimal Homie sketch and get the same thing.

And an FYI, earlier in the thread there was discussion of the web configurator not working with Apple devices. The same problems appears with Firefox on Linux. Chrome worked fine, however.

:: EDIT ::
Just wanted to update; I brought my sensor home and reconfigured it to connect to my production broker and it connected just fine. I now have it working with OH.

If anyone is interested, I can share my sketch once I have everything up going %100. For the dryer I am using a SW-420 vibration sensor. It took me a while to figure out how to successfully “debounce” it since the signal is pretty erratic. I also included delays for registering on and off so that it won’t be triggered as on with random bumps and won’t be triggered as off immediately if you open the dryer briefly to check on something.
I’m hoping to use a photoresistor to monitor the end of cycle light on the washer since didn’t really seem to be a good way to use vibration given the varying cycles that it will go through. I’m still waiting on parts for it though.

It’s progressing slowly but surely! Custom settings will be a great addition, and there will also be a way to update the configuration remotely. There is a blocking issue though and I am not the project maintainer, so I cannot give you an ETA anyway.

The Wi-Fi connection time has been reduced from 3-4 seconds to 1, and the new MQTT asynchronous connection is also faster (a matter of milliseconds). Other than that, your approach will be the same as any Arduino sensor. :slight_smile:

With Homie for ESP8266 v1.5.0? The Web Configurator issue is still a mystery…

1 Like

@Chaos @kevin @PointandClick you said you had problems with the Web Configurator not working in the last step. If possible, could you please open your browsers inspectors (like F12 on Chrome), and report the headers sent as an OPTION request to the /config endpoint? It will probably appear in the Network tab or something. I might have identified the cause, it seems not all devices same the same headers, and CORS responses need to explicitely list each header sent.

Hi Marvin,
I’m no longer using Homie so I can’t help. Good luck finding the problem, in my case it was ios9 on an iPhone 6 that gave the problem.
Cheers
Kevin

1 Like

Has anyone got Homie on the Ecoplugs?

Would make a nice Plug under $20

Reading the documentation, also has a watt usage chip on it.

It has a ESP8266 which can be flashed.

1 Like

Not Homie, but I have ESPEasy running two Ecoplugs successfully for several months now. Fairly straightfoward to flash other than needing to solder leads onto the chip.
I tend to use ESPEasy for “simple” things like sensors and basic switches because it’s quick and easy. Homie is nice for stuff like my laundry sensor where I need to put some additional logic into the device.

I kick myself for not buying more of the plugs when they were on sale at Home Depot, $8 for the two pack. At the time it wasn’t sure if they were going to be successfully modded though so it could have been $8 bricks.

Looks like Itead/Sonoff have released a few more products… I do like the idea of the one with real time power usage reporting.
I can’t tell from the webpage but can anyone see serial headers for reprogramming with Homie?

https://www.itead.cc/sonoff-pow.html

EDIT : Looks like it does still have serial headers for reprogramming!

2 Likes

Amazing! I just received my Sonoff and S20 modules for testing and after being very happy with the results thought “If it now had consumption measurement, it would be the perfect device.” :octopus:

Regarding programming, one can see the four-pin header in the picture and it’s specifically named in the schematic https://www.itead.cc/wiki/images/5/52/Sonoff_POW_Schematic.pdf :thumbsup: