Page 2 of 4
Re: Telnet Type Data to Domoticz Help
Posted: Thursday 25 February 2016 17:51
by NickHead
Managed to get the Socket on the PI Simon.
Tried the same program on the Domoticz LUA, worked in a fashion, however, due to the program
needing to be connected to the Bridge, it was connecting every time it was polled.
I have to find a way now to connect it, and keep the connection.
Code: Select all
>lua -e "io.stdout:setvbuf 'no'" "ESPInverter.lua"
Connected to ESP Bridge on 192.168.0.207 PORT 23
Ginlong 1K Inverter
Inverter Terminal ID 7E02A1 received
DC Voltage 1 135.3 Volts (Side Panels)
DC Current 1 0.2 Amps
Grid Voltage 237.1 Volts
Grid Current 0 Amps
Grid Wattage 0 Watts
SP Wattage 1K 27.06 Watts
Not Utilised 398
Grid On/Off 0
This Month kWh 70 kWh
Last Month kWh 17 kWh
AC Frequency Hz 50.02 hZ
Country Standard 1
Power Curve 4
Inverter Status 00000283
Inverter State 0000
Extra Bits 31002F000008520150127320
And the output is more standard/readable rather than hex digits.
This is still running on the PC, through the wireless bridge.
Re: Telnet Type Data to Domoticz Help
Posted: Monday 29 February 2016 17:07
by NickHead
Update: Slowly getting there bit by bit
Code: Select all
-----------------------------
DC Voltage 1 139 Volts (Rear Panels)
DC Current 1 0.6 Amps
SP Rear Watts 83.4 Watts
-------------------------------
DC Voltage 2 143.8 Volts (Front Panels)
DC Current 2 0.5 Amps
SP Front Watts 71.9 Watts
-------------------------------
SP Wattage 2K 155.3 Watts
-------------------------------
Grid Voltage 242 Volts
Grid Current 0.5 Amps
Grid Wattage 121 Watts
-------------------------------
Capability 00 00 34
Software Version 7 (07)
Grid On/Off 0
AC Frequency Hz 50.01 hZ
Power Curve 4
Inverter State Generating
Temperature 18.6C
-------------------------------
Efficiency 77.91 %
-------------------------------
Power Today 5.8 kWh
Grid Combined 0.19 kW
Combined Power 1930 kWh
Power Yesterday 3.2 kWh
Total Power 1280 kWh
This Month kWh 85 kWh
Last Month kWh 24 kWh
-------------------------------
Re: Telnet Type Data to Domoticz Help
Posted: Monday 07 March 2016 13:05
by NickHead
Update:
Decided LUA was not easy enough to use.
Ported it over to Python, Job Sorted, took some time to reverse engineer what I had already
but it's working. Few final polishing routines to create and game over. off to do something new
with the gear..
Re: Telnet Type Data to Domoticz Help
Posted: Monday 07 March 2016 13:59
by simonrg
Glad you have got it all working.
Curious to understand what the Python looks like, it would be a nice example to post up on the
http://www.domoticz.com/wiki/ESP8266_WiFi_module.
Re: Telnet Type Data to Domoticz Help
Posted: Friday 11 March 2016 23:01
by NickHead
Still in " Sorting it out mode". Tightening all the slack programming out as best I can.
Limited time after work as there is no sun and nothing comes from the inverters, so I
have to do it on sunny day and they are few and far between here at the moment.
It's working in a fashion but I just can't keep it logged in when the sun goes down. The program
flags an error, if I can sort it out it will be use-able.
Just been trying a python inverter simulator I wrote, need to run it on another pi really as the RS485 converter
is not knowing whether it's coming or going.
Re: Telnet Type Data to Domoticz Help
Posted: Friday 11 March 2016 23:10
by NickHead
Here's a picture of the circuit I made.
An ESP-Programmer/breakout that I use.
ESP-8266-01, RS485, Power Dropper, Reset and Program buttons
with headers for GPIO and RS232 in/out.
[img]
- bridge.jpg (73.21 KiB) Viewed 4347 times
[/img]
Re: Telnet Type Data to Domoticz Help
Posted: Thursday 31 March 2016 23:32
by simon_rb
Hi all,
This looks like what I was hoping to do with my denon amp. I need to pole the power state of the amp by sending the command PW? And read the reply and if it's on then switch a switch in domoticz to on. That's it in its simplest form.
Any ideas?
Cheers
Re: Telnet Type Data to Domoticz Help
Posted: Friday 01 April 2016 20:47
by NickHead
Do you know what the data-stream format is ?
For my inverters I have a print out of the commands in RS485 format.
I started with a simple ESP Bridge from wifi-tcp but I changed it over to a commercial Wifi-Serial-Ethernet bridge, it
doe the same thing but all in one and has 2 serial ports, works like a dream and frees the ESP for something else.
You need the protocol first then write the program to see if it decodes/encodes it.
I am not an expert on programming I just do a lot of asking and trial / error .
Re: Telnet Type Data to Domoticz Help
Posted: Saturday 02 April 2016 0:48
by simon_rb
Hi,
I think its pretty simple, below is the documentation I found. Thank you
http://openrb.com/wp-content/uploads/20 ... V7.6.0.pdf
Re: Telnet Type Data to Domoticz Help
Posted: Saturday 02 April 2016 1:01
by NickHead
Wow, that's a pretty comprehensive list.
Too late for me to ingest at the moment, I will look tomorrow and see if I
can be of any help to you.
Off to bed.
Re: Telnet Type Data to Domoticz Help
Posted: Saturday 02 April 2016 1:03
by simon_rb
I just need to send the PW? and get Domoticz to understand and act on the reply.
Thank you very much! Sleep well.
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 9:41
by NickHead
Do you know what data is sent from the Denon after PW? has been sent to it.
I am assuming you have an IP Address for it, and a Port Number.
I can send PW? over the network to an IP/Port. Depending on the result received is what
determines what happens next.
I cannot drop out of a Python Loop without knowing what is received, even better if its a CR then
the length is/can be fixed.
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 13:52
by simon_rb
Yes I have an IP address and port but how can I send the command and let you know what the answer is?
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 15:53
by NickHead
You will need the libraries installing, and the Denon/Domoticz Parameters modifying.
Code: Select all
#!/usr/bin/env python
import os
import sys
import socket
import urllib, urllib2, hashlib
###############################################
# Denon Amp Settings
denon_host = "192.168.0.231"
denon_port = 8081
###############################################
#domoticz settings
domoticz_host = '192.168.0.5'
domoticz_port = '8080'
domoticz_url = 'json.htm'
port = 8080
################################################
def CallData():
Text = "pw?"
s.send(Text)
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print " Socket successfully created"
except socket.error as err:
print" "
s.connect((denon_host,port))
print " Host =",denon_host," Port = ",denon_port
print " Connecting to Denon Amplifier"
CallData()
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 15:56
by NickHead
P.S
The program will not actually receive anything.
It just sends pw? to the Denon.
If I don't know how the data is formatted, I cannot do anything to continue.
As I said, I am no expert on this, only been programming a few months
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 15:58
by NickHead
needs changing to
Code: Select all
s.connect((denon_host,denon_port))
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 16:17
by simon_rb
Thanks for that, I am just trying to find out what the Denon would return so we can act on it. Must be a way of sending the PW? and view what is returned.
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 16:40
by NickHead
There is, but I aint done that yet, and wether it would work is another story.
You could always try entering other commands in to the text string to see if it changes channels/volume or whatever/
I simple read of about 10 bytes would suffice I would reckon.
i am doing too many things here at the moment , I have to rewrite my SolarPanel programs as well
not only that , I have to to work in a bit
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 16:52
by NickHead
This will/should receive 6 characters from the Denon Stream.
It will print the character chr(DA[Data}) 6 times. with the associated Decimal Number Next to it.
Its a start.
Code: Select all
#!/usr/bin/env python
import os
import sys
import socket
import urllib, urllib2, hashlib
DA = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10]
###############################################
# Denon Amp Settings
denon_host = "192.168.0.231"
denon_port = 8080
###############################################
#domoticz settings
domoticz_host = '192.168.0.5'
domoticz_port = '8080'
domoticz_url = 'json.htm'
port = 8080
################################################
def CallData():
Text = "PW?" # Changed as it was lower case
s.send(Text)
def ReceiveData():
DStart = (s.recv(1))
for Data in range ( 1 , 6 ):
DA[Data] = ord(s.recv(1))
print chr(DA[Data])," ",(DA[Data])
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print " Socket successfully created"
except socket.error as err:
print" "
s.connect((denon_host,denon_port))
print " Host =",denon_host," Port = ",denon_port
print " Connecting to Denon Amplifier"
CallData()
ReceiveData()
Re: Telnet Type Data to Domoticz Help
Posted: Sunday 03 April 2016 17:53
by simon_rb
Does this help, it uses the PW? As an example...
https://www.npmjs.com/package/denon-avr