Connection to EMONCMS not working

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
UserChristian
Normal user
Posts: 22
Joined: 17 Feb 2020, 12:43
Location: Germany

Connection to EMONCMS not working

#1 Post by UserChristian » 14 Mar 2022, 17:20

Have my ESP-Mini connected to my electricity meter SDM630 via a Modbus adapter. The communication works and the values are displayed correctly via ESPeasy.
Now I would like to transfer the data to my hosted Linux server, but unfortunately I can't get the transfer to work.
When I test the API examples of Emoncms, the input channels are recognized cleanly and also displayed, i.e. the software on the server works so far (installation I have done according to this instruction: https://github.com/emoncms/emoncms/blob ... Install.md).
So the problem seems to be on the ESP side.
Maybe someone can help me with troubleshooting the communication between ESPeasy and EmonCms.
Attachments
Log_Output.jpg
Log_Output.jpg (75.63 KiB) Viewed 7474 times
Device_Data.jpg
Device_Data.jpg (19.83 KiB) Viewed 7474 times
Controller_Settings.jpg
Controller_Settings.jpg (72.99 KiB) Viewed 7474 times

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Connection to EMONCMS not working

#2 Post by Ath » 14 Mar 2022, 17:32

If that server is on the internet, like the url suggests, then the Client timeout setting should be increased to a more realistic value of 1000 msec, or maybe even higher, as you won't have the predictable delays you can see in a local network.

It may help to set global debug level to DEBUG, instead of the default INFO, though I haven't checked if that outputs additional info for this Controller.
/Ton (PayPal.me)

UserChristian
Normal user
Posts: 22
Joined: 17 Feb 2020, 12:43
Location: Germany

Re: Connection to EMONCMS not working

#3 Post by UserChristian » 14 Mar 2022, 17:50

Okay, now I have increased the value from 100 to 4000ms (maximum), but it looks like the same.
I have installed it on the folder public_html/emoncms on the my side mysignal.de and the sample API-URL looks like that:
https://mysignal.de/emoncms/input/post? ... key=xxxxxx
Is the hostname mysignal.de/emoncms correct?

Logging Output:

Code: Select all

29126481: EASTRON: (1,3) Voltage (V): 228.55
29126518: EASTRON: (1,3) Current (A): 5.00
29126555: EASTRON: (1,3) Power (W): 987.67
29126608: EASTRON: (1,3) Total Active Energy (Wh): 20522.23
29131989: WD   : Uptime 486 ConnectFailures 0 FreeMem 15624 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
29132845: LoopStats: shortestLoop: 339 longestLoop: 1541127 avgLoopDuration: 483.88 loopCounterMax: 88495 loopCounterLast: 60426
29132845: Scheduler stats: (called/tasks/max_length/idle%) 60426/2036/8/86.58
29136481: EASTRON: (1,3) Voltage (V): 228.65
29136519: EASTRON: (1,3) Current (A): 4.92
29136554: EASTRON: (1,3) Power (W): 886.61
29136608: EASTRON: (1,3) Total Active Energy (Wh): 20522.23
29146481: EASTRON: (1,3) Voltage (V): 228.64
29146518: EASTRON: (1,3) Current (A): 4.81
29146553: EASTRON: (1,3) Power (W): 891.06
29146608: EASTRON: (1,3) Total Active Energy (Wh): 20522.24
29156481: EASTRON: (1,3) Voltage (V): 228.46
29156518: EASTRON: (1,3) Current (A): 4.83
29156554: EASTRON: (1,3) Power (W): 883.08
29156608: EASTRON: (1,3) Total Active Energy (Wh): 20522.24
29161956: WD   : Uptime 486 ConnectFailures 0 FreeMem 15624 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
29162845: LoopStats: shortestLoop: 339 longestLoop: 1541127 avgLoopDuration: 491.53 loopCounterMax: 88495 loopCounterLast: 59505
29162845: Scheduler stats: (called/tasks/max_length/idle%) 59505/2032/8/85.79
29166481: EASTRON: (1,3) Voltage (V): 228.58
29166519: EASTRON: (1,3) Current (A): 4.81
29166554: EASTRON: (1,3) Power (W): 883.70
29166609: EASTRON: (1,3) Total Active Energy (Wh): 20522.24
and the JSON Output:

Code: Select all

{"System":{
"Load":13.02,
"Load LC":2322,
"Build":20116,
"Git Build":"mega-20211224_f162ebf",
"System Libraries":"ESP82xx Core 2843a5ac, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support",
"Plugin Count":55,
"Plugin Description":"[Normal]",
"Local Time":"2022-03-14 18:41:25",
"Time Source":"NTP",
"Time Wander":-0.007,
"Use NTP":"true",
"Unit Number":1,
"Unit Name":"ESP_SDM630",
"Uptime":448,
"Uptime (ms)":26873753,
"Last Boot Cause":"Cold Boot",
"Reset Reason":"External System",
"CPU Eco Mode":"false",
"Heap Max Free Block":10432,
"Heap Fragmentation":12,
"Free RAM":11776,
"Free Stack":3488,
"Sunrise":"8:05",
"Sunset":"20:12",
"Timezone Offset":120,
"Latitude":0.00,
"Longitude":0.00
},
"WiFi":{
"Hostname":"ESP-SDM630-1",
"IP Config":"DHCP",
"IP Address":"192.168.178.59",
"IP Subnet":"255.255.255.0",
"Gateway":"192.168.178.1",
"STA MAC":"60:01:94:2A:26:88",
"DNS 1":"192.168.178.1",
"DNS 2":"(IP unset)",
"SSID":"CB-618",
"BSSID":"34:31:C4:BF:30:E9",
"Channel":1,
"Encryption Type":"WPA/WPA2/PSK",
"Connected msec":26858000,
"Last Disconnect Reason":8,
"Last Disconnect Reason str":"(8) Assoc leave",
"Number Reconnects":1,
"Configured SSID1":"CB-618",
"Configured SSID2":"",
"Force WiFi B/G":"false",
"Restart WiFi Lost Conn":"false",
"Force WiFi No Sleep":"false",
"Periodical send Gratuitous ARP":"false",
"Connection Failure Threshold":0,
"Max WiFi TX Power":17.50,
"Current WiFi TX Power":14.00,
"WiFi Sensitivity Margin":3,
"Send With Max TX Power":"false",
"Extra WiFi scan loops":0,
"Use Last Connected AP from RTC":"false",
"RSSI":-70
},
"Sensors":[
{
"TaskValues": [
{"ValueNumber":1,
"Name":"V",
"NrDecimals":2,
"Value":229.75
},
{"ValueNumber":2,
"Name":"A",
"NrDecimals":2,
"Value":4.15
},
{"ValueNumber":3,
"Name":"W",
"NrDecimals":2,
"Value":647.70
},
{"ValueNumber":4,
"Name":"Wh_tot",
"NrDecimals":2,
"Value":20521.72
}],
"DataAcquisition": [
{"Controller":1,
"IDX":1,
"Enabled":"true"
},
{"Controller":2,
"IDX":0,
"Enabled":"false"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":10,
"Type":"Energy (AC) - Eastron SDM120C/220T/230/630 [TESTING]",
"TaskName":"SDM630",
"TaskDeviceNumber":78,
"TaskEnabled":"true",
"TaskNumber":1
}
],
"TTL":10000
}
I hope it helps to find the failure.

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Connection to EMONCMS not working

#4 Post by Ath » 14 Mar 2022, 20:46

How is your Eastron plugin task configured?
/Ton (PayPal.me)

UserChristian
Normal user
Posts: 22
Joined: 17 Feb 2020, 12:43
Location: Germany

Re: Connection to EMONCMS not working

#5 Post by UserChristian » 14 Mar 2022, 22:17

Here please:
Attachments
Device_Settings.jpg
Device_Settings.jpg (215.1 KiB) Viewed 7449 times

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Connection to EMONCMS not working

#6 Post by Ath » 14 Mar 2022, 22:59

And the Emoncms controller is in slot 1 or 2?, because if it is in slot 2, that controller has to be enabled too, to get the values out.
If the Emoncms controller is in slot 1, what controller is configured in slot 2?
/Ton (PayPal.me)

UserChristian
Normal user
Posts: 22
Joined: 17 Feb 2020, 12:43
Location: Germany

Re: Connection to EMONCMS not working

#7 Post by UserChristian » 15 Mar 2022, 18:54

Now I am an big step closer to the result, because the configuration of the controller was false.
After modification I was able to send once the data to emoncms, because I could saw the data, but there are no updates.
I checked the log file, but there are some errors, see here:

117571956: WD : Uptime 1960 ConnectFailures 1399 FreeMem 15792 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
117572845: LoopStats: shortestLoop: 339 longestLoop: 2611538 avgLoopDuration: 720.50 loopCounterMax: 88495 loopCounterLast: 40938
117572845: Scheduler stats: (called/tasks/max_length/idle%) 40923/1576/8/58.87
117577700: EASTRON: (1,3) Voltage (V): 229.75
117577747: EASTRON: (1,3) Current (A): 4.01
117577783: EASTRON: (1,3) Power (W): 668.55
117577818: EASTRON: (1,3) Total Active Energy (Wh): 20533.84
117577853: HTTP : C007 connecting to mysignal.de/emoncms:80
117578075: HTTP : C007 connection failed (1400/0)

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Connection to EMONCMS not working

#8 Post by Ath » 15 Mar 2022, 20:19

Assuming that the Controller Password is entered correctly (it's the first thing you checked, right?), it may be needed to prefix the Controller Hostname with "http://", but I wouldn't know for sure though.

Have you checked the log from the server side? Usually some access log is created, giving an indication for the cause of the error(s).
/Ton (PayPal.me)

UserChristian
Normal user
Posts: 22
Joined: 17 Feb 2020, 12:43
Location: Germany

Re: Connection to EMONCMS not working

#9 Post by UserChristian » 16 Mar 2022, 07:59

Now I found the second failure, on the field hostname I must use only 'mysignal.de' without subfolder or HTTP.

Thank you for your help
Attachments
2022-03-16 07_59_38-ESP_SDM630 – Opera.jpg
2022-03-16 07_59_38-ESP_SDM630 – Opera.jpg (55.11 KiB) Viewed 7393 times

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests