|
Post by computourist on Jun 26, 2016 14:18:03 GMT
Last week the shipment from China with my Sonoff units arrived. They have their own switched power supply, are small, cheap and well-built. And they have a socket for flashing the ESP8266 . I adapted the ESP8266 code and it runs nicely on the Sonoff unit. The same message format is used, so this new node is included in Openhab in no time ! The code is availabe at my Github: github.com/computourist/ESP8266-MQTT-client/tree/master/ESP_SONOFF_10I included a wiki to explain how to flash the Sonoff: github.com/computourist/ESP8266-MQTT-client/wikiThere is a red LED on-board that is not used. I connected it to the node output to indicate switch state. When connected to power the node will automatically connect to WIFI and MQTT broker : - when connected to wifi the green LED will light up for one second - when connected to MQTT-broker the green LED will be lit continuously. Have fun ....
|
|
|
Post by greginkansas on Jun 29, 2016 21:41:33 GMT
Nice, I will get a few. Do you feel they are reliable? Any dropouts on wifi? Could a fallover SSID be added?. And thanks for all of your work.
|
|
|
Post by computourist on Jun 30, 2016 8:02:54 GMT
They look reliable. I haven't seen any dropouts. It has a standard ESP8266 on board, so behaviour should be equal to similar devices on the market. Fallover for SSID is not present in my code, but could be added I guess.
|
|
|
Post by computourist on Jul 5, 2016 9:15:57 GMT
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Jul 5, 2016 13:31:14 GMT
This looks very good, computourist. Have you made the same update to dig node?
|
|
|
Post by computourist on Jul 5, 2016 16:58:50 GMT
Not yet... I think I will first try to implement a fall-back to a second Access Point in case of Wifi problems. Once I get that running I'll update the dig node.
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Jul 6, 2016 13:53:23 GMT
Okey, Sounds like a good idea. BTW have you had a chance to look at my pullrequest for input voltage? I've tested it for a while now and it works perfectly
|
|
|
Post by computourist on Jul 7, 2016 19:07:32 GMT
Hi gaute . new release with auto-recovery for wifi and fallback SSI is available on: github.com/computourist/ESP8266-MQTT-client/tree/master/ESP_SONOFF_12In the end I didn't include the voltage readout. Wifi nodes are not very energy-efficient and are not my first choice for battery operated nodes. The Sonoff device is powered by mains, so no need for voltage monitoring...
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Jul 7, 2016 22:07:45 GMT
I see. In my opinion the ESP would be an excellent battery operated node. By using deep sleep you could make reduce the consumption to around 10 uA in sleepmode. If you build it like this: github.com/8n1/ESP8266-Tiny-Door-and-Window-Sensor you get a powerusage of around 300 nA in sleepmode. I'm trying out the last one, and trying to make it work with your code. I will make a new thread as soon as I have any results worth showing! G
|
|
|
Post by greginkansas on Jul 7, 2016 23:29:12 GMT
Thanks, computourist this is looking like a contender to me getting more Insteon modules.
|
|
ragoth
Junior Member
Posts: 64
|
Post by ragoth on Jul 8, 2016 1:55:18 GMT
Congrats and Best Wishes for an early success!!!
|
|
|
Post by AcidBurn on Jul 29, 2016 12:23:53 GMT
Hi, thank you for a great project. What are your future plans? Are you planning any updates or new futures?
Once again ... great project.
|
|
|
Post by computourist on Jul 30, 2016 12:32:15 GMT
Hi, thanks for the kudos ;-)
At the moment I do not have fixed plans for updates or new features. I am playing with the idea to use LORA (RFM95) for extended range (km range) sensor nodes. Up to now no practical steps taken yet... Are there any ideas or requests for new features ?
|
|
|
Post by greginkansas on Jul 30, 2016 13:11:39 GMT
I have been thinking about a two way system. Node sends and then checks that openhab got the msg. This would be the new feature I would vote for. But I'm not sure on how best to do it.
|
|
|
Post by jimkernsjr on Jul 31, 2016 0:01:34 GMT
Hi Greg... I do that now, with rules in OpenHAB. I built a windowshade node out of this! I use a stepper motor out of an old printer, and the roll up shades with the torsion spring. I basically put the end in a bearing, put a gear on the end, and use the worm gear of the stepper motor to drive it. I am doing a couple, but my programming lies around computourists node wakeup message, and when OpenHAB sees that, it sends back the height of the window. Its so I can make more and not have to change all the programs. I want to do a couple windows, but I just ordered a 3d printer to print the boxes, because now I'm doing them out of wood boxes I found in the craft store. But anyway, you could use this idea to do what you are trying to accomplish. I decided to try the ESP8266 out for these nodes because of limited space in the box, and although I don't have one permanently mounted, so far so good! Anyhoo, hope it can help you. If anyone cares, I can maybe upload the 3d file and the code when I get it a little further, but right now it's been not such a mechanically "easy" project - alignment is critical. Hope I can post it soon. Attachments:
|
|
|
Post by greginkansas on Jul 31, 2016 15:40:37 GMT
I do that now, with rules in OpenHAB.
If the msg never gets to openhab how?
I built a windowshade node out of this! I use a stepper motor out of an old printer, and the roll up shades with the torsion spring. I basically put the end in a bearing, put a gear on the end, and use the worm gear of the stepper motor to drive it.
Cool, I want to do the same thing but doing the windows first.
I am doing a couple, but my programming lies around computourists node wakeup message, and when OpenHAB sees that, it sends back the height of the window
Share the code? mines a mess !!
It seems like the node needs to know openhab did not get the msg?
|
|
|
Post by computourist on Aug 1, 2016 8:51:43 GMT
I have been thinking about a two way system. Node sends and then checks that openhab got the msg. This would be the new feature I would vote for. But I'm not sure on how best to do it. Hi greginkansas , the 2-way feature is already implemented. The node will check any transmission by means of an ACK received from the gateway. If no ACK is received the same message is resent up to 5 times. If the message doesn't get acknowledged the variable "retx" is set to true. You could adapt the node code to check this variable in order to see whether your message was received and act on it. I don't use this feature because there is not much you can do on a node level. If a transmission fails it is probably due to a weak radio link, and there is no means to inform Openhab over the same radio link. I agree with jimkernsjr that the proper way to implement this would be in Openhab. For critical operations I would opt for a command being sent by Openhab, and a subsequent check on correct handling by the node. Note that you can instruct the node to reply and acknowledge any command given (change variable setAck to 'true' in line 103 of DHT-code or send an "ON" value to device 5). Openhab would then receive either a reply or an error message (error 90: radio link down) from the node/gateway and you could implement Openhab rules to act on that.
|
|
|
Post by greginkansas on Aug 1, 2016 23:32:33 GMT
Hi greginkansas , the 2-way feature is already implemented. The node will check any transmission by means of an ACK received from the gateway. If no ACK is received the same message is resent up to 5 times. If the message doesn't get acknowledged the variable "retx" is set to true. You could adapt the node code to check this variable in order to see whether your message was received and act on it. I don't use this feature because there is not much you can do on a node level. If a transmission fails it is probably due to a weak radio link, and there is no means to inform Openhab over the same radio link. I agree with jimkernsjr that the proper way to implement this would be in Openhab. For critical operations I would opt for a command being sent by Openhab, and a subsequent check on correct handling by the node. Note that you can instruct the node to reply and acknowledge any command given (change variable setAck to 'true' in line 103 of DHT-code or send an "ON" value to device 5). Openhab would then receive either a reply or an error message (error 90: radio link down) from the node/gateway and you could implement Openhab rules to act on that. On my nodes TX power goes up when a TX does not go through, that with a re transmit of 9 nodes seem to get to openhab. I did not realize we could use retx as a pass fail. I thought it was the number of re transmits. Seems like a openhab rule could be look for a 90 after a send. Can it really be that easy?
|
|
|
Post by jimkernsjr on Feb 10, 2017 6:03:05 GMT
Hi Greg...
Just wondering if you are still struggling with this? Let me know which part, because I'm not for sure where you are stuck. If you want the node to check if Openhab recevied it, create an item in openhab called say called "ack". create a rule that when any data from the node is sent, it turns it on and wait in a loop for a response. Then set up a device back a device to turn it back off in your node sketch. If openhab doesnt get a response, the rule repeats the send n number of times until it gives up. I can send you my code, are you stuck on the OpenHAB part, or the node part? But again, the node already does acknowledgements, so my solution for the openhab going the other way works great for me.
|
|
|
Post by papa on Feb 10, 2017 16:59:08 GMT
jimkernsjr, this sounds very interesting & could be very useful to others.
Could you please provide examples of relevant node code & OpenHAB code to implement this two way feature?
In other words, could you exemplify what computourist outlined plus anything else that might have been needed...
|
|
|
Post by papa on Feb 16, 2017 5:43:19 GMT
computourist, I've been wanting OpenHAB to detect if a regular node (not ESP8266) is offline. I'm not getting anywhere useful on your outlined approach for this ... What would be the items & rules to do the above? Any more changes in the Node sketch besides "change variable setAck to 'true'? Thanks for your attention to this.
|
|
|
Post by papa on Feb 17, 2017 20:25:32 GMT
Computourist, jimkernsjr, & all, As I reported above, I was wanting a way for ANY end node (ESP8266 or NOT) to be reported offline. I tried implementing the ways computourist & jimkernsjr outlined, but was not successful. Then I found an easier, successful way which I documented in this thread: Expire Binding: Have OpenHAB Report Offline NodesThe thread also gives links for Expire Binding documentation so one can use it for other purposes.
|
|