PMS firmware version 0.3 update fail

Hi,

I try to update the pms firmware with “sixfab_pms_firmware_v0.3.0.bin”

1. Test read sensor before update firmware

************* Input Sensors **************
Input Temp: 33.25
Input Voltage: 14.72
Input Current: 0.25
Input Power: 3.68
************* System Sensors **************
System Temp: 40.0
System Voltage: 5.168
System Current: 0.68
System Power: 3.468
************* Battery **************
Battery Temp: 29.87
Battery Voltage: 4.002
Battery Current: 0.0
Battery Power: 0.0
Battery Level: 81
Battery Health: 100
************* Fan **************
Fan Health: 1
Fan Speed: 7365
************* RTC Time **************
RTC Time: 1594413675
RTC Time: 2020-07-10 20:41:15
************* Event **************
IDs of Scheduled Events: bytearray(b'\x01\x02')
************* Firmware Ver **************
Firmware Ver: v0.2.7

2. I download sixfab_pms_firmware_v0.3.0.bin in local PI

3. I update pms api why “pip3 install sixfab-power-python-api --upgrade”

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting sixfab-power-python-api
  Downloading https://files.pythonhosted.org/packages/69/7b/730863d9d32f40746bbecf39df3513e55ee7d03a2cc81e78b0b7272515df/sixfab_power_python_api-0.0.6-py3-none-any.whl
    Requirement already satisfied, skipping upgrade: smbus2==0.3.0 in /usr/local/lib/python3.7/dist-packages (from sixfab-power-python-api) (0.3.0)
    Requirement already satisfied, skipping upgrade: crc16==0.1.1 in /usr/local/lib/python3.7/dist-packages (from sixfab-power-python-api) (0.1.1)
    Installing collected packages: sixfab-power-python-api
      Found existing installation: sixfab-power-python-api 0.0.4
        Uninstalling sixfab-power-python-api-0.0.4:
          Successfully uninstalled sixfab-power-python-api-0.0.4
    Successfully installed sixfab-power-python-api-0.0.6

4. I update the pms firmware with “sixfab_pms_firmware_v0.3.0.bin” and script “pms_upgrade_firmware.py”

root@b0x:/opt/b0x# cat pms_upgrade_firmware.py
#!/usr/bin/env python3
from power_api import SixfabPower, Definition
import time

api = SixfabPower()

result = 2 # failed by default

firmware_path = “/opt/b0x/sixfab_pms_firmware_v0.3.0.bin”

try:
    for step in api.update_firmware(firmware_path):
        print(f"{step}%")

    print(f"Process ended with status code {result}")
except:
    print("raised error")

root@b0x:/opt/b0x# ./pms_upgrade_firmware.py
1%
2%
3%
4%
5%
6%
7%
8%
9%
10%
11%
12%
13%
14%
15%
16%
17%

94%
95%
96%
97%
98%
99%
100%
FIRMWARE UPDATE SUCCESSFULLY ENDED
1%
Process ended with status code 2

5. And I try to read pms sensor with https://github.com/sixfab/sixfab-power-python-api

************* Input Sensors **************
error in 0
Traceback (most recent call last):
File “./sixfab_read_sensors.py”, line 10, in
print("Input Temp: " + str(api.get_input_temp()))
File “/usr/local/lib/python3.7/dist-packages/power_api/power_api.py”, line 102, in get_input_temp
raw[PROTOCOL_HEADER_SIZE : COMMAND_SIZE_FOR_INT32 - 2], “big”
TypeError: ‘int’ object is not subscriptable

And now my PMS hat doesn’t work.

An idea to solve this problem ?

Regard,
Alexandre

Hi Alexandre,
Run the read sensor example script on the command line a few times. Also, if the pms_agent service is active, it can cause conflicts. Please stop the service and try again.

Thank you.

Hey,

I have the same issue. Every script gives this error and I can’t even get my device online in the dashboard.

TypeError: ‘int’ object is not subscriptable
Sometimes the code runs but most of the time it does not.
It is very buggy and inconsistent I would suggest using this with your scripts.

Hello @ensar,

All my tests was do with pms service stopped !
In my 1er post when I updated the firmware, the end of log said : Process ended with status code 2
This may be the reason for this problem.

root@b0x:/opt/b0x# ./pms_upgrade_firmware.py
...
FIRMWARE UPDATE SUCCESSFULLY ENDED    
1%
Process ended with status code 2

Actually it is not a problem said in the log. Installing new firmware takes time(~10-15sec).

It’s normal to see this in the log.

So, in my 1st post the firmware update seem to me OK (1 to 100%, with FIRMWARE UPDATE SUCCESSFULLY ENDED and after I see 1% and Process ended with status code 2).

If now, I try to update again the firmware, I have this output :

root@b0x:/opt/b0x# ./pms_upgrade_firmware.py 
error in 0
raised error

All read sensor call are KO. And on the HAT I have just the pwd red LED ON. And the other LED are down. And press ( S1, S2 long or short) the buttons do nothing !

Hi,
@ensar, Is there a solution to this problem?
Regard,
Alexandre

Hi Alexandre,
Please follow the instructions below to solve this problem.
https://docs.sixfab.com/page/sixfab-ups-hat-manual-firmware-update-instructions

Thank you.

Hi @ensar,

Thanks a lot for this instructions.

In my case, I get stuck in step 3 : “Release the buttons when the L1 lit magenta. This indicates that UPS HAT is working in bootloader mode.”

-> the L1 lit yellow and not magenta !

Alexandre

I’m having the same issue as @adm, I am not seeing L1 turn magenta and the unit does not seem to enter boot loader mode.
-Power Hat firmware update tool raises an error (after downloading the firmware and updating the path).
-Power Hat is no longer responding to the PMS agent after several enable/start/stop/disable cycles and reboots
-Predictably, I’m no longer seeing the device on the Sixfab Power dashboard.

Have you completed the other steps in those instructions? @adm

Would you share error messages and the logs of the pms_agent service? @c_c_h

Hi @ensa,
Yes I do all over step but at the seven step when I update the FW I have a error.
My API is updated, the pms.service is stopped. And I try it several time.
Regard,
Alexandre

Hi @ensar,

You think that my PMS HAT is dead or I a chance to comeback to a good state ?
Regard,
Alexandre

Hi @adm,

Could you please mention the error message thrown here.
What is the status of the LEDs?
Have you tried reinstalling power software?

Hi,

-> Le power LED is RED
-> L1 lit YELLOW
-> L2 is off

-> My Sixfab PMS API is uptodate

root@b0x:/opt/b0x# ./pms_upgrade_firmware.py
raised error

-> root@b0x:/opt/b0x# cat pms_upgrade_firmware.py

#!/usr/bin/env python3
from power_api import SixfabPower, Definition
import time
import sys, os

api = SixfabPower()

firmware_path = "/opt/b0x/sixfab_pms_firmware_v0.3.0.bin"

error_occured = 0
try:
    for step in api.update_firmware(firmware_path):
        print(f"{step}%")
        
except:
    error_occured = 1
    print("raised error")

finally:
    update_successful = 0
    if error_occured is 0:
        counter = 0
        
        for i in range(15):
            print('.', sep=' ', end=' ', flush=True)
            time.sleep(1)

        while(1):
            try:
                sys.stdout = open(os.devnull, 'w')
                fw_ver = api.get_firmware_ver()
                sys.stdout = sys.__stdout__
            except:
                counter += 1
                print('.', sep=' ', end=' ', flush=True)
            else:
               update_successful = 1
            finally:
                if update_successful is 1:
                    print("\nUpdate is Successful to FW Ver: " + str(fw_ver))
                    break
                else: 
                    if counter >= 10:
                        print("Update is Failed!")
                        break
            
            time.sleep(2)

Regard,
Alexandre

This indicates that PMS HAT is not dead.

Try to create and update a new device on power.sixfab.com.

1. I created un new device on https://power.sixfab.com/ :

root@b0x:~# curl https://install.power.sixfab.com | sudo sh -s xxxxx-Data-Heap-xxxx-Pagan-Dizzy-xxxx-Stash-Yo-Yo-Bolt-Evade-Watch-Stout-Fifty-Cargo-Try-Slice-xxxx
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4498  100  4498    0     0   8785      0 --:--:-- --:--:-- --:--:- _____ _       __      _      ______                      
/  ___(_)     / _|    | |     | ___ \                     
\ `--. ___  _| |_ __ _| |__   | |_/ /____      _____ _ __ 
 `--. \ \ \/ /  _/ _` | '_ \  |  __/ _ \ \ /\ / / _ \ '__|
/\__/ / |>  <| || (_| | |_) | | | | (_) \ V  V /  __/ |   
\____/|_/_/\_\_| \__,_|_.__/  \_|  \___/ \_/\_/ \___|_|   
-  8768Updating system package index...

Creating Sixfab root directory on /opt...
Directory already exists.
Enabling i2c...
I2C enabled.
Looking for dependencies...
Updating python api for agent...
Python api installed.
Installing agent dependencies from PyPI...
Environment file exists, updated token.
Agent already installed, restarting...

2. My PI not restart automatically

So -> I reboot the PI

3. After reboot see the https://power.sixfab.com/ console below after try tu update the Firmware

with "error occurred"

4. See below my /var/log/daemon.log and my systemctl status pms_agent.service

4.1. /var/log/daemon.log

root@b0x:~# tail -f /var/log/daemon.log | grep python3
Jul 27 21:37:54 b0x python3[3603]: error in 0
Jul 27 21:37:57 b0x python3[3603]: error in 0
Jul 27 21:38:01 b0x python3[3603]: error in 0
Jul 27 21:38:05 b0x python3[3603]: error in 0
Jul 27 21:38:08 b0x python3[3603]: error in 0
Jul 27 21:38:12 b0x python3[3603]: error in 0
Jul 27 21:38:15 b0x python3[3603]: error in 0
Jul 27 21:38:19 b0x python3[3603]: Received PUBLISH (d0, q0, r0, m0), ‘/device/…censored_uuid…/directives’, … (45 bytes)
Jul 27 21:38:19 b0x python3[3603]: error in 0
Jul 27 21:38:21 b0x python3[3603]: Sending PINGREQ
Jul 27 21:38:21 b0x python3[3603]: Received PINGRESP
Jul 27 21:38:23 b0x python3[3603]: error in 0
Jul 27 21:38:26 b0x python3[3603]: error in 0
Jul 27 21:38:28 b0x python3[3603]: Exception in thread Thread-4:
Jul 27 21:38:28 b0x python3[3603]: Traceback (most recent call last):
Jul 27 21:38:28 b0x python3[3603]: File “/usr/lib/python3.7/threading.py”, line 917, in _bootstrap_inner
Jul 27 21:38:28 b0x python3[3603]: self.run()
Jul 27 21:38:28 b0x python3[3603]: File “/usr/lib/python3.7/threading.py”, line 865, in run
Jul 27 21:38:28 b0x python3[3603]: self._target(*self._args, **self._kwargs)
Jul 27 21:38:28 b0x python3[3603]: File “/opt/sixfab/pms/agent/core/init.py”, line 162, in _wait_ntp_and_update_rtc
Jul 27 21:38:28 b0x python3[3603]: update_timezone(self.PMSAPI, timezone)
Jul 27 21:38:28 b0x python3[3603]: File “/opt/sixfab/pms/agent/core/modules/set_configurations.py”, line 109, in update_timezone
Jul 27 21:38:28 b0x python3[3603]: try_until_done(api, “setRtcTime”, int(time.time() - time.timezone))
Jul 27 21:38:28 b0x python3[3603]: File “/opt/sixfab/pms/agent/core/modules/recovery.py”, line 41, in try_until_done
Jul 27 21:38:28 b0x python3[3603]: raise OverflowError("")
Jul 27 21:38:28 b0x python3[3603]: OverflowError
Jul 27 21:38:30 b0x python3[3603]: error in 0
Jul 27 21:38:33 b0x python3[3603]: error in 0
Jul 27 21:38:37 b0x python3[3603]: error in 0
Jul 27 21:38:41 b0x python3[3603]: error in 0
Jul 27 21:38:44 b0x python3[3603]: error in 0
Jul 27 21:38:46 b0x python3[3603]: Exception in thread Thread-5:
Jul 27 21:38:46 b0x python3[3603]: Traceback (most recent call last):
Jul 27 21:38:46 b0x python3[3603]: File “/usr/lib/python3.7/threading.py”, line 917, in _bootstrap_inner
Jul 27 21:38:46 b0x python3[3603]: self.run()
Jul 27 21:38:46 b0x python3[3603]: File “/usr/lib/python3.7/threading.py”, line 865, in run
Jul 27 21:38:46 b0x python3[3603]: self._target(*self._args, **self._kwargs)
Jul 27 21:38:46 b0x python3[3603]: File “/opt/sixfab/pms/agent/core/init.py”, line 162, in _wait_ntp_and_update_rtc
Jul 27 21:38:46 b0x python3[3603]: update_timezone(self.PMSAPI, timezone)
Jul 27 21:38:46 b0x python3[3603]: File “/opt/sixfab/pms/agent/core/modules/set_configurations.py”, line 109, in update_timezone
Jul 27 21:38:46 b0x python3[3603]: try_until_done(api, “setRtcTime”, int(time.time() - time.timezone))
Jul 27 21:38:46 b0x python3[3603]: File “/opt/sixfab/pms/agent/core/modules/recovery.py”, line 41, in try_until_done
Jul 27 21:38:46 b0x python3[3603]: raise OverflowError("")
Jul 27 21:38:46 b0x python3[3603]: OverflowError
Jul 27 21:38:48 b0x python3[3603]: error in 0
Jul 27 21:38:50 b0x python3[3603]: error in 0
Jul 27 21:38:51 b0x python3[3603]: Sending PINGREQ
Jul 27 21:38:51 b0x python3[3603]: Received PINGRESP
Jul 27 21:38:53 b0x python3[3603]: error in 0
Jul 27 21:38:57 b0x python3[3603]: error in 0
Jul 27 21:39:01 b0x python3[3603]: error in 0
Jul 27 21:39:04 b0x python3[3603]: error in 0
Jul 27 21:39:06 b0x python3[3603]: Sending PUBLISH (d0, q0, r0, m5), ‘b’/device/…censored_uuid…/hive’’, … (54 bytes)
Jul 27 21:39:07 b0x python3[3603]: Already up to date.
Jul 27 21:39:09 b0x python3[3603]: error in 0
Jul 27 21:39:13 b0x python3[3603]: error in 0
Jul 27 21:39:16 b0x python3[3603]: error in 0
Jul 27 21:39:20 b0x python3[3603]: error in 0
Jul 27 21:39:22 b0x python3[3603]: Sending PINGREQ
Jul 27 21:39:22 b0x python3[3603]: Received PINGRESP
Jul 27 21:39:24 b0x python3[3603]: error in 0
Jul 27 21:39:25 b0x python3[3603]: Sending PUBLISH (d0, q0, r0, m6), ‘b’/device/…censored_uuid…/hive’’, … (56 bytes)
Jul 27 21:39:42 b0x python3[3603]: error in 0
Jul 27 21:39:44 b0x python3[3603]: error in 0

4.2. systemctl status pms_agent.service

root@b0x:~# systemctl status pms_agent.service 
● pms_agent.service - Sixfab PMS Agent
   Loaded: loaded (/etc/systemd/system/pms_agent.service; disabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-07-27 21:37:49 CEST; 12min ago
 Main PID: 3603 (python3)
    Tasks: 4 (limit: 4915)
   Memory: 17.3M
   CGroup: /system.slice/pms_agent.service
           └─3603 /usr/bin/python3 -u agent.py

Jul 27 21:49:55 b0x python3[3603]: Sending PINGREQ
Jul 27 21:49:55 b0x python3[3603]: Received PINGRESP
Jul 27 21:49:57 b0x python3[3603]: error in 0
Jul 27 21:50:01 b0x python3[3603]: error in 0
Jul 27 21:50:05 b0x python3[3603]: error in 0
Jul 27 21:50:07 b0x python3[3603]: error in 0
Jul 27 21:50:10 b0x python3[3603]: error in 0
Jul 27 21:50:14 b0x python3[3603]: error in 0
Jul 27 21:50:18 b0x python3[3603]: error in 0
Jul 27 21:50:21 b0x python3[3603]: error in 0

Regard.

Here is what I found

I couldn’t get the software to update using the official instructions. Pressing and holding both buttons never turns any LED magenta and repeated execution on the update script does not work.
Using the dashboard to update the board does not work and configurations are not pushed to the device

What worked:

  • Stop and disable pms_agent sudo systemctl stop pms_agent.service && sudo systemctl disable pms_agent.service
  • Update python API pip3 install sixfab-power-python-api --upgrade
  • Shutdown pi and press S2 before powering on.
  • While pressing only S2 power pi (using the type-c port on the hat) on and wait until LED 2 lights a constant green - about 3 seconds hold should do
  • Run update software on terminal. May require multiple runs. Mine started updating after 3 runs
  • Enable and restart pms_agent sudo systemctl enable pms_agent.service && sudo systemctl restart pms_agent.service

After this the hat works perfectly with the fun cooling. I hope the team gets to address this so at least the fan runs without requiring a software update

Hi @tn9,

In my State this procedure don’t work for me.

Regard,
Alexandre