Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues posting data from node #13

Open
roscoegray opened this issue Apr 9, 2021 · 12 comments
Open

Issues posting data from node #13

roscoegray opened this issue Apr 9, 2021 · 12 comments
Labels
bug Something isn't working

Comments

@roscoegray
Copy link

Hi, firstly thanks for getting this going, I'm looking forward to consolidating HA and emoncms onto one system!

I have tried pointing one of my nodes at the new install, but for some reason, it won't connect? It could be user error so if you have a suggestion I will give it ago.

image

I have tried leaving the Emoncms Path blank and using /emoncms.

Anything obviously wrong with my settings, or anything else I need to do to allow access?

The node connects fine to my existing dedicated pi running emoncms. Also worth noting the emoncms_history integration does post data, it's running on the same device as HA.

@inverse
Copy link
Owner

inverse commented Apr 11, 2021

Hi @roscoegray ,

Where is that error happening? I'm not an emoncms user and created this for exp with creating HA addons.

@roscoegray
Copy link
Author

roscoegray commented Apr 12, 2021

Hi, that's understandable.
emoncms gets its data from "nodes", in my case I have one of their Heatpump monitors (Link) and that posts data. It has an ESP microcontroller with emon firmware (Link to EmonESP).

The "error" is on the node, as it doesn't connect to the emoncms instance, I'm guessing it's likey to do with the docker network set-up? I will try and understand it better and report back.

@inverse inverse added the bug Something isn't working label Apr 12, 2021
@ricard0g0mes
Copy link

try to disable ssl in the addon

@roscoegray
Copy link
Author

try to disable ssl in the addon

I don't actually have ssl enabled, i haven't tried it with it enabled.

@inverse
Copy link
Owner

inverse commented Apr 13, 2021

Wouldn't the path be empty in such case as it's submitting data to http://<host/ipt>:9541?

e.g. when playing with the example inputs they post to http://<host/ip>:9541/input/post?node=emontx&json={power1:10,power2:300,power3:900}

Are there any logs on the device that's posting?

@roscoegray
Copy link
Author

As I said, I have tried both with no luck. Interesting with the current set up, I can leave the path blank or have /emoncms, which I think was the default. Not completely sure of its function, can't find it in the EmonESP docs.

I don't think there are any logs as debug need to be enabled during the build.

I thought i would have another go but got this error (I did pull your changes from yesterday.)...

2021/04/14 10:19:35 [error] 9030#9030: *8 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to a member function fetch_object() on bool in /var/www/emoncms/Modules/device/device_model.php:258
Stack trace:
#0 /var/www/emoncms/Modules/device/device_model.php(221): Device->get_list_mysql()
#1 /var/www/emoncms/Modules/device/device_controller.php(65): Device->get_list()
#2 /var/www/emoncms/core.php(63): device_controller()
#3 /var/www/emoncms/index.php(240): controller()
#4 {main}
  thrown in /var/www/emoncms/Modules/device/device_model.php on line 258" while reading response header from upstream, client: 192.168.1.196, server: hassio.local, request: "GET /device/list.json HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "192.168.1.136:9541", referrer: "http://192.168.1.136:9541/input/view"
[14/Apr/2021:10:19:35 +0100] 200 -(192.168.1.196) GET /device/list.json HTTP/1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36)
2021/04/14 10:19:41 [error] 9030#9030: *8 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to a member function fetch_object() on bool in /var/www/emoncms/Modules/device/device_model.php:258
Stack trace:
#0 /var/www/emoncms/Modules/device/device_model.php(221): Device->get_list_mysql()
#1 /var/www/emoncms/Modules/device/device_controller.php(65): Device->get_list()
#2 /var/www/emoncms/core.php(63): device_controller()
#3 /var/www/emoncms/index.php(240): controller()
#4 {main}
  thrown in /var/www/emoncms/Modules/device/device_model.php on line 258" while reading response header from upstream, client: 192.168.1.196, server: hassio.local, request: "GET /device/list.json HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "192.168.1.136:9541", referrer: "http://192.168.1.136:9541/input/view"

@roscoegray
Copy link
Author

Dropped the emoncms table and started again, input page working now (before it was just hanging with the error above in the logs) Think the error may have been something to do with the device module being added after the DB was created.

I also tried using the device level access key but still no luck. I'm wondering if the EmonESP supports having a port number?

There are some logs but not every helpful...
Emoncms error: server error: connection failed

@inverse
Copy link
Owner

inverse commented Apr 14, 2021

@roscoegray thanks for reporting back! Wonder what the issue with adding the addons, I didnt see anything on their readme about schema changes.

Looking in their code it does look like they are hardcoded to port 80 for non HTTPS URLs

Perhaps it'll be worth raising a ticket on their side to parse out the port from the input field and passing that through.

I'll document this as a limitation.

@ricard0g0mes
Copy link

Go to your input Page and open the link "input API help".
Then, try one of the links of examples to see if any works.

@ricard0g0mes
Copy link

Also, go to admin and try to update databases and other items.

@inverse inverse mentioned this issue Apr 14, 2021
@roscoegray
Copy link
Author

Ok, I will raise a ticket on their side, glad it makes sense now. I think I could use MQTT as a workaround for now, but I will continue to test the add-on and report back any issues. Thanks again!

@inverse
Copy link
Owner

inverse commented Apr 15, 2021

Thanks @roscoegray 🙏🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants