dudanov / hassio-ftms

Home Assistant custom component for Bluetooth Fitness Equipment (FTMS).
Apache License 2.0
9 stars 0 forks source link

Multiple profiles for different users? #8

Closed quack3d closed 2 months ago

quack3d commented 2 months ago

The wife wants to use the treadmill and the treadmill itself doesn't support profiles. Do you have any suggestions on how to log different users? In some way that I can have separate statistics sensors like in #5 . Maybe it would be possible with a template switch that if set to wife, statistics will be on one sensor and if set to me statistics will be on another sensor? Other ideas?

quack3d commented 2 months ago

I went with the idea I had. I created an input_select with our names and then:

template:
  - sensor:
      - name: "Treadmill Daily Steps Me"
        unique_id: treadmill_daily_steps_me
        value_template: >
          {% if is_state('input_select.treadmill_user', 'Me') %}
            {{ states('sensor.treadmill_step_count') }}
          {% else %}
            0
          {% endif %}

And similar for the wife. Then:

- platform: statistics
  name: Treadmill Daily Steps Me
  entity_id: sensor.treadmill_daily_steps_me
  state_characteristic: sum_differences_nonnegative
  max_age:
    hours: 24

And similar for the wife.

I guess that should work but I'm unable to test it at the moment. It would probably work better if I can figure out a way to make HA know it's me or the wife using the treadmill automatically - instead of selecting names manually. I have to think on that.

Feel free to close this issue unless you have a better idea than the above. 😊

dudanov commented 2 months ago

I created a feature request for this issue. You can vote for it.

In the meantime, yes, you can solve this problem, for example, as you suggested above.