mitchellrj / eufy_robovac

Other
105 stars 52 forks source link

expose sensor data #25

Open christoph-buente opened 3 years ago

christoph-buente commented 3 years ago

I would like to start the robovac based on several criteria for example the battery level. However it is not directly exposed by this integration. I was able to help myself using the template platform. Sharing it here cause others might find this useful.

- platform: template
  sensors:
    robovac_battery:
      unique_id: 1609538854030
      friendly_name_template: "{{ states.vacuum.robovac.name}} battery level"
      value_template: '{{ states.vacuum.robovac.attributes["battery_level"] | float }}'
      icon_template: 'hass:battery'
      unit_of_measurement: '%'
    robovac_fanspeed:
      unique_id: 1609538854040
      friendly_name_template: "{{ states.vacuum.robovac.name}} fan speed"
      value_template: '{{ states.vacuum.robovac.attributes["fan_speed"] | string }}'
      icon_template: 'hass:fan'
    robovac_status:
      unique_id: 1609538854050
      friendly_name_template: "{{ states.vacuum.robovac.name}} status"
      value_template: '{{ states.vacuum.robovac.attributes["status"] | string }}'
      icon_template: 'hass:robot-vacuum'

image

Is there a way to get those sensors directly exposed by the eufy_vacuum integration?

3ative commented 3 years ago

I use the battery level to change the fan speed, via a Node-Red - no template sensors needed. First I pull in all the data with a 'State' node: image

and feed that in to the Function node:

if (global.get('homeassistant').homeAssistant.states["vacuum.robovac"].attributes.battery_level < 50)
msg.payload =
{
    "service": "set_fan_speed",
    data:
    {"fan_speed": "Standard"}
};
else
msg.payload =
{
    "service": "set_fan_speed",
    data:
    {"fan_speed": "Max"}
};
return msg

Output goes to a 'Call Service' Node: image

I hope that helps and/or gives ppl ideas.