Connected but No Data

I installed the software and the Dashboard shows “Connected” but there is no status showing. Not sure what the next step is to debug this problem.

The syslog on the Pi seems normal:

May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:[FEEDER] Starting, locking
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getBatteryLevel] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getBatteryHealth] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getFanSpeed] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getFanHealth] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getWorkingMode] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[askWatchdogAlarm] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getInputTemp] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getInputVoltage] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getInputCurrent] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getInputPower] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getSystemTemp] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getSystemVoltage] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getSystemCurrent] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getSystemPower] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getBatteryTemp] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getBatteryVoltage] #033[0m done
May 14 13:30:21 picayune-2 python3[3417]: DEBUG:root:#033[94m[getBatteryCurrent] #033[0m done
May 14 13:30:22 picayune-2 python3[3417]: DEBUG:root:#033[94m[getBatteryPower] #033[0m done
May 14 13:30:22 picayune-2 python3[3417]: DEBUG:root:#033[94m[getFirmwareVer] #033[0m done

And when I try some of the example API programs the results are normal:

root@picayune-2:/opt/sixfab/pms/api/example# python3 all_test.py
************* Input Sensors **************
Input Temp: 35.75
Input Voltage: 5.184
Input Current: 0.6
Input Power: 3.11
************* System Sensors **************
System Temp: 49.9
System Voltage: 5.16
System Current: 0.551
System Power: 2.812
************* Battery **************
Battery Temp: 28.75
Battery Voltage: 4.208
Battery Current: 0.0
Battery Power: 0.0
Battery Level: 100
Battery Health: 91
************* Fan **************
Fan Health: 1
Fan Speed Result: 1
Fan Speed: 1
Set Fan Automation Result: 1
Fan Automation: bytearray(b’\x14<’)
************* Others **************
Setting Watchdog Status: 1
Getting Watchdog Status: 0
RGB Animation Result: 1
RGB Animation: bytearray(b’\x03\x03\x03’)
Result Bat. Max Char. Level: 1
Bat. Max Char. Level: 90
Result Safe Shutdown Bat Lev.: 1
Safe Shutdown Bat Lev.: 10
Result Safe Shutdown Bat Status.: 1
Safe Shutdown Bat Status.: 0
Button 1 Status: 3
Button 2 Status: 3
Ask Watchdog Alarm: 2
Set Battery Design Capacity Result: 1
Battery Design Capacity: 1340
Firmware Ver: v0.2.3
Hard Power Off: 2
Soft Power Off: 2
Hard Reboot: 1

What firmware and software version is your device using?

Agent.py: version = “0.1.5”
Firmware Ver: v0.2.3
Raspberry Pi 3 Model B Plus Rev 1.3
Linux xxxx 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux
Raspbian stretch

Could you share a screenshot of the dashboard?

Screen shot of Dashboard

I had a similar initial experience here’s my discovery:
pms agent & api use many ‘f-string’ variables which is only supported in python 3.6.x and higher. Stretch has python 3.5.x by default, so download 3.6 or higher and ‘make’ into your existing image. A quicker solution so that you can validate the power portal would be to download Buster lite and have a clean install with python3.7.x already included.

register the device in the power portal and copy the curl string generated into your pi’s terminal. I always precede curl & wget with sudo but that’s just me.

this should successfully register the device and start publishing data (this is an MQTT pub/sub connection).

Once confirmed go to the configuration “tab” in the power portal and scroll to the bottom and update both the firmware & the software (pms agent). I would execute FW first, wait for completion then move on to software. You should end up with FW 0.2.7 & SW 0.1.5

the api (sixfab-power-python-api) is installed as part of the pms agent install when registering the device.
However it was (and may still be) installing 0.0.1.
use pip3 list to see which version of the package is installed.
IF the ‘.1’ then type ‘sudo pip3 install sixfab-power-python-api -U’, run pip3 list again and you should see the 0.0.2 version.

