ESP-IO

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

ESP-IO

Post by Pako » Mon Sep 11, 2017 11:19 am

Finally I decided to buy the famous ESP8266.
I was wondering what to do about it and how to get to know it.
I thought I could make a universal I / O module.
Here's the result of my familiarization process.
All the information you need on this project can be found on my GitHub.

Pako
Attachments
ESP-IO.egplugin
Vesion 0.0.1
(343.58 KiB) Downloaded 92 times
You know flattr ? You can Image

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

Re: ESP-IO

Post by kgschlosser » Wed Sep 13, 2017 10:42 pm

I can't wait to try this. what language did you write the firmware in for the esp? or did you use the built in firmware?
If you like the work I have been doing then feel free to Image

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: ESP-IO

Post by Pako » Thu Sep 14, 2017 11:30 am

As you can see on my GitHub, this is Arduino sketch, so programming language is actually some version of C ++.
By the way, I just started to do on a new project, which has the working title "Remote ESP-IO".
This is actually the same as ESP-IO, but the device may be in a completely different network than EventGhost, and neither public address nor VPN nor port forwarding are needed. However, in this case, access to the web interface is of course not possible. The web interface is used only for device setup.

Pako
You know flattr ? You can Image

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: ESP-IO

Post by Pako » Sun Sep 17, 2017 6:28 am

A new version of plugin (0.0.2) is available.

Pako
Attachments
ESP-IO.egplugin
Version 0.0.2
(343.59 KiB) Downloaded 88 times
You know flattr ? You can Image

Sem;colon
Experienced User
Posts: 600
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: ESP-IO

Post by Sem;colon » Wed Dec 20, 2017 9:54 pm

Hi Pako,

Setting it up for the first time is a little difficult if you have no experience with Arduino, but after some tries, I got this working :)
Very nice piece of work, thank you so much!
I'd like to report a bug though: When you disable A0, you get errors in the EventGhost log with each action you perform - it's working though.

Code: Select all

22:42:43      Error in Action: "ESP-IO: Toggle pin state: LED1"
22:42:43      Traceback (most recent call last) (0.5.0-rc4):
22:42:43        File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
22:42:43          return self(*args)
22:42:43        File "C:\ProgramData\EventGhost\plugins\ESP-IO\__init__.py", line 656, in __call__
22:42:43          if pin != self.plugin.gpios["A0"][0]:
22:42:43      KeyError: 'A0'
I'm sure that's not too difficult to fix ;)
I use version 0.0.3 from GitHub btw.

Thank you!

Sem;colon
Experienced User
Posts: 600
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: ESP-IO

Post by Sem;colon » Wed Dec 20, 2017 10:03 pm

Ah, almost forgot, I also get this one when I start the plugin:

Code: Select all

23:02:02      Exception in thread Thread-508:
23:02:02      Traceback (most recent call last):
23:02:02        File "threading.pyc", line 801, in __bootstrap_inner
23:02:02        File "threading.pyc", line 754, in run
23:02:02        File "C:\ProgramData\EventGhost\plugins\ESP-IO\__init__.py", line 333, in watcher
23:02:02          self.refreshWebSocket()
23:02:02        File "C:\ProgramData\EventGhost\plugins\ESP-IO\__init__.py", line 360, in refreshWebSocket
23:02:02          self.establishSubscriber()
23:02:02        File "C:\ProgramData\EventGhost\plugins\ESP-IO\__init__.py", line 352, in establishSubscriber
23:02:02          self.Log(self.text.addLstnr, 4)
23:02:02      AttributeError: class Text has no attribute 'addLstnr'

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: ESP-IO

Post by Pako » Thu Dec 21, 2017 12:56 pm

Hi Sem;colon !
I am very pleased that somebody is trying this plugin.
Thank you also for the bug report.
You can download the repaired version of 0.0.4.

Pako

Sem;colon
Experienced User
Posts: 600
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: ESP-IO

Post by Sem;colon » Thu Dec 21, 2017 9:59 pm

Thank you for creating it! :-)
I think I'll build some awesome stuff with these things!

No more errors for now, thank you!!

Edit: OK, here are some... This time not about eventghost ;-)
And maybe they aren't even bugs...
- When you reboot it it always set's the time to "Thu, 01 Jan 1970 08:00:00 GMT" (don't know if it's intended to do so?)
- And the Pin for "WiFi connected" signaling LED doesn't seem to signal anything... it is always off (?) Even though it connects perfectly to my WiFi!
As I said, not sure if it's bugs or not - but even if it is, it's more cosmetic ;-)

It works great, thanks again!

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: ESP-IO

Post by Pako » Fri Dec 22, 2017 6:40 am

Sem;colon wrote:
Thu Dec 21, 2017 9:59 pm
- When you reboot it it always set's the time to "Thu, 01 Jan 1970 08:00:00 GMT" (don't know if it's intended to do so?)
- And the Pin for "WiFi connected" signaling LED doesn't seem to signal anything... it is always off (?) Even though it connects perfectly to my WiFi!
That's weird, I do not get it.
Can you please attach an extract from the serial console after reset?
This should look something like this:

Code: Select all

[ INFO ] Configuring of I / O ports is done
[ INFO ] Start mDNS service ...
[ INFO ] Trying to connect WiFi "XXXXX" (30 s timeout)

