Esperyd?s Raspberry PI project

Announcement - Help us fight the BOTS! Please report all spam including stuff in your inbox!

jbates58

New member
Joined
Mar 6, 2021
Messages
18
@daromer
ok, well that seems to have done it. the container is running.

now i just need to work out the mqtt thing, and i think im set.

but it has been running for about 30 min. im just too short on time for the next few days to get the mqtt worked out.

but, progress has been made. i will leave the container running to make sure that there are no config issues (other than my non working mqtt server).

and, in the vide0, aswell as in the config, you make mention mostly of mqtt, and in the config there are some lines that say " Dont send to influx " why is that? and what is the issue that it causes?

Jason
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
If you send those to influx it will crash :) Or you fill your influx in hours. Note that i take the RAW data from batrium and it sends ALOT of data all the time. My goal with the software was to have it as universal as possible so its easy for Batrium to update only the Payload and it can handle it :)

Also that data is a bit more complex in the structure so it makes the influx to have data stored in a non optimal way. Thats why i have added that to the confi.
Batrium do send alot of redundant data so you can often find the same data in several places. If you have to do more complex math before use mqtt with node-red first is my recomendation :)

But for pure graphing the listener is pretty darn quick to send the data without stressing using node-red in between.
 
Last edited:

jbates58

New member
Joined
Mar 6, 2021
Messages
18
hey @daromer ,

i think im going to need some assistance. I can not work out how to get it to put the data out from the udp listener to influx or mqtt.

I have watched you video on intergrating it into HASS so much i can probably recite it. but i just cant get it to connect.

I have been trying a multitude of things, and am able to create databases etc via a CURL request on my compuer to the NUC so i know that it works as it should. and i have set the username, password, IP etc... all in the config file. but it just wont connect.

HASS is running in native install mode on the NUC
I have MQTT broker installed as an add-on
I have influx and grafana installed as an add-on
I have installed portainer, and gotten the UDPListener running in portainer
I have gone in and edited the config.json using VI
rebooted multiple times and tried a heap of things, but nothing seems to work.


I can confirm that the MQTT service is running, as i have other devices that are connected to HASS via mqtt and are working as expected

all the logs from portainer say that gives me any clues is that its an authorization issue. I tried pasting them here, but with the character limit, there isnt anything that offers much assistance. Im happy to open up external access if you wanted to login and have a look.

I hope you can assist.

Jason
 
Last edited:

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
What does the Watchmonudplistener log state? Does it say its started without errors connecting?
Is the Watchmonudplistener set to network mode host and the machine IS on same network as the batrium without any Broadcast blocking setup?
Because if the watchmonlistener doesnt get data it wont forward anything :)
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
What does the Watchmonudplistener log state? Does it say its started without errors connecting?
Is the Watchmonudplistener set to network mode host and the machine IS on same network as the batrium without any Broadcast blocking setup?
Because if the watchmonlistener doesnt get data it wont forward anything :)
yes, UDPlistener is in host mode running in portainer on the NUC

Influx and MQTT are installed on the same nuc

the NUC is connected to the same switch/AP that the batrium is connected to

as far as im aware, there is now broadcast blocking in place. I can use the toolkit software on my PC and can connect to the Batrium via wifi and it works as it should

i will try and get a sample of the logs. but there is nothing that stands out to me. i even went back 1500 lines of logging.

