Jump to content

venus pi / mqqt or dbus voltage logging?


shanghailoz

Recommended Posts

Any recommendations on what the current method du jour is for logging battery on a PI /Venus?

 

I see MQQT can be used.  Ideally, I'd like something web / cloud based. 

At home would like to keep power usage low, so ideally an mqtt broker running on the existing pi running venus/pi publishing somewhere would be ideal.

I've had a brief google, and found this https://hackaday.com/2017/10/31/review-iot-data-logging-services-with-mqtt/. which mentions some services.

 

Will it just be a matter of 

1) installing a broker service, and cron script to push info to a cloud server.

2) turning off automatic updates so that doesn't get nuked?

 

Or is there something else suggested?

Link to comment
Share on other sites

Answering myself here.  I setup ssh on the pi using instructions here - https://www.victronenergy.com/live/ccgx:root_access

 

Have added an mqtt conf under /data/conf/mosquito.d/

Busy trying to config it to work, playing around with settings.

 

logging is under /var/log/mosquitto/current

eg

tail -F /var/log/mosquitto/current

 

Looks very tai64n style! a la qmail

Not being successful so far though, seems to just sit and wait.

 

tail /var/log/mosquitto/current  -F | tai64nlocal


initial errors are due to the bootup, no networking at that point

2018-12-25 08:39:54.493228500 1545727194: Connecting bridge ccgx (io.adafruit.com:1883)

2018-12-25 08:39:54.493235500 1545727194: Error creating bridge: Temporary failure in name resolution.

2018-12-25 08:39:54.493239500 1545727194: Warning: Unable to connect to bridge ccgx.

2018-12-25 08:39:54.493243500 1545727194: Connecting bridge vrm (mqtt.victronenergy.com:443)

2018-12-25 08:39:54.493248500 1545727194: Error creating bridge: Temporary failure in name resolution.

2018-12-25 08:39:54.563427500 1545727194: Warning: Unable to connect to bridge vrm.

2018-12-25 08:40:05.070782500 1545727205: New connection from 127.0.0.1 on port 1883.

2018-12-25 08:40:05.084617500 1545727205: New client connected from 127.0.0.1 as ve-dbus-mqtt-py (c1, k60).

2018-12-25 08:40:24.632157500 1545727224: Connecting bridge ccgx (io.adafruit.com:1883)

2018-12-25 08:40:28.026899500 1545727228: Connecting bridge vrm (mqtt.victronenergy.com:443)

My conf file looks like this at the moment - guess once I get some errors, I'll be able to troubleshoot further.

(PASS obfuscated below for obvious reasons)

 

If I can't get it going, will probably setup a local mqqt openhab or similar.  Would like to keep minimal local stuff running though.

 

#https://io.adafruit.com/shanghailoz/feeds/wood-close

connection ccgx

address io.adafruit.com:1883



cleansession false

notifications false

bridge_attempt_unsubscribe false

try_private false

start_type automatic



remote_clientid wood-close

remote_username shanghailoz

remote_password PASSGOESHERE





topic N/b827eb23998f/solarcharger/+/Dc/+/+ out 0

topic N/b827eb23998f/solarcharger/+/Pv/+ out 0

topic N/b827eb23998f/vebus/+/Ac/Out/+ out 0

topic N/b827eb23998f/vebus/+/Ac/ActiveIn/+ out 0

topic N/b827eb23998f/vebus/+/Alarms/# out 0

topic N/b827eb23998f/vebus/+/Leds/+ out 0

topic N/b827eb23998f/vebus/+/State out 0

topic N/b827eb23998f/battery/+/Dc/+/+ out 0

topic N/b827eb23998f/battery/+/Relay/+/+ out 0

topic N/b827eb23998f/battery/+/Alarms/+  out 0

topic N/b827eb23998f/battery/+/Soc out 0

topic N/b827eb23998f/battery/+/TimeToGo  out 0

 

Link to comment
Share on other sites

Continuing this -

 

Still no luck, getting somewhere with finding out the mqqt details though.

brew cask installed mosquitto_client so i could troubleshoot.

 

Console #1 (watching); 

mosquitto_sub -h 192.168.8.100 -t '#' -v

 

Console #2, to push the data.  

mosquitto_pub -h 192.168.8.100 -t 'R/b827eb23998f/system/0/Serial' -m ""

 

Looks like the droids i was looking for were 

N/b827eb23998f/system/0/Dc/Battery/Current {"value": -2.5}

N/b827eb23998f/system/0/Dc/Battery/Power {"value": -68.874998092651367}

N/b827eb23998f/system/0/Dc/Battery/Voltage {"value": 27.549999237060547}

 

A quick edit of the conf file to:

topic N/b827eb23998f/system/0/Dc/Battery/Current out 0 current shanghailoz/feeds/wood-close.current    

topic N/b827eb23998f/system/0/Dc/Battery/Power out 0 power shanghailoz/feeds/wood-close.power

topic N/b827eb23998f/system/0/Dc/Battery/Voltage out 0 dc shanghailoz/feeds/wood-close.voltage

 

and some adding of fields at adafruit.io, and still not working, gah!

 

Will have to play later, off to xmas lunch. 

 

Edited by shanghailoz
Link to comment
Share on other sites

On 2018/12/25 at 10:50 AM, shanghailoz said:

Looks very tai64n style! a la qmail

Daemontools. It is very much the same software that is used by qmail. DJB made it public domain some years ago. It's still one of the cleverest ways I've seen to monitor a process (force it to inherit a file descriptor and then use some posix trickery to detect if the remote end still has the socket open... :-) ).

The thing most people struggle with with using mqtt, is that the data is only sent if you ask for it periodically. There is a kind of keepalive set up. It's all in the dbus-mqtt documentation on github. This keepalive is there to cut down on unnecessary amounts of traffic.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...