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

Great card but state_map not working for my binary sensors #716

Open
garyo opened this issue Apr 5, 2024 · 3 comments
Open

Great card but state_map not working for my binary sensors #716

garyo opened this issue Apr 5, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@garyo
Copy link

garyo commented Apr 5, 2024

Describe the bug

When I add my binary sensors (for instance binary_sensor.front_door_keypad_battery), the state_map config does not map the on/off values to 100/0% as desired.

How to reproduce
See config below. Note that these sensors are reported as "?" rather than 100/0. See the screenshot.

I tried various "from" states: plain off/on, 0/1, "off"/"on", "Off"/"On"... nothing triggers. From the debug state it looks like "off" should work.

Expected behavior
Batteries should show up as 100% or 0% according to off/on state of sensor.

YAML configuration

type: custom:battery-state-card
secondary_info: "{last_changed}"
filter:
  include:
    - name: "attributes.device_class"
      value: "battery"
state_map:
  - from:"off"
    to:100
  - from:"on"
    to:0
sort:
  by: "state"
collapse: 8
debug: false
bulk_rename:
  - from: " Battery"
  - from: " level"
colors:
  steps:
    - '#ff0000'
    - '#ffff00'
    - '#00ff00'
  gradient: true

Entity debug data

{
  "entity_id": "binary_sensor.front_door_keypad_battery",
  "state": "off",
  "attributes": {
    "last_event_info": "System Armed (Home) by Keypad Front Door",
    "last_event_sensor_name": "Front Door",
    "last_event_sensor_type": "keypad",
    "last_event_timestamp": 1712286222,
    "system_id": 4882848,
    "device_class": "battery",
    "friendly_name": "Front door Keypad Battery"
  },
  "context": {
    "id": "01HTQ88GVEPDKSMCT2EQCA6W",
    "parent_id": null,
    "user_id": null
  },
  "last_changed": "2024-04-05T13:48:07.406Z",
  "last_updated": "2024-04-05T13:48:07.406Z",
  "display": {
    "entity_id": "binary_sensor.front_door_keypad_battery",
    "device_id": "f127976adf9908bbf0c09dbfdde1",
    "labels": [],
    "platform": "simplisafe",
    "entity_category": "diagnostic",
    "name": "Battery"
  },
  "device": {
    "area_id": "front_door",
    "configuration_url": "https://webapp.simplisafe.com/new/#/dashboard",
    "config_entries": [
      "d914ea1cffb145d19f4ea9147eff"
    ],
    "connections": [],
    "disabled_by": null,
    "entry_type": null,
    "hw_version": null,
    "id": "f127976adf9908bbf0c09dbfdde1",
    "identifiers": [
      [
        "simplisafe",
        "017fdxxx"
      ]
    ],
    "labels": [],
    "manufacturer": "SimpliSafe",
    "model": "Keypad",
    "name_by_user": null,
    "name": "Front door Keypad",
    "serial_number": null,
    "sw_version": null,
    "via_device_id": "1fbe8255b22b13d2511792a7f5eb"
  },
  "area": {
    "aliases": [],
    "area_id": "front_door",
    "floor_id": "main_floor",
    "icon": null,
    "labels": [],
    "name": "Front Door",
    "picture": null
  }
}

Dev console errors
None

Screenshots
image

Version
Latest, 3.2.1

@garyo garyo added the bug Something isn't working label Apr 5, 2024
@maxwroc
Copy link
Owner

maxwroc commented Apr 9, 2024

Hi Gary, can you please check if adding default_state_formatting: false to your config (at the root level) fixes anything and let me know?

@garyo
Copy link
Author

garyo commented Apr 9, 2024

Sorry, doesn't seem to change anything:
image

@Scriptman
Copy link

Having the exact same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants