Something new

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
loveleejohn
Experienced User
Posts: 124
Joined: Thu Dec 10, 2015 12:09 am

Re: Something new

Post by loveleejohn » Tue Mar 14, 2017 5:54 pm

Um kgschlosser, I have one of those! Lol. I keep diving into worlds that I no absolutely nothing about! haha. I tried installing some kind of software onto the esp following an online tutorial that I found here, https://smartlifeautomated.wordpress.co ... artthings/. It kind of worked but I could not figure out how to change the ip address to one that could be seen on my subnet since this one was blah.blah.1.1 and my subnet was blah.blah.10.1 so I gave up and the sonoff is now just sitting on my desk laughing at me. I was just about to take it out to the backyard and give it a royal stomping when I read your post. Lol. Oh well. I still don't understand how to make it work but maybe you or someone might one day be able to share a step by step for us slow learners. :)

User avatar
kgschlosser
Site Admin
Posts: 3017
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Something new

Post by kgschlosser » Tue Mar 21, 2017 4:02 pm

I can walk you through how to do some very basic things with it. I could do up something with a temperature sensor as a tutorial. something simple
If you like the work I have been doing then feel free to Image

loveleejohn
Experienced User
Posts: 124
Joined: Thu Dec 10, 2015 12:09 am

Re: Something new

Post by loveleejohn » Tue Mar 21, 2017 6:42 pm

If you do, you will save the life of an innocent Sonoff device! :lol: That said, I know you are super busy so no hurries on this one.

Foune
Experienced User
Posts: 87
Joined: Sun Jul 03, 2011 7:08 pm

Re: Something new

Post by Foune » Fri May 19, 2017 2:20 pm

kgschlosser wrote:I am going to make up a plugin. That will take care of getting the interperter onto the controller but will also take the programming out of doing simple tasks with it like changing states of a pin. Or getting the temperature from a sensor connected to it. And i will set up any communications needed to have it trigger events in EG.

This is going to be awesome.
Hello,

What's up with your plugin?
I just discovered the concept :

- Sonoff hardware that is easy to flash, has a nice packaging/size, and only costs 4$ for the on/off module with 1 button + 1 extra GPIO.
- Esp easy is a very interesting project that provides a web interface and a lot of protocols ready to use : json, mqtt, custom http query, etc.

I ordered 4 modules here, using the coupon "FSONOFF" to get a big rebate :
https://www.banggood.com/DIY-Wi-Fi-Wire ... 19971.html

Now I was thinking how I would integrate it to eventghost. I think the best protocol for sending commands is the basic http command

Code: Select all

http://<ESP-ip>/control?cmd=event,givemesomewater
Then on the esp side :

Code: Select all

on givemesomewater do
  gpio,2,1  // open valve
  timerSet 1,600 // 10 minute timer
endon
I prefer the HTTP over the MQTT method because the POST request implies an acknowledgement from the receiver, which is a efficient way to be sure the order was received.

Now, let's share your point of view about this solution.

User avatar
kgschlosser
Site Admin
Posts: 3017
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Something new

Post by kgschlosser » Fri May 19, 2017 11:06 pm

I can make up a library for it that will allow it to talk via the network event sender and receiver.
If you like the work I have been doing then feel free to Image

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: Something new

Post by pearbear » Sat May 20, 2017 1:24 am

I plan to update my EtherEvent Arduino library to support communication between ESP8266 and the EventGhost Network Event Sender/Receiver plugins within the next couple weeks. However, ESP Easy appears to be much more of a turnkey solution since it allows you to completely control the ESP8266 without needing to write any firmware for it.

I think it would make sense to write an EventGhost plugin that interfaces with ESP Easy. The ESP8266 could be very useful to EventGhost users in so many ways. The price is excellent and the community support for this part has gotten very good. The plugin could offer an easy introduction to using ESP8266, then later if the user finds they want a custom firmware it won't be such a steep learning curve.

User avatar
kgschlosser
Site Admin
Posts: 3017
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Something new

Post by kgschlosser » Sat May 20, 2017 1:53 am

the only issue with the sonoff modules is their lack of a USB you are going to need an FTDI TTL serial to usb. you will need one that has a switch on it for 3.3 or 5 volts. this is the only way you will be able to flash the thing.
If you like the work I have been doing then feel free to Image

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: Something new

Post by pearbear » Sat May 20, 2017 2:11 am

Needing to buy a USB-serial adapter is no big deal, you can get one for ~$1 USD with free shipping on Aliexpress or eBay. It's unfortunate to have to solder the header though. It's easy enough but not every EventGhost user is going to necessarily want to buy a soldering iron and solder just to be able to install the firmware. You could actually probably get by with just poking the jumper wires through the correct through holes and holding them at an angle to make a connection. You could also make a pogo adapter if you had a lot of the modules to flash.

User avatar
kgschlosser
Site Admin
Posts: 3017
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Something new

Post by kgschlosser » Sun May 21, 2017 6:07 am