please update this thread with your results.

1 Like

Thank you for sharing your experience. @mark.donofrio :+1: :yellow_heart:

Right! Also update and upgrade the system. (sudo apt-get update && sudo apt-get upgrade)

To test this, type: sudo watch systemctl status pms_agent.service

@mark.donofrio thank you for this information. This software package needs to check for Python 3.6 and issue a warning message if not available. I was unaware of this new string format option in Python. I can’t easily upgrade this particular system to the latest Raspbian. Just doing an apt-get upgrade does not bring in Python 3.6 and compiling Python from scratch violates my “only use packages” system maintenance.

So Sixfab should state up front that Buster with Python 3.6 is required.

We will do it as soon as possible :+1:
I recommend using virtualenv.

you can try “converting down” with something like f2format (pip install f2format). I can’t vouch for this and I can’t speak to your “only use packages” agreement, just a suggestion. It seems you’re in a bit of a bind if you can’t install python 3.6/7/8.x and you can’t swap SD card images for ups testing.

@mark.donofrio thanks for the suggestion to try another SD card. I can do that for testing pretty easily.
Meanwhile, I modified the toolkit to remove the troublesome f" strings. They’re only found in a couple of files and the Python %s syntax works well to provide alternate code. Perhaps Sixfab should make these changes to allow earlier versions of Python to be useable. Unless I made a mistake somewhere the code changes did not help and I still have no dashboard data (see below).

agent/core/modules/set_configurations.py

# set scheduled events                                                                                                                                                          
for ignored_field in data["ignored_fields"]:  # clear ignored events                                                                                                                                                             
    for event in data["scheduled"]:
        event_id_test = "event_" + event['_id']
        if event_id_test == ignored_field:
            data["scheduled"].remove(event)

for _id in ids_to_add:

    if "event_" + _id in data["ignored_fields"]:
        continue

agent/core/modules/updater.py

def send_status(status):
    mqtt_client.publish(
        "/device/%s/hive" % token,
        json.dumps({
            "command": "update_status_firmware",
            "status": status
        })
    )

send_status("git")
if os.path.exists(LOCAL_FIRMWARE_FOLDER):
    os.system("cd %s && sudo git pull" % LOCAL_FIRMWARE_FOLDER)
else:
    os.system("sudo git clone %s %s" % (remote_repository, LOCAL_FIRMWARE_FOLDER))

latest_version = open("%s/latest_version" % LOCAL_FIRMWARE_FOLDER).read().strip()
latest_firmware = "%s/sixfab_pms_firmware_%.bin" % (LOCAL_FIRMWARE_FOLDER, latest_version)


def send_status(status):
    mqtt_client.publish(
        "/device/%s/hive" % token,
        json.dumps({
            "command": "update_status_agent",
            "status": status
        })
    )

With these changes the system is running without error and I’m getting a new “Received PUBLISH (d0, q0, r0, m0), '/device/Path-” message, but still no data on the Dashboard.

May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:[FEEDER] Starting, locking
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getBatteryLevel] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getBatteryHealth] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getFanSpeed] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getFanHealth] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getWorkingMode] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[askWatchdogAlarm] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getInputTemp] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getInputVoltage] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getInputCurrent] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getInputPower] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getSystemTemp] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getSystemVoltage] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getSystemCurrent] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getSystemPower] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getBatteryTemp] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getBatteryVoltage] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getBatteryCurrent] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getBatteryPower] #033[0m done
May 20 09:46:22 picayune-2 python3[22839]: DEBUG:root:#033[94m[getFirmwareVer] #033[0m done
May 20 09:46:23 picayune-2 python3[22839]: Received PUBLISH (d0, q0, r0, m0), ‘/device/Path- xxx -Curvy/directives’, … (58 bytes)
May 20 09:46:23 picayune-2 python3[22839]: DEBUG:root:Setting RTC time to default
May 20 09:46:23 picayune-2 python3[22839]: DEBUG:root:#033[94m[setRtcTime] #033[0m Function executed success

