© Screek Workshop

RedditFacebookXYouTube
Screek Workshop
/
🦋
Human Sensor 2A(LD2450)
/
🪶
Add a dynamic map card to 2A
Add a dynamic map card to 2A
🪶

Add a dynamic map card to 2A

  • Background
  • How-To
  • Step 1: Install the Plotly Graph Card plugin
  • Video demonstration
  • Step 2: Add Map Card!
  • Video Demonstration
  • FAQ
  • How do I know if the Plotly Graph Card plugin is installed successfully?
  • Identify in custom cards
  • Identifying in HACS
  • How do I update my card code for the new version?
  • How do I uninstall if I no longer want to use the map feature?
  • I changed the device name for 2A and now the device ID method doesn't work for me, can I still use the card code?
  • Update
  • Known issues
  • In the process of adding code, errors such as Key 'entities.0.marker' is not expected or not supported by the visual editor. appear.
  • Fixed
  • Acknowledgements

Background

2A has the ability to locate personnel coordinates, which is a great feature that allows us to know the exact position of the target at a given time. It would be nice if we could display this coordinate system directly in HA.

Fortunately, in the HA community, athua has implemented a very intuitive map effect using a plugin. Its effect is as follows:

How-To

We have simplified this process as much as possible by creating an online tool for generating the code. This allows you to quickly integrate this map into your HA. Additionally, we have prepared a tutorial to guide you in achieving the same effect as our simple implementation.

😋
Don't panic! In fact, the whole process can be completed within 30 seconds. ✅

Step 1: Install the Plotly Graph Card plugin

We assume that you have already installed the HACS store on HA. Our goal is to search for the Plotly Graph Card plugin within HACS and then proceed with the installation.

Plugin name: Plotly Graph Card

Video demonstration

Step 1

Step 2: Add Map Card!

We're very close to achieving the final map effect! Now you need to find the unique ID of your 2A sensor in ESPHome device, generate the map code, and add it to the homepage.

Here's the process:

  1. Find your 2A name in the ESPHome device.
  2. find you 2a id, and copy it.
    find you 2a id, and copy it.
  3. Use code tool to generate the map code.
  4. 💡
    To make things easier, we've embedded the tool directly here, so you can use it without having to jump to the website.
    Code Generation Tools
    💡
    If you have trouble using the on-page tools, you can use the standalone page version: https://tool.screek.io/2amap/
    paster your 2a code to online map code tool(https://tool.screek.io/2amap), click copy code.
  5. Add a manual Lovelace card on the Home Assistant homepage using the generated code.
  6. add a manual card
    add a manual card
    delete default code, paster new code.
    delete default code, paster new code.
    you should see the preview on the right
    you should see the preview on the right
  7. Save and finish editing! ALL Done!
  8. save the card
    save the card
    done edit lovelace, enjoy it.
    done edit lovelace, enjoy it.

Video Demonstration

Step 2

FAQ

How do I know if the Plotly Graph Card plugin is installed successfully?

Identify in custom cards

If Custom element doesn't exist: plotly-graph. appears in your custom cards, it means that the plugin is not working, and you need to reinstall the plugin.

image

Identifying in HACS

💡
HACS plugins embody the spirit of open-source and HACK, making it sometimes a bit difficult to identify whether the required plugins have been installed.

Search for Plotly Graph Card in HACS. If there's a small icon that looks like a downward arrow, it indicates that it has been installed. Otherwise, you may need to consider reinstalling.

Installed icon markers, note the small blue arrow symbols.
Installed icon markers, note the small blue arrow symbols.
Not installed state, no markings on it.
Not installed state, no markings on it.

How do I update my card code for the new version?

You actually just need to edit the original card and replace all the code inside.

image

How do I uninstall if I no longer want to use the map feature?

The process is actually very simple:

  1. Delete the card on the home page
  2. image
  3. In HACS, uninstall the corresponding plugin Plotly Graph Card
  4. image

This completes the entire uninstallation and deletion process.

I changed the device name for 2A and now the device ID method doesn't work for me, can I still use the card code?

We understand that some people would like to use their own names for 2A, and for such cases we have made a specialized code generator for custom named 2A:

2A map card code generator (custom name version)

tool.screek.io

It is used as follows:

  • Copy the Entity ID of the entire customized All Target Counts into the generator.
image
  • The rest of the process is the same as 🪶Add a dynamic map card to 2A - How-To.

This is a video demonstration:

Update

‣
2024-06-26
‣
2024-01-26
‣
2024-01-15
‣
2014-01-14
‣
2014-01-12

Known issues

In the process of adding code, errors such as Key 'entities.0.marker' is not expected or not supported by the visual editor. appear.

This problem was initially reported by Touchit88
image

Since the Map uses a lot of custom code, this is predictable behavior. They represent the inability to use visual editing (i.e., normal dialogs that can input simple properties), don't worry, just save it, this does not affect, because we only need to use the code mode.

This is expected behavior and will not affect the final display.
This is expected behavior and will not affect the final display.
In this demo, you can see that the normal display is not a problem.

Fixed

Known issue with 2A Map code: inch units can't move on the map[Fixed]

Acknowledgements

All the core work here is from athua's sharing in our LD2450 exploration thread, as well as discussions from other members of the community.