Code:
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: null,
      pipesCount: 0,
      flowing: true,
      ended: true,
      endEmitted: true,
      reading: false,
      sync: true,
      needReadable: false,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      emitClose: true,
      autoDestroy: false,
      destroyed: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: true,
      decoder: [StringDecoder],
      encoding: 'utf8',
      [Symbol(kPaused)]: false
    },
    readable: false,
    _events: [Object: null prototype] { end: [Array], data: [Function] },
    _eventsCount: 2,
    _maxListeners: undefined,
    socket: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'localhost',
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      timeout: 30000,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(asyncId)]: 56305,
      [Symbol(kHandle)]: [TCP],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: Timeout {
        _idleTimeout: 30000,
        _idlePrev: [TimersList],
        _idleNext: [TimersList],
        _idleStart: 236120,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 56312,
        [Symbol(triggerId)]: 56311
      },
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    connection: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'localhost',
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      timeout: 30000,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(asyncId)]: 56305,
      [Symbol(kHandle)]: [TCP],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: Timeout {
        _idleTimeout: 30000,
        _idlePrev: [TimersList],
        _idleNext: [TimersList],
        _idleStart: 236120,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 56312,
        [Symbol(triggerId)]: 56311
      },
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    httpVersionMajor: 1,
    httpVersionMinor: 1,
    httpVersion: '1.1',
    complete: true,
    headers: {
      'content-type': 'application/json',
      'request-id': '2755b8b2-83db-11eb-85bc-0242ac1e2104',
      'www-authenticate': 'Basic realm="Hass.io InfluxDB"',
      'x-influxdb-build': 'OSS',
      'x-influxdb-version': '1.8.4',
      'x-request-id': '2755b8b2-83db-11eb-85bc-0242ac1e2104',
      date: 'Sat, 13 Mar 2021 09:04:44 GMT',
      'content-length': '55',
      connection: 'close'
    },
    rawHeaders: [
      'Content-Type',
      'application/json',
      'Request-Id',
      '2755b8b2-83db-11eb-85bc-0242ac1e2104',
      'Www-Authenticate',
      'Basic realm="Hass.io InfluxDB"',
      'X-Influxdb-Build'
      'OSS',
      'X-Influxdb-Version',
      '1.8.4',
      'X-Request-Id',
      '2755b8b2-83db-11eb-85bc-0242ac1e2104',
      'Date',
      'Sat, 13 Mar 2021 09:04:44 GMT',
      'Content-Length',
      '55',
      'Connection',
      'close'
    ],
    trailers: {},
    rawTrailers: [],
    aborted: false,
    upgrade: false,

    url: '',
    method: null,
    statusCode: 401,
    statusMessage: 'Unauthorized',
    client: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'localhost',
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      timeout: 30000,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(asyncId)]: 56305,
      [Symbol(kHandle)]: [TCP],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: Timeout {
        _idleTimeout: 30000,
        _idlePrev: [TimersList],
        _idleNext: [TimersList],
        _idleStart: 236120,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 56312,
        [Symbol(triggerId)]: 56311
      },
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    _consuming: false,
    _dumped: false,
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Socket],
      connection: [Socket],
      _header: 'POST /write?db=batrium&p=&precision=s&rp=&u= HTTP/1.1\r\n' +
        'content-length: 701\r\n' +
        'Host: localhost:8086\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      timeout: 30000,
      method: 'POST',
      insecureHTTPParser: undefined,
      path: '/write?db=batrium&p=&precision=s&rp=&u=',
      _ended: true,
      res: [Circular],


1615625982810.png
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
If above snippet is from the logs you have an issue with it connecting to something. You need to look at the full log to see whats going on.
If the software works it should be roughly 50 lines of log and nothing more.
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
ok, i have read through them, and this is all that i can find that seems to point out where the issue is. i have highlighted the 2 main lines below in red. can you confirm that the x86 build works on your machine at all? just to make sure that its something with my setup? I can able to connect to influx via curl and that works fine. so i know that my authentication is working. and i know that the details in the config.json file are right, as i have checked them 5 times now.