yes, your data set is empty. give buster lite a try on a fresh SD. you’ll see that the power portal works rather well for beta. best of luck.

After installing a new SD card and reinstalling the software, I’m now getting statistics on the Dashboard, finally. Everything looks normal except fan rotation states 6600 rpm which seems really high and unusual. I loaded 2020-02-13-raspbian-buster-full.img with all the latest updates.

I had a similar problem with raspbx on a pi4. With “sudo systemctl status pms_agent” and “sudo journalctl” I could see that the pms_agent service could not be started.

The Sixfab Power HAT installer expects that a user pi exists, which is a member of the groups sudo, i2c and video and is allowed execute sudo without password.

If you are using an image other than raspbian or you want the pms_agent service to run as a different user (e.g. power), you could do the following:

# create user power, add power to the groups: sudo, i2c, video
sudo adduser power
sudo adduser power sudo
sudo adduser power i2c
sudo adduser power video

# edit /etc/sudoers and at the end of the file insert a line with the following content: "power ALL=(ALL) NOPASSWD:ALL".
echo "power ALL=(ALL) NOPASSWD:ALL"|sudo EDITOR='tee -a' visudo

# stop pms_agent, edit user in /etc/systemd/system/pms_agent.service and start pms_agent
sudo systemctl stop pms_agent
sudo sed -i 's/^\(User=\).*/\1power/' /etc/systemd/system/pms_agent.service
sudo systemctl start pms_agent

Hi. I am connected by no data

1 Like

Hi @chjunke,

The installer updated and these checks added.
Thanks for contributing. :heart:

Hello I have this problem too. Connected, but with no data. I’m using a pi4 with “Raspberry Pi OS with desktop” - Release date: January 11th 2021

Hi Kev,

I’m working on this same issue myself.
On your pi can you open a terminal and enter:

python3 /opt/sixfab/pms/api/run_server.py

Then refresh the web page and let me know if that improves anything for you!

Regards,
Daniel

Hello @ensar,

I have found in my case that pms/api/run_server/py isn’t running automatically on system startup, I’m not sure if this is down to me using the ‘power’ user as suggested above or if this is something that happens to 1 in x users - hopefully Kev’s set up should be able to clarify this for us.

In order to ‘fix’ this issue I have added:
@python3 /opt/sixfab/pms/api/run_server.py & disown
To /etc/xdg/lxsession/LXDE-pi/autostart

Hopefully this will provide a solution to those who are experiencing this issue.

Regards,
Daniel

pi@raspberrypi:~ $ python3 /opt/sixfab/pms/api/run_server.py

  • Serving Flask app “src” (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
    Traceback (most recent call last):
    File “/opt/sixfab/pms/api/run_server.py”, line 6, in
    app.run(host=“0.0.0.0”, port=6060, threaded=False, processes=1, debug=bool(is_debug_enabled))
    File “/usr/local/lib/python3.7/dist-packages/flask/app.py”, line 990, in run
    run_simple(host, port, self, **options)
    File “/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py”, line 1052, in run_simple
    inner()
    File “/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py”, line 1005, in inner
    fd=fd,
    File “/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py”, line 863, in make_server
    host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
    File “/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py”, line 740, in init
    HTTPServer.init(self, server_address, handler)
    File “/usr/lib/python3.7/socketserver.py”, line 452, in init
    self.server_bind()
    File “/usr/lib/python3.7/http/server.py”, line 137, in server_bind
    socketserver.TCPServer.server_bind(self)
    File “/usr/lib/python3.7/socketserver.py”, line 466, in server_bind
    self.socket.bind(self.server_address)
    OSError: [Errno 98] Address already in use

I did try to add the power user as described above, but I had problems editing the sudoers file so I’m going to start over again this evening with a fresh install.