Telnet Type Data to Domoticz Help Topic is solved

Everything about esp8266 and more.

Moderator: leecollings

NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Telnet Type Data to Domoticz Help

Post by NickHead »

Hi All

Reposted in this section because of lack of interest.

My inverters have RS485 out giving me Solar Info.

I currently use RS485 to RS232 converters to the PI and to Domoticz giving me all the data.

However, I am going down the route of RS232 to Wifi Bridge Mode using an ESP8266 01.
That's up and running. It converts RS485 down to a stream, accessible by using Telnet (rather old)
i.e Telnet 192.167.1.100 27, this then reproduces an ascii stream of characters. These characters
are from the inverters.

Any info on how is best to link to this Telnet stream and output it in a Domoticz Style so it can be
utilized.

Can this be done ?

Regards


Nick
A lot of stuff that is doing my head in.
paulvha
Posts: 40
Joined: Friday 29 January 2016 16:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Telnet Type Data to Domoticz Help

Post by paulvha »

I expect that creating a device on top of the dummy hardware layer. Then have a background task running that is extracting the information and then updating that device information with json() udevice calls is the best way forward.
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

That's how I am doing it at the moment.

I am decoding the RS-485 stream in Perl. However, I cannot get my head around where to start
by intercepting the Telnet type of data into a format that I can manipulate.

Total loss here, no info on the Web either so I am at the mercy of other users.

Any info is appreciated though, thanks.

Nick
A lot of stuff that is doing my head in.
paulvha
Posts: 40
Joined: Friday 29 January 2016 16:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Telnet Type Data to Domoticz Help

Post by paulvha »

what Domoticz interface did you use before with RS232 connection ?
can you share sample of the data you can extract ?

regards,
Paul
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

7E02A1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A3
7E01A1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A2

These are the two HEX Data Streams from both Inverters.

RS-485 from the inverters to 2 USB-RS485 Interfaces into the Raspberry Pi 2B. This is picked up by the Raspberry as a Com Port
for each inverter.

A Perl script, taken from various places and modified for my needs decodes this stream into what is needed.

A template was then made to show me the info.
ADomoticsSolarTemplate.jpg
ADomoticsSolarTemplate.jpg (55.79 KiB) Viewed 4889 times
The other Telnet decode is new to me and I am at a dead loss as how to connect.
A lot of stuff that is doing my head in.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Telnet Type Data to Domoticz Help

Post by simonrg »

The ESP8266 look really neat devices, only snag looks like non-zero power consumption.

I am not sure I understand what your problem is here, so this may be off the mark.

Telnet is normally a query / response system, so you send a command to a Telnet server and it responds with a string.

So I guess you will need to open a socket to the ESP8266 (Telnet server), send the command and then switch to recieve to get the asci stream back. Then you should be able to decode the stream just as before.

I would use Lua as you can then just use CommandArray to update your dummy devices - for Lua this looks like the sort of place to start http://stackoverflow.com/questions/3208 ... nd-receive.

Best wishes, Simon
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: Telnet Type Data to Domoticz Help

Post by alfred_j_kwak »

I just made rfid reader/player for Sonos with Esp8266 - but I used NodeMcu card. I used Arduino ide to program Esp and from Esp I send UDP message every 500ms when rfid tag is on a reader.
So in your case maybe you could also code esp with arduino ide and process your byte array in esp before broadcasting it out.
Serial port on esp is 3.3V only so you need buffer between serial port and esp.
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

Cheers for the replies guys.

The ESP is programmed in Transparent Bridge Mode to Wifi, maybe i should have said this in the beginning.
But, for all intents an purposes, it is effectively a Telnet connection.

To connect to the bridge and display information from the RS-485 you have to first connect to the ESP via Wifi
using Telnet. I.E Telnet 192.169.4.120 23 This then re-produces the stream, in ASCII , the code shown below
is a conversion via Perl. The script is complicated as there are byte-reversal codes included in the stream.

Effectively, the output is just a Serial Data Stream as is from a RS-485/RS-232 converter.

For now, all that is required, i hope, is a routine that allows me to connect to the wifi, establish a "Telnet" connection
on the associated port and receive the transmitted data into a block.

7E02A1 and 7E02A2 will be the block start.
The block will have to be 50 bytes in length as the end bits are checksums and therefore different each time.

I haven't even considered the start-up code yet, as a certain byte structure has to be transmitted to get the payload going.
This is being read in parallel at the moment as the routine is being run on wire, I wish to have it wireless.

I know what I want, I just can't explain things very well, hence why I declined the job as a lecturer.

Cheers All

Nick
A lot of stuff that is doing my head in.
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

Tried that routine Simon, got LUA to connect, just got to get some info printed now. Thanks

>lua -e "io.stdout:setvbuf 'no'" "nettel.lua"
tcp{client}: 004A7F60
Connected to Bridge on IP 192.168.0.207 PORT 23
A lot of stuff that is doing my head in.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Telnet Type Data to Domoticz Help

Post by simonrg »

Nick,

Tried to PM you on this, but my other thought was to use json on the ESP8266 and input the data directly from the ESP8266 into to Domoticz. This seems that this should be easy from the Lua firmware, I am not up to speed on the other firmwares and the libraries available though.

I have just got a Wemos Mini D1 and a NodeMCU, so was looking for some hints / ideas of what others are using thier's for. I guess you are using the Arduino firmware, I am currently playing with the Lua firmware, I like the presence of things like a socket library so it should be very easy to send json to Domoticz to insert values into dummy variables etc..

I wondered if you had seen that there are some simple shields available for the Mini D1 http://www.aliexpress.com/item/D1-mini- ... 01036.html. A combination of the Mini D1 and the DH22 shield would make a cheap / accurate temperature humidty sensor, but I have read the battery life would be pretty poor.

I am coming at this as rather a newbie, I never got into Arduino, as they always seemed a bit too electronicsy, but the ESP8266 with integrated WiFi, 1-wire, I2C etc, seem like more of plug and play approach.

My system is based around Raspberry Pis, RFXTrx, LightwaveRF, Owl, 433 temperature/humidity sensors, GPIO conneciton to house alarm system.. All works fairly well, no real problem with lack of handshake on LightwaveRF switches, but not so happy with the sockets which if used regularly gradually fail after 6 - 18 months. So the combination of the Mini D1 and relay shield could make a cheap replacement for Lightwave sockets.

Also noticed you can't be too far away, I am near Northallerton.

Best wishes, Simon
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

Hi Simon, Ever since I started with Domoticz you were there with answers to my questions, and here you are again, cheers bud.

Not seen the mini D1, may look into getting one ( ha, knowing me a few ).

At the moment I am also a relative newbie on the ESP Series, however I have them up and running from the basic At commands, NodeMCU, ESPEasy
and now this damn Transparent Bridge.

I have 5 ESP 01's, the main running as an MPPT Battery Charging Controller, however I removed the wires on the A/D Converter and not put them back
in the right place, got doing summat else and ended up leaving it as it was.

[img]
ESPSolar_.jpg
ESPSolar_.jpg (60.35 KiB) Viewed 4843 times
[/img]

I also have an ESP-12E and V1 Dev Board that I have for testing.

I don't use the Arduino for flashing/programming, I use direct serial, seems a more simple approach to me.