Code:
Unhandled Rejection at: Promise Promise {
  <rejected> RequestError: A 401 Unauthorized error occurred: {"error":"unable to parse authentication credentials"}
 
      at IncomingMessage.<anonymous> (/app/dist/index.js:7819:38)
      at IncomingMessage.emit (events.js:326:22)
      at endReadableNT (_stream_readable.js:1241:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21) {
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Socket],
      connection: [Socket],
      _header: 'POST /write?db=batrium&p=&precision=s&rp=&u= HTTP/1.1\r\n' +
        'content-length: 701\r\n' +
        'Host: localhost:8086\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      timeout: 30000,
      method: 'POST',
      insecureHTTPParser: undefined,
      path: '/write?db=batrium&p=&precision=s&rp=&u=',


Thanks,

Jason
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
Theres your error: {"error":"unable to parse authentication credentials"}
One guess could be the ~ in the password.
And influxenabled is missing a ,
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
yes, I had thought that already, and tried that. I have since that photo changed the password to simply " password " for testing. and still no go.

I will attach a few pics of the portainer screen. perhaps there is something that i have missed.

1615644876955.png




1615644902284.png




1615645134788.png
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
Im not sure what you have done there to be honest. I cant replicate it and you still are missing a "," in your config. And if that is missing current code should overwrite your config but it seem not to do that?? (Its a bug that it overwrites but since it havent you have done something else)

Have you set password on your influx? Have you tried without it?
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
i have tried to remove the password from the " batrium " user on influx, but it needs a password.

good catch on the " , " i didn't even see that.

i have even tried removing the container and starting fresh etc... with downloading the image from docker hub again.

But it still comes back with the authentication issue.

looking at the url it seems to give in the logging, i see that it looks like its trying to write it to localhost still.... even though i have an IP set in the config.

1615647692191.png


i don't think that's right. and im assuming (but i don't know) that it should be putting the IP that i set in the config in that position.

when you say you cant replicate it. are you running it on a 8x6 platform aswell? im just wondering how close your replication steps are compared to my environment.
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
No, The ip does not show there. You can see when you start the software what it tries to connect to.
I have tried on AMD and the ARM image. I dont get any issues with or without the password. Im not using localhost on one of them but IP and it works. On another node i use localhost and on a 3rd machine i got it running with local dns instead.

Did you prune the container and images before starting over? So it did download latest version and not used the old one?
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
interesting. i have set portainer to show 2000 lines of log, and havent seen any ip's mentioned. how much logging does it produce, so i can see if it is trying to connect to them?
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
IF you have enabled messages and its not being able to connect it can spam 1000s per second.

As i said in the video start a sh console and look in the logs. And once again since the missing , wasnt overwritten you aint running the latest version.
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
ahh right, the logs from inside the container itself? and not the logs on portainer?

ok cool.

I completely re-created the container last night, I removed everything from portainer, and pulled the latest image from docker hub etc...

i will have a look, and report back with my findings.
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
But did you prune the images? Just removing it does not redownload them :) And its the same logs as portainer fetches as in the container itself but as i said if you screwed the config up it spams alot of errors since it goes into debug.
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
ok, I am officially out of ideas.

I simply can not get this to work.

now its at the point where the container doesn't even run. it just instantly crashes. I had it operating on another system for a little while, but was still getting all the same influx errors. so I just set influx to off in the config, so it would only use MQTT, and it just went downhill from there.

I have removed everything, deleted the images from in portainer (not just the container, but images > and removed it) removed volumes and re-created them

I just cant work this out.

it really seems like it shouldn't be this difficult. especially after watching the video heaps to see if im going wrong somewhere.

hoping for some one to be keen to help via a remote session via zoom or something so I can actually learn why its not working.
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
ok, so a small update. i can confirm that my influxdb is setup correctly. as i have gotten another application that is writing data to it.

so, i have 2 issues at hand currently.
1) the watchmon container keeps crashing, and wont launch
2) when it did launch, it wouldnt connect to the influx, or the mqtt

but, i have made some progress. im going to try deploying the RPI image on a container on my pi to test that. and see how it goes.

i will report back with my findings.
 

jbates58

New member
Joined
Mar 6, 2021
Messages
18
ok, no matter what I do, the container wont stay running. I have tried it across 4 different systems and platforms.

Rpi,
windows
WSL
and my server (ubuntu)

it runs for less than a second, and dies, all I get is " Stopped for a few seconds with exit code 1 "

i am out of ideas, and also, I don't know docker at all. so that doesn't help.

i also tried it natively on my RPI, that that also would not launch.
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
As i said many times now it will not start unless it can connect to Influxdb and your Mosquitto brooker. If it ant it will die directly. So please once again check the logs and see whats going on and why it cant connect.
 
Top