[Framework] Homie for ESP8266

Awesome!

For the reset yes, this is a known Arduino for ESP8266 issue (esp8266/Arduino#1017).

@Lee_Berry exactly what was my issue with my Arduino under my stairs for light and motions sensors.

I do not use ESP but an Ethernet shieldā€¦
My lights work with or without Ethernet (stan aloneā€¦) but if thereā€™s and Ethernet and and MQTT connection available I can subscribe and publish command/status/info to my brokerā€¦

This ty of sketch example is really hard to find on google! Espescially without Ethernet.connect function because it hang for 60 second and I want not the light not be responding every time Arduino tā€™check for Ethernet connectionā€¦

@qtronik

" but if thereā€™s and Ethernet and and MQTT connection available I can subscribe and publish command/status/info to my brokerā€¦"

are you after a broker ? im using HiveMQ.com and paho to test the MQTT broker and configuration ā€¦ all very easy to setup.

Guys, I am about to release the v1.4.0. It has, along with a few fixes:

  • The new $uptime device property
  • The ability to subscribe a node to every properties. This is useful for a led strip for example: you will not want to do node.subscribe("1"); node.subscribe("2"); ... if you have a thousand LED. So now, with a fourth parameter to the HomieNode constructor, you can subscribe to everything. See the LedStrip example for a concrete use case

But before, can you please test if your current sketches work / if the new features work without any regression. If you can, thanks. :slight_smile:

Link of the archive: https://github.com/marvinroger/homie-esp8266/archive/7c4f6ba6a3eacf08cac6e3b949d1d7e7c4a8875a.zip

Another question, some of you noticed some frequent MQTT disconnections. I personally donā€™t, but I heard this is a common problem with knolleary/PubSubClient. I am considering, for the v2.0.0, to switch to imroy/pubsubclient, which seems more stable. Do you have any feedback on this library?

My mqtt (Mosquitto) is on my local RaspberryPi with openhab. And a port is open on my LAN and redirected to my services on RaspberryPi so my outside app (android openHab and OwnTracks) have access.

Easy but long learning curveā€¦
For what ever reason my LAN reset or crash I wanted my devices to be standalone. I want my light to be turned on (sensors,switches) without MQTT too!
I donā€™t want my stuff to be dependent to cloudā€¦ If I change something I know it

Has anyone got openhab to work ?

i can use another mqtt client to talk via the MQTT broker and then the device , no problem , light on and off and receiving other properties like $uptime

but trying to get openhab working seem to be painful.
I have cut it down the to basics ā€¦

Sorry for BOLD TEXT below , must be a mark up in the code!!

items file >
Switch light {mqtt="<[broker:devices/1198d5e0/light/on:state:ON:true],<[broker:devices/1198d5e0/light/on:state:OFF:false],>[broker:devices/1198d5e0/light/on/set:command:ON:true],>[broker:devices/1198d5e0/light/on/set:command:OFF:false]"}

sitemap>

sitemap home label="Main Menu"
{
   Frame label="MQTT" {
 
   Switch item=light label="Office Lamp"
  }  
}	

Config 




################################# MQTT Persistence #########################################
#
# Name of the broker as defined in the section MQTT Transport
mqtt-persistence:broker=broker

################################# MQTT Transport ######################################
#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with a id you choose.
#

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
mqtt:broker.url=tcp://broker.hivemq.com:1883

overall very simple , but i can not get openhab to talk to the MQTT server

Thanks

found the problemā€¦ missed of /set in the items , working now ā€¦ 2 days later omg

but interesting the light icons on change with a browserā€™s refresh F5

Hi everyoneā€¦ Iā€™ve just received my Wemos D1 mini boards with relay shield and I was wondering if anyone has done any work getting a nice garage sensor setup?

What Iā€™m trying to achieve is being able to activate the relay via MQTT so that it closes for 1 second and then opens again. In addition there also needs to be an open/close sensor to let me know if the garage door is open or closed at the moment.

I can fumble my way through it but hey, if anyone has already put one together then Iā€™d love to borrow some code that works with homie :slight_smile:

@marvinroger: with the release 2.2.0 of arduino for esp8266 released, is there and good thing that is planed to go into your framework ?

Asking in a general idea :smile:

Yes! There will be support for mDNS querying. In other words, instead of providing the host and port of both your OTA and MQTT servers, you can now provide the mDNS service name if the servers support mDNS, so that it will be discovered automatically. :slight_smile:

1 Like

This is pretty cool.

For those that uses openHAB, I think (not sure on this part tough) openhab2 has a discovery of some sortā€¦ maybe it uses mdns also.

Would be cool to have a openhab binding that would support your frameworkā€¦ would make life so easy on the integration of the modules in openhab :wink:

You misunderstood, I said mDNS querying, not advertising. There is no need for the ESP8266 to advertise itself on mDNS as this is already done on the MQTT broker. So it would be possible to make an openHAB binding that would scan the MQTT broker in order to discover devices. :wink:

oh rightā€¦ queryingā€¦ as in find the mqtt server with a dns nameā€¦ sorry my badā€¦ but still, you be fun to have a binding to find the module and add them to openhab in a easy fashion !

ā€œ/homie/config.json doesnā€™t existā€ !!!

i have configured via the JSON web app etc , works fine.
MQTT broker working fine
Light on and off ā€¦

Great

Go to bed , come back the next night
and
"/homie/config.json doesnā€™t exist" !!!

i have not worked the time frame , but if there is no power for more than 30 mins , the Config is removed
5 mins seems ok

Any ideas ?

Thanks

Possibly something related to this?

thanks iā€™ll give a try

installed new homie library and i get the following compile error

error: ā€˜class MDNSResponderā€™ has no member named ā€˜queryServiceā€™

i can not fined the definition of MDNSResponder , any ideas ?

Thanks

Please download releases, not the git development version.

Hi Homie sounds greeat, just what i was looking for, but a canā€™t get it to configure. checked all dependances in arduino and it compiles and uploads to board.i am using arduino ver 1.6.8. and have tried it on a WeMos D1 R2 and a ESP12E DEV KIT. and get the same error on both.i openā€¦http://marvinroger.github.io/homie-esp8266, and get the ā€œwaiting for deviceā€ i then switch to homie AP and after a few seconds it gets the device info. i then follow the instructions filling in required fields. (do i need http://192.168.0.22 or just 192.168.0.22 in MQTT broker settings)after completing this it says ā€œSending Configurationā€ then ā€œThere was an error while sending the configuration. Please retry.ā€ ihave been trying for 2 evenings now. Hope you can help Many thanks Chris.
P.S. Sorry if i have posted this in wrong place.