[ INFO ] Connected to WiFi "XXXXX". Channel: 1
[ INFO ] Got IP: 192.168.XXX.XX
[ INFO ] Got NTP time: 07:27:24 22/12/2017  Winter Time
[ INFO ] WebSocket client [1][192.168.XXX.XX:49555] connected
[ INFO ] Websocket client [1] authorized !
[ INFO ] Got command: getpinstate(D1)
[ INFO ] Got NTP time: 07:32:24 22/12/2017  Winter Time
Once the line "[ INFO ] Got IP: 192.168.XXX.XX" appears, the wifi LED should light up.
Note:
I mostly use D4 as a wifi LED because it is always mounted (D0 is only on NodeMCU modules).

Pako
You know flattr ? You can Image

Sem;colon
Experienced User
Posts: 600
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: ESP-IO

Post by Sem;colon » Sat Dec 23, 2017 10:34 pm

Hi Pako,

Here it is:

Code: Select all

[ INFO ] Configuring of I / O ports is done
[ INFO ] Start mDNS service ...
[ INFO ] Trying to connect WiFi "IDK" (30 s timeout)

[ INFO ] Connected to WiFi "IDK". Channel: 9
[ INFO ] Got IP: 192.168.0.33
[ INFO ] WebSocket client [1][192.168.0.10:50782] connected
[ INFO ] Websocket client [1] authorized !
[ INFO ] Got NTP time: 23:14:07 23/12/2017  Winter Time
[ INFO ] Got NTP time: 23:15:07 23/12/2017  Winter Time
I can see that the time get's updated by the NTP server.. I guess it just looses the time during reboot.

And for the LED - there are two mounted blue LEDs on the board - one is close to the USB port and one sits on the ESP board: When I select D0 the one close to the USB connector lites up after the device is booted, when I select D4 it happens with the one on the ESP instead, when I select none, boths lit up.
However the LED I connected to the D0 or D4 pin does not.
When I select none and activate D0 for example, the LED conneced to D0 lits up while one of the blue mounted LEDs goes off...
Dunno, looks kinda intended (?), but I thought it would work differently...

I have a NodeMCU 1.0 btw.

Sem;colon
Experienced User
Posts: 600
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: ESP-IO

Post by Sem;colon » Sun Feb 04, 2018 12:38 pm

Hi Pako,

here is my latest project using this plugin: I extended a cheap programmable radiator thermostat to be controlled via WiFi using this plugin :D
IMG_20180128_194907.jpg
(no comments on my soldering skills please ^^°)
I just connected the buttons of it to the chip ;-)
I just used the space where the batteries are usually and put the small chip there, it fit's in very nicely.
The whole thing is powered by the micro USB connector, it's great that the 3.3v output has enough power to supply the thermostat!

Anyway, there is one thing I miss with the plugin to make this run rock-solid...
When the thermostat gets's powered it want's you to configure the date and time, which I don't care about, but you need to set something before you can change the temperature with it...
So what I basically need is a possibility to run a sequence of actions when the device starts, an I'd prefer to do this via EG rather than in the firmware itself ;)
Now, there is an event when a connection is established, but the problem with it is, that the event is also fired when I only restart EventGhost or the router, which results in the thermostat doing crazy things I don't like when executing the sequence, as it didn't loos power...

Would it be possible to pass a variable while connection that is incremented on the chip every time a connection is made to it? So I can determine that is is the first time a connection is made to the chip after it's powered and execute my sequence only then?

Thank you!

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: ESP-IO

Post by Pako » Sun Feb 04, 2018 2:09 pm

Sem;colon wrote:
Sun Feb 04, 2018 12:38 pm
Now, there is an event when a connection is established, but the problem with it is, that the event is also fired when I only restart EventGhost or the router, which results in the thermostat doing crazy things I don't like when executing the sequence, as it didn't loos power...
I think it can interfere in other cases as well.
I'll try to figure out some solution.

Pako

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: ESP-IO

Post by Pako » Thu Feb 08, 2018 10:26 am

I can not find a reasonable solution that would not require firmware intervention.

My solution is as follows:
You have 8 user variables (strings) available. You can read them and change them at will.

cvben
Posts: 38
Joined: Wed Jun 07, 2017 8:30 pm

Re: ESP-IO

Post by cvben » Fri Feb 09, 2018 8:40 pm

Sem;colon wrote:
Thu Dec 21, 2017 9:59 pm
- When you reboot it it always set's the time to "Thu, 01 Jan 1970 08:00:00 GMT" (don't know if it's intended to do so?)
Sem;colon wrote:
Sun Feb 04, 2018 12:38 pm
When the thermostat gets's powered it want's you to configure the date and time, which I don't care about, but you need to set something before you can change the temperature with it...
So what I basically need is a possibility to run a sequence of actions when the device starts, an I'd prefer to do this via EG rather than in the firmware itself ;)
I presume that these two items are directly related to THIS, since the time is unset the device simply defaults to the unix epoch when it resets.
Sem;colon wrote:
Sun Feb 04, 2018 12:38 pm
here is my latest project using this plugin: I extended a cheap programmable radiator thermostat to be controlled via WiFi using this plugin :D
IMG_20180128_194907.jpg
This is awesome! Definitely well done. So a quick question though about the process. I see the power soldered onto the board, I presume there is a similar lead into the esp-io too to power it... but are the wires coming from the board to the esp simply jumpers relaying the the signal?

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: ESP-IO

Post by Pako » Sat Feb 10, 2018 9:35 am

I have added some other actions that allow you to work with device time.
You can try it, the changed files are attached.

Pako
Attachments
__init__.py
Version 0.0.5
(28.59 KiB) Downloaded 42 times
ESP-IO.zip
ESP-IO.ino - version 0.0.5
(8.22 KiB) Downloaded 41 times
You know flattr ? You can Image

Post Reply