the esp is pretty sensitive to a crappy connection. I had issues with the wires being to long and using a bread baord. sometimes it would error when flashing sometimes not.
If you like the work I have been doing then feel free to Image

Foune
Experienced User
Posts: 87
Joined: Sun Jul 03, 2011 7:08 pm

Re: Something new

Post by Foune » Mon May 22, 2017 7:33 am

kgschlosser wrote:I can make up a library for it that will allow it to talk via the network event sender and receiver.
If you do so, will you make an aknowledgement system or should we rely on the TCP/IP acknowledgement stack to make sure the messages are transmitted?

The acknowledgement system would require a plugin on the EG side but I'm not afraid of that.

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: Something new

Post by pearbear » Mon May 22, 2017 7:46 am

kgschlosser wrote:the esp is pretty sensitive to a crappy connection. I had issues with the wires being to long and using a bread baord. sometimes it would error when flashing sometimes not.
It's not a huge issue for ESP Easy because you only need to get one successful flash and after than you can do any firmware updates OTA. I think their firmware is pre-compiled so it should be pretty fast. However, the failures could certainly cause distress and confusion to people who don't understand why it's happening.
Foune wrote: If you do so, will you make an aknowledgement system or should we rely on the TCP/IP acknowledgement stack to make sure the messages are transmitted?

The acknowledgement system would require a plugin on the EG side but I'm not afraid of that.
A plugin isn't absolutely necessary for an acknowledgement system. I just have one set up in my EG tree but it would be better if it was hidden away in a plugin, which would also make it easier to share. I do have a companion queue library for my Arduino library that includes an ACK system. So the code on the ESP8266 side of things is mostly finished, though I know it's done in a very amateur fashion. It might just need some small changes to make that library compatible with ESP8266 because it was originally written for AVR microcontrollers communicating over Ethernet.

Foune
Experienced User
Posts: 87
Joined: Sun Jul 03, 2011 7:08 pm

Re: Something new

Post by Foune » Mon May 22, 2017 9:11 am

Can you explain me your ack method in eg? Are we talking about the same thing?
--> e.g sends an order to the ESP, then wait for an ack, and retry x times in case of timeout.

Do you use threads? How do you manage a communication failure? I don't feel the need of an ack in the other direction (ESP -> e.g)

Appart from this, if "we" customize the esp easy library, we can ad these features from this guy :

- Multiple SSID management, set up via MQTT messages.
- Extra GPIO On/Off of SONOFF modules.

It's just a suggestion.

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: Something new

Post by pearbear » Mon May 22, 2017 1:21 pm

Every event has an ID number, which is part of the payload. When the event is received an ACK event is returned with the ID number of the received event as the payload. The user can configure the event type when sending it:
  • eventTypeOnce - Attempt to send the event once and remove it from the queue so whether or not the message was sent successfully or an ACK is received is irrelevant.
  • eventTypeRepeat - Resend the event until successful then remove it from the queue.
  • eventTypeConfirm - Resend the event until an ACK for that event ID is received, then remove the event from the queue.
This results in multiple layers of confirmation:
  • The internal workings of TCP/IP, which ensures that the packets went somewhere.
  • The Network Event Sender/Receiver "quintessence" protocol, which ensures that the event was received by something that can correctly negotiate that protocol and has the correct password.
  • My homebrewed ACK system, which ensures that the event was correctly processed.
Since I'm only communicating over my local network I have added an option to my library and modified EG plugin to disable password authentication so that eliminates the second layer of confirmation. So if you're using the authentication system you might consider that to be enough of an ACK. I don't use the ACK system for every event but there are certain alarm events in my system that are very important for me to make sure get correctly received and handled. These may be sent from my microcontroller based nodes to my PC, the PC to the microcontrollers, or from microcontroller to microcontroller so I want the option everywhere. My ACK system in EG is actually much more crude than in the queue library code running on the microcontrollers because I'm better at writing C++ than Python. I need to do more work on the EG side of my system. I try to make my system as resilient as possible. Rather than relying on the code being perfect, I want it to be able to handle errors gracefully, log the issue, then carry on. This allows me to feel more free to continually do development on the system I rely on.

Foune
Experienced User
Posts: 87
Joined: Sun Jul 03, 2011 7:08 pm

Re: Something new

Post by Foune » Mon May 22, 2017 2:08 pm

That's more than I expected. Sounds great. I'm officially a beta tester.

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: Something new

Post by pearbear » Mon May 22, 2017 2:27 pm

OK, I'll update this thread as soon as I get ESP8266 support added to my libraries. The current code is limited to communication over Ethernet, which is my usage of it, but the low price and popularity of ESP8266 has led me to realize that I need to make it more generally useful. You can buy three ESP8266 boards for the price of an Ethernet module and AVR microcontroller board and the ESP8266 is much more powerful. Unfortunately to add support for more network interface options I need to break the previous API of the library and make it a bit less user friendly because less of the network handling code can be hidden away in the library. So I'm trying to get the Ethernet-only version of the libraries as polished as possible before I cease development on that branch and move forward with the new "2.0" version that will support ESP8266.

Post Reply