The one I am playing with is an ESP01, OLED Display (1.3") and another 4ch A/D converter, display is small but very clear ( and dear).

I am loving these ESP's, and as you say it's just finding a use around the house.

Oh, and I bought a PiZero just to mess with. I am a saddo I know.
A lot of stuff that is doing my head in.
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

Yay, got it this time. When I said it was 50 bytes, it was 55.

Now I am getting somewhere.

Code: Select all

>lua -e "io.stdout:setvbuf 'no'" "var1.lua" 
Connected to ESP Bridge on	192.168.0.207	PORT	23


Inverter Code


	7E2A11CE6534007491D00A017520000000000009578C131400000000BE380011008002E000085215012732000000000005D	


>Exit code: 0
Just got to decipher all the different codes now, this is going to be hard.
A lot of stuff that is doing my head in.
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

Constant stream now, well chuffed

Code: Select all

>lua -e "io.stdout:setvbuf 'no'" "var1.lua" 
Connected to ESP Bridge on	192.168.0.207	PORT	23
7E2A11CBA53A006A92000B517520000000000009578D131400000000BE38001100B002E0000852150127320000000000049
7E2A11CA153C006092000B617520000000000009578B131400000000BE38001100B002E0000852150127320000000000027
7E2A11CB153C005792000B6175200000000000095786131400000000BE38001100B002E0000852150127320000000000029
7E2A11CBE53C006092000B7175200000000000095787131400000000BE38001100B002E0000852150127320000000000041
7E2A11C9E53D005792000B7175200000000000095783131400000000BE38001100B002E0000852150127320000000000015
A lot of stuff that is doing my head in.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Telnet Type Data to Domoticz Help

Post by simonrg »

NickHead wrote:Constant stream now, well chuffed
Neat, in principle once you have the decoding and transfer to Domoticz running on your Pi. Am I right that the ESP8266-01 doesn't have the ability to flash the NodeMCU firmware, as it could then you should be able to transfer the decoding and transfer to Domoticz directly onto an ESP8266 running the NodeMCU firmware and avoid the Telnet step.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

Hi Si,

What I am doing is making my inverters from RS485 to Wifi so I don't have wires.

The ESP 01 is in bridge mode, effectively just re-transmitting what the inverters are sending down the RS485.

At the moment my PC is running the LUA program to decode the stream, after it is all sorted
I will put it into Domoticz and let that do it.
The LUA program will then update the Domoticz parameters and show me them.
I don't need NodeMCU at the moment.

I am not actually programming the ESP, just letting it sit there feeding me data.

Trying now to get the info decoded into something I can use.

Code: Select all

Connected to ESP Bridge on	192.168.0.207	PORT	23

Inverter Address	7E02A1

Inverter #        	2

Data Stream Length	B0


7E02A1 1CB00541007C092200D001760200000000000095078F13010400000000BE3900110010002E00000852015012732000000000007E	110
A lot of stuff that is doing my head in.
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

The ESP 01 will accept NodeMCU but its limited with its IO ports.

Maybe it will but I wanted a transparent gateway for the 2 inverters.
I am having to leave it now cos i have to go otu, but will be back later on
A lot of stuff that is doing my head in.
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

Sorting it all in order now, but the sun's going in, the inverter will switch off soon :(

Code: Select all

Connected to ESP Bridge on	192.168.0.207	PORT	23

Inverter Address	"7E","02","A1",

Inverter 1K (02) 2K (01)       	2

Data Stream Length	C0


Solar Panel voltage	44.8	Volts
Solar Panel Current	0.1	Amps
Inverter         7E02A1
DC Voltage 1     C01C Volts (Rear Panels)
DC Voltage 2     0004 Volts (Front Panels)
DC Current 1     0101 Amps
DC Current 2     0000 Amps
Grid Voltage     3A00 Volts
Grid Current     0009 Amps
Not Utilised     9200
Grid On/Off      00
This Month kWh   3CBE kWh
Last Month kWh   1100 kWh
AC Frequency Hz  8D07 hZ
Country Standard 13
Power Curve      01
Inverter Status  00027901
Inverter State   0000
A lot of stuff that is doing my head in.
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

Oh well, all that working out, sweating, pondering and drinking loadsa coffee, it doesn't work on the pi.

As I have seen on a previous post as well, there isn't any sockets available.

I may have to use NodeMCU after all .

Works great on the PC though, so at least i am in the right area.
A lot of stuff that is doing my head in.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Telnet Type Data to Domoticz Help

Post by simonrg »

NickHead wrote:..... it doesn't work on the pi.

As I have seen on a previous post as well, there isn't any sockets available.

I may have to use NodeMCU after all .
Assuming you mean the socket library for Lua on Pi, then they should work, they are used extensively for the dtgbot for example, you will find instructions to install the libraries here http://www.domoticz.com/wiki/Remote_Con ... _Libraries
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
NickHead
Posts: 83
Joined: Tuesday 29 October 2013 18:30
Target OS: Linux
Domoticz version:
Location: North East Coast of the UK
Contact:

Re: Telnet Type Data to Domoticz Help

Post by NickHead »

I hope so, as I am progressing with vigour on this.

Seemed a bit odd that a staple function was missing from such a good setup.

Will have a look now.

OK on the Northallerton, I am in Hull BTW
A lot of stuff that is doing my head in.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest