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

Camera battery_level no longer reflects voltage #865

Closed
dashrb opened this issue Jan 21, 2024 · 10 comments · Fixed by #877
Closed

Camera battery_level no longer reflects voltage #865

dashrb opened this issue Jan 21, 2024 · 10 comments · Fixed by #877

Comments

@dashrb
Copy link
Contributor

dashrb commented Jan 21, 2024

Describe the bug
Previously, the camera config.signals.battery JSON field appeared to reflect the voltage of the XT* camera's battery, in centivolts (i.e. 167 would mean 1.67v) (Note: the doorbell and the MINI cameras appeared to not report voltage).

However, as of approximately 2023-12, the cameras no longer report their voltage. This appears to be a problem with the BLINK systems, not with blinkpy per se, as I show below. If you agree, then there isn't really any action you can take to fix/revert this functionality. But I open this ticket in hopes that an additional set of eyes will uncover something that I missed.

To Reproduce
Steps to reproduce the behavior:

  1. Enable logging of DEBUG in blinkpy/sync_module.py (I added a line logging.basicConfig(level=logging.DEBUG) after the _LOGGER = logging.getLogger(__name__) line, although there may be better ways to do this)
  2. Connect to blink as shown in the example blinkapp.py.
  3. Store the JSON output generated with DEBUG logging, and observe that for each camera, the config.signal.battery field now shows a single digit integer, either 2 or 3.

blinkpy version: v0.22.5

Log Output/Additional Information
Almost all of my cameras are on USB mains power.
I previously observed that my doorbell, and my mini camera (handling the doorbell chime) never reported a battery voltage. My nightly info cronjob would print out information such as this (from 2023-11-29):

Camera Info:
 - CB-Doorbell:    0.00v    0°     ARMED
 - CB-Foyer:       0.00v    0°  DISARMED
 - CB-Sidewalk:    1.43v   18°     ARMED
 - CB-BonusRoom:   1.67v   66°  DISARMED
 - CB-Grill Porch: 1.69v   22°     ARMED
 - CB-Rec Room:    1.69v   61°  DISARMED
 - CB-Garage:      1.70v   55°     ARMED
 - CB-Kitchen:     1.70v   66°  DISARMED
 - CB-Parking:     1.70v   18°     ARMED
 - CB-Pool:        1.70v   20°     ARMED
 - CB-Back Porch:  1.71v   22°     ARMED
 - CB-Data Center: 1.71v   65°  DISARMED
 - CB-Driveway:    1.71v   20°     ARMED
 - CB-Mudroom:     1.71v   64°  DISARMED
 - CB-Workshop:    1.71v   47°     ARMED
 - CB-Family Room: 1.72v   68°  DISARMED

The only camera on an actual pair of AA batteries is my CB-Sidewalk camera, and it's pretty low, at 1.43v.

Started around 2023-12-01, ALL of these values became 0.00v. Today I looked into why this might be, adding the DEBUG as described above, and it appears that the BLINK servers no longer report the voltage. Interestingly, the config.signals.battery field shows a value of 3 for every camera except my CB-Sidewalk camera, which has a value of 2. I don't know why that is (although I acknowledge that the voltage of those AA's is probably below the desired level).

Here is some output during the blinkpy login and metadata fetch, showing what I am getting:

Executing docker image: dashrblink-test
DEBUG:blinkpy.sync_module:logging after setLevel()
INFO:blinkpy.sync_module:logging before setLevel()
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:blinkpy.helpers.util:Setting base url to https://rest-u008.immedia-semi.com.
DEBUG:blinkpy.api:Making GET request to https://rest-u008.immedia-semi.com/api/v3/accounts/REDACTED/homescreen
DEBUG:blinkpy.blinkpy:homescreen = {
  "account": {
    "id": REDACTED,
    "email_verified": true,
    "email_verification_required": true,
    "amazon_account_linked": false
  },
  "networks": [
    {
      "id": 6635,
      "created_at": "2019-06-22T15:01:07+00:00",
      "updated_at": "2023-08-01T22:37:22+00:00",
      "name": "West",
      "time_zone": "America/New_York",
      "dst": true,
      "armed": true,
      "lv_save": false
    },
    {
      "id": 11166,
      "created_at": "2019-06-29T01:20:21+00:00",
      "updated_at": "2023-10-16T16:30:48+00:00",
      "name": "East",
      "time_zone": "America/New_York",
      "dst": true,
      "armed": true,
      "lv_save": false
    },
    {
      "id": 157629,
      "created_at": "2020-03-13T19:18:07+00:00",
      "updated_at": "2023-07-21T23:46:05+00:00",
      "name": "Wkshp",
      "time_zone": "America/New_York",
      "dst": true,
      "armed": true,
      "lv_save": false
    },
    {
      "id": 580601,
      "created_at": "2023-10-16T22:09:41+00:00",
      "updated_at": "2023-11-23T05:01:23+00:00",
      "name": "Out",
      "time_zone": "America/New_York",
      "dst": true,
      "armed": true,
      "lv_save": false
    }
  ],
  "sync_modules": [
    {
      "id": 11096,
      "created_at": "2019-06-22T15:05:21+00:00",
      "updated_at": "2024-01-20T08:24:24+00:00",
      "onboarded": true,
      "status": "online",
      "name": "My Blink Sync Module",
      "serial": "224536819",
      "fw_version": "4.5.17",
      "type": "sm1",
      "subtype": "none",
      "last_hb": "2024-01-21T23:11:29+00:00",
      "wifi_strength": 5,
      "network_id": 6635,
      "enable_temp_alerts": true,
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "local_storage_status": "unavailable",
      "revision": null
    },
    {
      "id": 19142,
      "created_at": "2019-06-29T01:20:31+00:00",
      "updated_at": "2024-01-20T08:24:23+00:00",
      "onboarded": true,
      "status": "online",
      "name": "My Blink Sync Module",
      "serial": "274030833",
      "fw_version": "4.5.17",
      "type": "sm1",
      "subtype": "none",
      "last_hb": "2024-01-21T23:11:58+00:00",
      "wifi_strength": 5,
      "network_id": 11166,
      "enable_temp_alerts": true,
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "local_storage_status": "unavailable",
      "revision": null
    },
    {
      "id": 288984,
      "created_at": "2020-03-13T19:18:25+00:00",
      "updated_at": "2024-01-20T08:24:24+00:00",
      "onboarded": true,
      "status": "online",
      "name": "My Blink Sync Module",
      "serial": "295121217",
      "fw_version": "4.5.17",
      "type": "sm1",
      "subtype": "none",
      "last_hb": "2024-01-21T23:11:51+00:00",
      "wifi_strength": 5,
      "network_id": 157629,
      "enable_temp_alerts": true,
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "local_storage_status": "unavailable",
      "revision": null
    },
    {
      "id": 861098,
      "created_at": "2023-10-16T22:09:46+00:00",
      "updated_at": "2024-01-20T08:24:35+00:00",
      "onboarded": true,
      "status": "online",
      "name": "My Blink Sync Module",
      "serial": "G8T1V70122151PCQ",
      "fw_version": "16.0.8",
      "type": "sm2",
      "subtype": "billy",
      "last_hb": "2024-01-21T23:11:40+00:00",
      "wifi_strength": 5,
      "network_id": 580601,
      "enable_temp_alerts": true,
      "local_storage_enabled": false,
      "local_storage_compatible": true,
      "local_storage_status": "unavailable",
      "revision": "01"
    }
  ],
  "cameras": [
    {
      "id": 14421,
      "created_at": "2019-06-22T20:33:04+00:00",
      "updated_at": "2024-01-21T22:46:25+00:00",
      "name": "CB-BonusRoom",
      "serial": "604900975",
      "fw_version": "2.151",
      "type": "xt",
      "enabled": false,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/6635/xt/14421/thumbnail/thumbnail.jpg?ts=1683234329&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 6635,
      "issues": [],
      "signals": {
        "lfr": 4,
        "wifi": 5,
        "temp": 69,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1150081,
      "created_at": "2023-05-04T20:53:21+00:00",
      "updated_at": "2024-01-21T22:43:26+00:00",
      "name": "CB-Family Room",
      "serial": "658241428",
      "fw_version": "2.151",
      "type": "xt",
      "enabled": false,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/6635/xt/1150081/thumbnail/thumbnail.jpg?ts=1683239853&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 6635,
      "issues": [],
      "signals": {
        "lfr": 3,
        "wifi": 5,
        "temp": 75,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1150093,
      "created_at": "2023-05-04T21:04:13+00:00",
      "updated_at": "2024-01-21T22:28:26+00:00",
      "name": "CB-Garage",
      "serial": "194198099",
      "fw_version": "2.151",
      "type": "white",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/6635/white/1150093/thumbnail/thumbnail.jpg?ts=1685806299&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 6635,
      "issues": [],
      "signals": {
        "lfr": 4,
        "wifi": 5,
        "temp": 52,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1153434,
      "created_at": "2023-05-11T00:16:05+00:00",
      "updated_at": "2024-01-21T22:58:26+00:00",
      "name": "CB-Driveway",
      "serial": "664900979",
      "fw_version": "2.151",
      "type": "xt",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/6635/xt/1153434/thumbnail/thumbnail.jpg?ts=1690721042&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 6635,
      "issues": [],
      "signals": {
        "lfr": 3,
        "wifi": 5,
        "temp": 31,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1164247,
      "created_at": "2023-06-03T20:20:30+00:00",
      "updated_at": "2024-01-21T22:58:26+00:00",
      "name": "CB-Grill Porch",
      "serial": "886639280",
      "fw_version": "7.102",
      "type": "xt2",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/6635/xt2/1164247/thumbnail/thumbnail.jpg?ts=1685838344&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 6635,
      "issues": [],
      "signals": {
        "lfr": 5,
        "wifi": 5,
        "temp": 41,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1164398,
      "created_at": "2023-06-04T00:52:52+00:00",
      "updated_at": "2024-01-21T22:48:25+00:00",
      "name": "CB-Back Porch",
      "serial": "856639274",
      "fw_version": "7.102",
      "type": "xt2",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/11166/xt2/1164398/thumbnail/thumbnail.jpg?ts=1686079755&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 11166,
      "issues": [],
      "signals": {
        "lfr": 5,
        "wifi": 5,
        "temp": 37,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1189058,
      "created_at": "2023-07-15T23:06:04+00:00",
      "updated_at": "2024-01-21T23:03:25+00:00",
      "name": "CB-Kitchen",
      "serial": "638241420",
      "fw_version": "2.151",
      "type": "xt",
      "enabled": false,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/11166/xt/1189058/thumbnail/thumbnail.jpg?ts=1689462625&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 11166,
      "issues": [],
      "signals": {
        "lfr": 5,
        "wifi": 5,
        "temp": 75,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1189122,
      "created_at": "2023-07-15T23:55:55+00:00",
      "updated_at": "2024-01-21T22:46:25+00:00",
      "name": "CB-Mudroom",
      "serial": "644901079",
      "fw_version": "2.151",
      "type": "xt",
      "enabled": false,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/6635/xt/1189122/thumbnail/thumbnail.jpg?ts=1705856529&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 6635,
      "issues": [],
      "signals": {
        "lfr": 5,
        "wifi": 5,
        "temp": 69,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1189217,
      "created_at": "2023-07-16T02:22:50+00:00",
      "updated_at": "2024-01-21T21:48:25+00:00",
      "name": "CB-Rec Room",
      "serial": "886639370",
      "fw_version": "7.102",
      "type": "xt2",
      "enabled": false,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/11166/xt2/1189217/thumbnail/thumbnail.jpg?ts=1689474491&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 11166,
      "issues": [],
      "signals": {
        "lfr": 5,
        "wifi": 5,
        "temp": 69,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1189218,
      "created_at": "2023-07-16T02:42:56+00:00",
      "updated_at": "2024-01-21T21:43:26+00:00",
      "name": "CB-Data Center",
      "serial": "836639267",
      "fw_version": "7.102",
      "type": "xt2",
      "enabled": false,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/6635/xt2/1189218/thumbnail/thumbnail.jpg?ts=1689475460&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 6635,
      "issues": [],
      "signals": {
        "lfr": 5,
        "wifi": 5,
        "temp": 73,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1193164,
      "created_at": "2023-07-21T03:15:07+00:00",
      "updated_at": "2024-01-21T20:47:19+00:00",
      "name": "CB-Workshop",
      "serial": "120873405",
      "fw_version": "2.151",
      "type": "white",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/157629/white/1193164/thumbnail/thumbnail.jpg?ts=1705786681&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 157629,
      "issues": [],
      "signals": {
        "lfr": 5,
        "wifi": 5,
        "temp": 45,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1193596,
      "created_at": "2023-07-21T21:20:33+00:00",
      "updated_at": "2024-01-21T22:32:19+00:00",
      "name": "CB-Parking",
      "serial": "856639265",
      "fw_version": "7.102",
      "type": "xt2",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/157629/xt2/1193596/thumbnail/thumbnail.jpg?ts=1689983181&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 157629,
      "issues": [],
      "signals": {
        "lfr": 5,
        "wifi": 5,
        "temp": 35,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": null,
      "color": "black"
    },
    {
      "id": 1201261,
      "created_at": "2023-08-01T21:12:25+00:00",
      "updated_at": "2024-01-21T22:48:25+00:00",
      "name": "CB-Sidewalk",
      "serial": "G8T1GH0121732K27",
      "fw_version": "10.64",
      "type": "catalina",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/11166/catalina/1201261/thumbnail/thumbnail.jpg?ts=1690925927&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 11166,
      "issues": [],
      "signals": {
        "lfr": 4,
        "wifi": 4,
        "temp": 30,
        "battery": 2
      },
      "local_storage_enabled": false,
      "local_storage_compatible": true,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": "01",
      "color": "black"
    },
    {
      "id": 1201330,
      "created_at": "2023-08-01T22:30:30+00:00",
      "updated_at": "2024-01-21T22:58:26+00:00",
      "name": "CB-Pool",
      "serial": "G8T1GH0121732SS8",
      "fw_version": "10.64",
      "type": "catalina",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/6635/catalina/1201330/thumbnail/thumbnail.jpg?ts=1692657758&ext=",
      "status": "done",
      "battery": "ok",
      "usage_rate": false,
      "network_id": 6635,
      "issues": [],
      "signals": {
        "lfr": 1,
        "wifi": 5,
        "temp": 35,
        "battery": 3
      },
      "local_storage_enabled": false,
      "local_storage_compatible": true,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": "01",
      "color": "black"
    }
  ],
  "sirens": [],
  "chimes": [],
  "video_stats": {
    "storage": 100,
    "auto_delete_days": 60,
    "auto_delete_day_options": [
      3,
      7,
      14,
      30,
      60
    ]
  },
  "doorbell_buttons": [],
  "owls": [
    {
      "id": 594477,
      "created_at": "2023-10-16T22:27:28+00:00",
      "updated_at": "2024-01-21T19:01:18+00:00",
      "name": "CB-Foyer",
      "type": "owl",
      "onboarded": true,
      "serial": "G8V190013113CRS9",
      "fw_version": "9.90",
      "enabled": false,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/580601/owl/594477/thumbnail/thumbnail.jpg?ts=1697495404&ext=",
      "status": "online",
      "network_id": 580601,
      "local_storage_enabled": false,
      "local_storage_compatible": true,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": "01",
      "color": "white"
    }
  ],
  "doorbells": [
    {
      "id": 256160,
      "created_at": "2023-11-23T01:13:44+00:00",
      "updated_at": "2024-01-21T20:50:47+00:00",
      "name": "CB-Doorbell",
      "type": "lotus",
      "onboarded": true,
      "serial": "G8T1TW0222662N40",
      "fw_version": "12.66",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/REDACTED/networks/580601/lotus/256160/thumbnail/thumbnail.jpg?ts=1704648318&ext=",
      "status": "done",
      "network_id": 580601,
      "battery": "ok",
      "doorbell_mode": "lfr",
      "changing_mode": false,
      "signals": {
        "lfr": 4,
        "wifi": 3,
        "battery": 3
      },
      "issues": [],
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "config_out_of_sync": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": "02",
      "color": "black"
    }
  ],
  "app_updates": {
    "message": "An app update is required",
    "code": 105,
    "update_available": true,
    "update_required": true
  },
  "device_limits": {
    "camera": 10,
    "chime": 5,
    "doorbell": 10,
    "doorbell_button": 2,
    "owl": 10,
    "siren": 5,
    "total_devices": 20
  },
  "whats_new": {
    "updated_at": 20210204,
    "url": "https://updates.blinkforhome.com/"
  },
  "subscriptions": {
    "updated_at": "2023-11-23T01:14:04+00:00"
  },
  "entitlements": {
    "updated_at": "2023-11-23T01:14:04+00:00"
  },
  "tiv_lock_enable": true,
  "tiv_lock_status": {
    "locked": true
  },
  "accessories": {
    "storm": [],
    "rosie": []
  }
}
DEBUG:blinkpy.blinkpy:Initialized last_refresh to 1705878689 == 2024-01-21 23:11:29
DEBUG:blinkpy.api:Making GET request to https://rest-u008.immedia-semi.com/networks
DEBUG:blinkpy.api:Making GET request to https://rest-u008.immedia-semi.com/api/v1/camera/usage


@mkmer mkmer mentioned this issue Jan 22, 2024
3 tasks
@dashrb
Copy link
Contributor Author

dashrb commented Jan 25, 2024

Oddly:

  • yesterday at 11:pm EST, my voltages were all 0.00 as described above
  • yesterday at 11:59pm EST, my voltages were properly reported(!) as if there is no problem anymore
  • today at 2:00am EST, my voltages were all 0.00 as described above

During my cron job executions, I don't normally collect the raw JSON for debugging purposes, so I don't have any additional details, unfortunately. I'm not sure what to make of this but perhaps one of these theories has merit:

  1. the blink servers are at varying versions (staggered blue/green deployment?), and I am randomly given an "old version" server, or a "new-version" server
  2. the blink servers are experiencing an intermittent bug of some kind

@mkmer
Copy link
Contributor

mkmer commented Jan 25, 2024

I suppose you could try capturing the json data, to see what is different. It can't hurt having more data :)

IF the signals key exists, we use the battery key for battery level found under signals. If signals key is missing, we fall back to the original key locations if they exist, otherwise None. I suppose it's possible they report the old battery key "some times", but they would also leave the signal keys out, matching with your first theory.

If we can isolate what exactly your receiving, we can handle it.

@dashrb
Copy link
Contributor Author

dashrb commented Jan 25, 2024

makes sense! The JSON for the "all zero voltages" is shown in the original post, and it has "battery" under "signals", but the numbers shown there are "2" or "3" (which have no obvious meaning), as opposed to the old battery_level values in the range of 130-170 (to reflect 1.30v to 1.70 volts).

That said, I'll modify my container so that I capture the raw JSON so in case the battery voltages come back, we can see what the JSON looks like.

@dashrb
Copy link
Contributor Author

dashrb commented Jan 30, 2024

Update after spending some time with this. Please recall above when I mentioned I had 3 cron jobs, at: 11pm, 1159pm, and 2am, and that only the 1159pm job reported the voltage correctly. After looking closer, I discovered/remembered that my 1159pm job is using a docker image with blinkpy v.022 (and properly shows the voltages), while the other jobs are using v0.22.5 and do NOT show the voltage.

This means that the voltage breakage is NOT BECAUSE OF BLINK, but rather, because code has broken in blinkpy between v0.22 and v0.22.5.

So I began to focus on the changes that occurred in the blinkpy code between v0.22 and v0.22.5. I narrowed it down to a discussion in #821 and possibly a logic change in #813, released in v0.22.4. This is in the context of get_unique_info(), a function which in its comment block says that it is to Extract unique information for Minis and Doorbells. I do not believe that the get_unique_info() code is expected to be a "public" call; rather, it is for use internal to sync_module.py. I suspect that @Rosi2143 may be doing something unexpected/undesired.

Bottom line: BECAUSE of the change to type_key_map, the OUTDOOR (XT, XT2) cameras no longer initialize fully. The call to https://rest-u008.immedia-semi.com/network/__ID_HERE__/camera/14421/config is no longer invoked, and thus, blinkpy's copy of the camera info is incomplete.
This logic breakdown happens in sync_module.py, in the function get_camera_info(), where there is a short-circuit if statement on two lines: if unique is not None: return unique.

Because of this short-circuit return, the call to api.request_camera_info() is never made. As a result, the outdoor camera fields only contain the summary camera information in homescreen. For one, the battery_voltage field is missing. This makes me worried about the other "missing" information @mkmer mentioned in #835. I did not investigate these in detail, but I do still see 'wifi_strength': -41 in my output, which makes me fear that his work was in vain.

For my part, I put the following code together:

#!/usr/bin/env python
import argparse
import asyncio
import logging
import pprint
import sys
from aiohttp import ClientSession
from blinkpy import blinkpy
from blinkpy.auth import Auth
from blinkpy.helpers.util import json_load
from blinkpy.helpers import util


parser = argparse.ArgumentParser(description="Issue commands to the Blink System")
parser.add_argument("-v", "--verbose", action="count", help="increase output verbosity", default=0)
args = parser.parse_args()


######################################################################
def print_battery_info(blink):
    print('Camera Info:')
    cam_list = []
    for name, camera in blink.cameras.items():
        #print(" ------------ name: {} ".format(name))
        #pprint.pprint(camera.attributes)
        if camera.attributes['motion_enabled']:
            state = 'ARMED'
        else:
            state = 'DISARMED'

        ### blink doorbells do not have a temperature_calibrated attribute.
        if 'temperature_calibrated' in camera.attributes and camera.attributes['temperature_calibrated'] is not None:
            temp = camera.attributes['temperature_calibrated']
        else:
            temp = 0

        ### blink doorbells do not report their battery voltage!?
        if 'battery_voltage' in camera.attributes and camera.attributes['battery_voltage'] is not None:
            battery = camera.attributes['battery_voltage']
        else:
            battery = 0

        cam_list.append({ 'name': name, 'battery': battery, 'temp': temp, 'state': state })

    for cam_info in sorted(cam_list, key = lambda i: (i['battery'], i['name'])):
        voltage = cam_info['battery'] / 100;
        print(' - {:15s} {:.2f}v  {:3}\N{DEGREE SIGN}  {:>8s}'.format(cam_info['name']+':', voltage, cam_info['temp'], cam_info['state']))
    print('====================')

############################## start of main logic.  Auth first.... ###########

if args.verbose > 1:
    logging.basicConfig(format='%(asctime)s|%(levelname)s|%(message)s', stream=sys.stdout,
                        datefmt='%Y-%m-%d %I:%M:%S %p', level=logging.DEBUG)
    blinkpy._LOGGER.setLevel(logging.DEBUG)

USER_CREDS="/creds/user.json"
TOKEN_CREDS="/creds/tokens.json"

async def asyncstart():
    session = ClientSession()
    blink = blinkpy.Blink(session=session)

    auth_file = TOKEN_CREDS

    auth = Auth(await json_load(auth_file), no_prompt=True, session=session)
    blink.auth = auth

    await blink.start()

    print_battery_info(blink)

    await session.close()

## as of v0.22, blink uses asyncio
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncstart())
loop.close()

And ran it against v0.22:

root@b06b278e16ed:/dashrb/dashrblink# ./small.py
Camera Info:
 - CB-Doorbell:    0.00v    0°     ARMED
 - CB-Foyer:       0.00v    0°  DISARMED
 - CB-Sidewalk:    1.54v   43°     ARMED
 - CB-BonusRoom:   1.62v   71°  DISARMED
 - CB-Pool:        1.69v   47°     ARMED
 - CB-Rec Room:    1.69v   69°  DISARMED
 - CB-Back Porch:  1.70v   49°     ARMED
 - CB-Garage:      1.70v   61°     ARMED
 - CB-Grill Porch: 1.70v   51°     ARMED
 - CB-Parking:     1.70v   47°     ARMED
 - CB-Data Center: 1.71v   73°  DISARMED
 - CB-Driveway:    1.71v   46°     ARMED
 - CB-Kitchen:     1.71v   75°  DISARMED
 - CB-Mudroom:     1.71v   71°  DISARMED
 - CB-Workshop:    1.71v   55°     ARMED
 - CB-Family Room: 1.72v   75°  DISARMED
====================
root@b06b278e16ed:/dashrb/dashrblink# head ../blinkpy/CHANGES.rst
=========
Changelog
=========

A list of changes between each release

0.22.0 (2023-08-16)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Bugfixes**

And also ran it against v0.22.5:

root@4f03e893a49b:/dashrb/dashrblink# ./small.py
/dashrb/dashrblink/./small.py:76: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
Camera Info:
 - CB-Back Porch:  0.00v   49°     ARMED
 - CB-BonusRoom:   0.00v   71°  DISARMED
 - CB-Data Center: 0.00v   73°  DISARMED
 - CB-Doorbell:    0.00v    0°     ARMED
 - CB-Driveway:    0.00v   46°     ARMED
 - CB-Family Room: 0.00v   75°  DISARMED
 - CB-Foyer:       0.00v    0°  DISARMED
 - CB-Garage:      0.00v   61°     ARMED
 - CB-Grill Porch: 0.00v   51°     ARMED
 - CB-Kitchen:     0.00v   75°  DISARMED
 - CB-Mudroom:     0.00v   71°  DISARMED
 - CB-Parking:     0.00v   47°     ARMED
 - CB-Pool:        0.00v   47°     ARMED
 - CB-Rec Room:    0.00v   69°  DISARMED
 - CB-Sidewalk:    0.00v   43°     ARMED
 - CB-Workshop:    0.00v   55°     ARMED
====================
root@4f03e893a49b:/dashrb/dashrblink# head ../blinkpy/CHANGES.rst
=========
Changelog
=========

A list of changes between each release

0.22.5 (2024-01-07)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Warning: This release removes support for Python 3.8 and adds Python 3.12 support.

Finally, I had to add debugging lines to v0.22 but the camera information available in v0.22 is:

{
  "camera": [
    {
      "id": 1193164,
      "created_at": "2023-07-21T03:15:07+00:00",
      "updated_at": "2024-01-30T00:16:00+00:00",
      "deleted_at": "",
      "serial": "120873405",
      "camera_key": "",
      "camera_key_type": "AES128_CBC",
      "fw_version": "2.151",
      "mac_address": "f4:b8:5e:34:61:bd",
      "ip_address": "",
      "thumbnail": "1705786681",
      "name": "CB-Workshop",
      "liveview_enabled": "off",
      "siren_enable": false,
      "siren_volume": "",
      "onboarded": true,
      "unit_number": 1,
      "motion_sensitivity": 8,
      "enabled": true,
      "armed": false,
      "alert_tone_enable": false,
      "alert_tone_volume": 0,
      "alert_repeat": "off",
      "alert_interval": 10,
      "video_length": 60,
      "temp_alarm_enable": false,
      "temp_interval": 1,
      "temp_adjust": 0,
      "temp_min": "",
      "temp_max": "",
      "temp_hysteresis": "",
      "illuminator_enable": 2,
      "illuminator_duration": 1,
      "illuminator_intensity": 7,
      "battery_alarm_enable": false,
      "battery_voltage_interval": 0,
      "battery_voltage_threshold": 512,
      "battery_voltage_hysteresis": 512,
      "last_battery_alert": "",
      "battery_alert_count": 0,
      "lfr_sync_interval": 8,
      "video_50_60hz": "freq_60hz",
      "invert_image": false,
      "flip_image": false,
      "record_audio_enable": true,
      "clip_rate": 2480,
      "liveview_rate": 0,
      "max_resolution": "r1080",
      "auto_test": false,
      "wifi_timeout": 30,
      "retry_count": 0,
      "status": "done",
      "wifi_strength": -27,
      "lfr_strength": -43,
      "temperature": 55,
      "battery_voltage": 171,
      "a1": false,
      "last_temp_alert": "",
      "temp_alert_count": 0,
      "last_wifi_alert": "",
      "wifi_alert_count": 0,
      "last_lfr_alert": "",
      "lfr_alert_count": 0,
      "last_offline_alert": "",
      "offline_alert_count": 0,
      "temp_alert_state": "in_range",
      "battery_state": "ok",
      "battery_check_time": "2024-01-30T00:16:00+00:00",
      "last_snapshot_event": "",
      "motion_regions": 33554431,
      "mfg_main_type": "BMA",
      "mfg_main_range": 1811024665,
      "mfg_mez_type": "BTA",
      "mfg_mez_range": 1811059815,
      "type": "white",
      "ring_device_id": "",
      "first_boot": "2019-06-29T01:37:36+00:00",
      "country_id": "US",
      "usage_alert_count": 0,
      "last_usage_alert": "",
      "snooze_till": "",
      "network_type": "wifi",
      "vo9_strength": 0,
      "local_connection_certificate_id": "",
      "account_id": __REDACTED__,
      "network_id": 157629,
      "sync_module_id": 288984,
      "account": __REDACTED__,
      "network": 157629,
      "camera_seq": 1,
      "last_connect": {
        "camera_id": 1193164,
        "created_at": "2023-07-21T03:15:22+00:00",
        "updated_at": "2024-01-26T09:31:57+00:00",
        "wifi_strength": -38,
        "lfr_strength": -40,
        "battery_voltage": 171,
        "temperature": 60,
        "fw_version": "2.151",
        "fw_git_hash": "",
        "mac": "f4:b8:5e:34:61:bd",
        "ipv": "ipv4",
        "ip_address": "192.168.1.21",
        "error_codes": 0,
        "battery_alert_status": false,
        "temp_alert_status": false,
        "ac_power": true,
        "light_sensor_ch0": 0,
        "light_sensor_ch1": 171,
        "light_sensor_data_valid": false,
        "light_sensor_data_new": false,
        "time_first_video": 0,
        "time_108_boot": 54536,
        "time_wlan_connect": 1140574,
        "time_dhcp_lease": 5031692,
        "time_dns_resolve": 0,
        "lfr_108_wakeups": 2,
        "total_108_wakeups": 3,
        "lfr_tb_wakeups": 65282,
        "total_tb_wakeups": 8707,
        "wifi_connect_failure_count": 0,
        "dhcp_failure_count": 0,
        "socket_failure_count": 0,
        "dev_1": 5034489,
        "dev_2": 26624,
        "dev_3": 120873405,
        "dev_4": "",
        "dev_5": "",
        "dev_6": "",
        "dev_7": "",
        "dev_8": "",
        "unit_number": 1,
        "serial": "120873405",
        "lifetime_count": 0,
        "lifetime_duration": 0,
        "pir_rejections": 0,
        "bl1_major": 0,
        "bl1_minor": 0,
        "bl1_build": 0,
        "bl2_major": 0,
        "bl2_minor": 0,
        "bl2_build": 0,
        "slot_0": 0,
        "slot_1": 0,
        "slot_2": 0,
        "slot_3": 0,
        "dev_keyed_unit": false,
        "network_type": "wifi",
        "vo9_strength": "",
        "sync_module_id": 288984,
        "network_id": 157629,
        "account_id": __REDACTED__
      },
      "motion_alert": true,
      "record_audio": true,
      "buzzer_on": false,
      "early_termination": false,
      "clip_bitrate": 2480,
      "liveview_bitrate": 0,
      "motion_regions_compatible": true,
      "early_pir_compatible": false,
      "early_notification_compatible": false,
      "night_vision_exposure_compatible": false,
      "privacy_zones_compatible": false,
      "zone_version": "v1",
      "video_quality_support": [
        "saver",
        "standard",
        "best"
      ],
      "video_quality": "best",
      "early_notification": false,
      "night_vision_exposure": 1,
      "local_storage_compatible": false,
      "local_storage_enabled": false,
      "clip_max_length": 60,
      "early_termination_supported": true,
      "clip_warning_threshold": 15,
      "flip_video_compatible": false,
      "flip_video": false,
      "video_recording_enable": true,
      "video_recording_optional": false,
      "snapshot_compatible": false,
      "snapshot_enabled": false,
      "snapshot_period_minutes_options": [
        60
      ],
      "snapshot_period_minutes": 60
    }
  ],
  "signals": {
    "lfr": 5,
    "wifi": 5,
    "updated_at": "2024-01-26T09:31:57+00:00",
    "temp": 55,
    "battery": 3,
    "battery_state": "ok"
  }
}

while the camera information available in v0.22.5 is only:

{
  "id": 1193164,
  "created_at": "2023-07-21T03:15:07+00:00",
  "updated_at": "2024-01-30T00:16:00+00:00",
  "name": "CB-Workshop",
  "serial": "120873405",
  "fw_version": "2.151",
  "type": "white",
  "enabled": true,
  "thumbnail": "/api/v3/media/accounts/__REDACTED__/networks/157629/white/1193164/thumbnail/thumbnail.jpg?ts=1705786681&ext=",
  "status": "done",
  "battery": "ok",
  "usage_rate": false,
  "network_id": 157629,
  "issues": [],
  "signals": {
    "lfr": 5,
    "wifi": 5,
    "temp": 55,
    "battery": 3
  },
  "local_storage_enabled": false,
  "local_storage_compatible": false,
  "snooze": false,
  "snooze_time_remaining": "",
  "revision": "",
  "color": "black"
}

(note to self: I took the line of debug, stripped the timestamp, and turned it into legit json via: cat file | tr "'" '"' | perl -p -e 's/True/true/g; s/False/false/g; s/None/""/g;' | jq .)

@fronzbot
Copy link
Owner

Damn, now that's some Grade-A debug work!

So what changes need to be made to get the correct wifi level and battery voltage back? If you want to make the PR to fix this, I'm all for it! Having integers represent this stuff is, frankly, garbage.

@dashrb
Copy link
Contributor Author

dashrb commented Jan 30, 2024

I'll create a PR now. I'd really like @mkmer to weigh in since they had something specific in mind when making those changes.

@dashrb
Copy link
Contributor Author

dashrb commented Jan 30, 2024

PR created. Would also like @Rosi2143 to acknowledge this, and maybe clarify their use of get_unique_info() because from what I can tell, that only returns info for mini's and doorbells. Outdoor/Indoor cameras have their own REST API to call. But as a fellow user of blinkpy, could they just access the attributes from blink.cameras... and see the information they want?

My apologies, I'm not intimately familiar with how others use this library so I may be speaking out of line.

@mkmer
Copy link
Contributor

mkmer commented Jan 30, 2024

@dashrb - Since I only own a doorbell, it's been a tough road to test everything. I could only look at what was in front of me and it looks like I missed the root cause.
I think you are on the right track and some great work here!

@mkmer
Copy link
Contributor

mkmer commented Jan 30, 2024

@dashrb I'm on vacation right now so I really can't check this out (or I would dig in to see), I only have doorbells on my system with a sync module and the voltage level and wifi key was missing. How would this PR change what I was seeing in my JSON data?

@dashrb
Copy link
Contributor Author

dashrb commented Jan 30, 2024

Alas, the doorbells and mini cameras seemingly do not report temperature, or voltage, or wifi_strength in dB.

Full Camera

The blink app for a full camera shows:

  1. temperature in degrees Fahrenheit
  2. wifi connection in a graphical form (wifi symbol with a varying number of arcs, and colored green, yellow, or red) -- this is probably from the "1-5" range reported in the signals section of the json.
  3. sync module connection in a graphical form (the bar graph of 4 "stairs", in green) (likely from signals.lfr)
  4. Battery: for my USB-powered cameras, this used to say "Battery level: OK", but now it says "External Power Status: Good". The battery powered cameras currently say "Battery level: OK" even though my weakest one is down to 1.54v according to the JSON.

The JSON includes these relevant fields:

'temperature': 47,
'wifi_strength': -63,
'lfr_strength': -83,
'battery_voltage': 154,
'signals': {'lfr': 3, 'wifi': 3, 'updated_at': '2024-01-29T13:03:47+00:00', 'temp': 47, 'battery': 3, 'battery_state': 'ok'}

Mini Camera (aka "owl")

The blink app for a mini camera shows:

  1. no temperature information at all
  2. wifi connection in a graphical form (like the full cameras). (But there's nothing in the homescreen JSON about this; how does it know?)
  3. no sync module connection strength information
  4. no battery information at all (mine happens to be powered from USB)

In blinkpy, the JSON for mini's is only read from the /homescreen REST URL (there must be another camera URL that the app queries!):

  "owls": [
    {
      "id": 594477,
      "created_at": "2023-10-16T22:27:28+00:00",
      "updated_at": "2024-01-29T07:57:58+00:00",
      "name": "CB-Foyer",
      "type": "owl",
      "onboarded": true,
      "serial": "G8V190xxxxx",
      "fw_version": "9.90",
      "enabled": false,
      "thumbnail": "/api/v3/media/accounts/XXXX/networks/580601/owl/594477/thumbnail/thumbnail.jpg?ts=1697495404&ext=",
      "status": "online",
      "network_id": 580601,
      "local_storage_enabled": false,
      "local_storage_compatible": true,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": "01",
      "color": "white"
    }
  ],

Doorbell (aka "lotus")

The blink app for my doorbell shows:

  1. no temperature information at all
  2. wifi connection in a graphical form (like the full cameras) (mine happens to be yellow at the moment) (likely from signals.wifi which has a value of 3)
  3. sync module connection in a graphical form (the bar graph of 4 "stairs", in green) (likely from signals.lfr with a value of 4).
  4. Battery Level "OK". I do have a pair of AA batteries in here so I wish I had access to the voltage, but I don't see it in the json

In blinkpy, the JSON for the doorbells is only read from the /homescreen REST URL, and mine looks like this:

  "doorbells": [
    {
      "id": 256160,
      "created_at": "2023-11-23T01:13:44+00:00",
      "updated_at": "2024-01-30T16:37:45+00:00",
      "name": "CB-Doorbell",
      "type": "lotus",
      "onboarded": true,
      "serial": "G8T1TW02xxxx",
      "fw_version": "12.66",
      "enabled": true,
      "thumbnail": "/api/v3/media/accounts/xxxxxx/networks/580601/lotus/256160/thumbnail/thumbnail.jpg?ts=1704648318&ext=",
      "status": "done",
      "network_id": 580601,
      "battery": "ok",
      "doorbell_mode": "lfr",
      "changing_mode": false,
      "signals": {
        "lfr": 4,
        "wifi": 3,
        "battery": 3
      },
      "issues": [],
      "local_storage_enabled": false,
      "local_storage_compatible": false,
      "config_out_of_sync": false,
      "snooze": false,
      "snooze_time_remaining": null,
      "revision": "02",
      "color": "black"
    }
  ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants