GithubHelp home page GithubHelp logo

Comments (5)

Mariusthvdb avatar Mariusthvdb commented on June 20, 2024

see https://diyfuturism.com/index.php/2017/12/15/useful-sensor-motion-last-seen-________/

variable:
  last_motion:
    value: 'Not set'
    restore: true
    attributes:
      icon: mdi:map-marker
      name: 'Last Motion'

and

automation:
# Update Last Motion variable
  - alias: "Update Last Motion"
    id: 'Update Last Motion'
    initial_state: 'on'
    trigger:
      platform: state
      entity_id:
        - sensor.corridor_motion_sensor
        - sensor.auditorium_motion_sensor
        - sensor.dining_table_motion_sensor
        - sensor.master_bedroom_motion_sensor
        - sensor.dorm_motion_sensor
        - sensor.frontdoor_motion_sensor
        - sensor.control_room_motion_sensor
      to: 'on'
    action:
      service: variable.set_variable
      data:
        variable: last_motion
        attributes_template: >
          {
                "history_1": "{{ variable.state }}",
                "history_2": "{{ variable.attributes.history_1 }}",
                "history_3": "{{ variable.attributes.history_2 }}",
                "history_4": "{{ variable.attributes.history_3 }}",
                "history_5": "{{ variable.attributes.history_4 }}"
          }
      data_template:
        value: "{{ trigger.to_state.attributes.friendly_name }}"

schermafbeelding 2018-05-24 om 14 03 15

from hue-sensors-hass.

robmarkcole avatar robmarkcole commented on June 20, 2024

last_updated doesn't always == last motion? If not then last_motion could be added as an attribute

from hue-sensors-hass.

raoulteeuwen avatar raoulteeuwen commented on June 20, 2024

@schneekluth is what @hvbhome shows what you intended, are you asking for a variable for every motion sensor holding the last date and time motion was detected for that motion sensor or something else :-)?

from hue-sensors-hass.

schneekluth avatar schneekluth commented on June 20, 2024

Yes, it was exactly what I was looking for. It's already set up an running. Thanks for the advice. I didn't know hassvariables.

from hue-sensors-hass.

Mariusthvdb avatar Mariusthvdb commented on June 20, 2024

cool.
of course you can add the show_last_changed: true for the sensors, customize some more, and have it show like this:

schermafbeelding 2018-05-25 om 23 35 30

    sensor.frontdoor_motion_sensor:
      show_last_changed: true
      templates:
        icon_color: >
          if (state === 'on') return 'rgb(192, 39, 30)';
          return 'rgb(54, 95, 140)';
        icon: >
          if (state === 'on') return 'mdi:run-fast';
          return 'mdi:security-home';
        _stateDisplay: >
          if (state === 'on') return 'Alert';
          return 'Clear';
      group:
        group.philips_motion_sensors:
          friendly_name: Frontdoor

from hue-sensors-hass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.