Visualisation / logging of mower state
Closed this issue · 7 comments
Describe the issue
I used to be able to visualise & log the state of my mower in a graph, because I logged a state attribute that was numerical, and I put a legend underneath. It was 1 when docked, 3 when mowing, 4 when returning, etc...
Now I upgraded Home Assistant and Landroid to latest versions (several things were not working anymore) and I noticed that the data structure of Landroid_cloud has changed quite a lot compared to a year ago. At that time I had to make custom sensors in my sensors.yaml because everything was coded as attributes, but this was no longer the case, so now I had to remove all of these and adapt my visualisations. But what I can't find back anymore, is how I can again visualise & log the state of the mower in a graph.
Is this still possible? If yes, how? (which entity or attribute, what is the legend)
KR,
Davy
What version of Home Assistant Core has the issue?
2024.05
What was the last working version of Home Assistant Core?
2023.04
What version of the Landroid Cloud integration do you have installed
5.0.2
What type of installation are you running?
Home Assistant Container
Which make and model is the mower used for this integration?
Word Landroid WR165E
Diagnostics information (NOT log entries!)
None
Relevant log entries
None
Additional information
No response
Can't see why not - attributes have just been moved to seperate entities
I don't find any entities for statuses "docking", "mowing", "returning to home", etc... But they are in the entity lawn_mower.XXX since they are displayed (with text) in the status of this entity. So my question is: (how) can I get numeric values in some way for the statuses, by reading out some attribute of the lawn_mower.XXX entity, which I can then convert to a sensor in the sensors.yaml file using template sensor.
Maybe it's more a feature request then a bug, but on the other hand it used to work like that in a previous version. I then got a graph that varied between 1 & 8 if I'm not mistaken, and based on the number active at a certain point in time, I could know what the mower was doing then (e.g. 3 days ago at 15:00).
The numeric status code is no longer shown, as it's shown in localized text
Ok, so I would have to program a sensor which converts the state in localized text to a number.
Am I correct that I have to look for the attribute "state" of the lawn mower entity, and that it can have these (and only these) values?
- "edgecut"
- "escaped_digital_fence"
- "initializing"
- "mowing"
- "offline"
- "rain_delay"
- "returning"
- "searching_zone"
- "starting"
- "zoning"
OK, so I would add the following to sensors.yaml:
- platform: template
sensors:
LandroidMower_state:
friendly_name: "Numeric value of lawn mower state"
value_template: >
{% if is_state('lawn_mower.landroid_davy', 'docked') %}
1
{% elif is_state('lawn_mower.landroid_davy', 'mowing') %}
2
### etc ... ###
{% else %}
99
{% endif %}
Question is: what are all the possible states? I've found this in your const.py, but they're not really mutually exclusive it seems (it can be lifted while battery is low for example) so it's not clear to me how they work...
STATE_BATTERY_LOW = "battery_low"
STATE_BATTERY_OPEN = "battery_trunk_open_timeout"
STATE_BATTERY_TEMPERATURE_ERROR = "battery_temperature_error"
STATE_BLADE_BLOCKED = "blade_motor_blocked"
STATE_CAMERA_ERROR = "camera_error"
STATE_CHARGING_ERROR = "charge_error"
STATE_CLOSE_DOOR_HOME = "close_door_to_go_home"
STATE_CLOSE_DOOR_MOW = "close_door_to_mow"
STATE_DOCKING_ERROR = "charging_station_docking_error"
STATE_EDGECUT = "edgecut"
STATE_ESCAPED_DIGITAL_FENCE = "escaped_digital_fence"
STATE_EXESSIVE_SLOPE = "excessive_slope"
STATE_HEADLIGHT_ERROR = "headlight_error"
STATE_HEIGHT_BLOCKED = "blade_height_adjustment_blocked"
STATE_HBI_ERROR = "hbi_error"
STATE_INITIALIZING = "initializing"
STATE_INSUFFICIENT_SENSOR_DATA = "insufficient_sensor_data"
STATE_LIFTED = "lifted"
STATE_MAP_ERROR = "map_error"
STATE_MAPPING_FAILED = "mapping_exploration_failed"
STATE_MAPPING_REQUIRED = "mapping_exploration_required"
STATE_MISSING_DOCK = "missing_charging_station"
STATE_NO_ERROR = "no_error"
STATE_OFFLINE = "offline"
STATE_OTA_ERROR = "ota_error"
STATE_OUTSIDE_WIRE = "outside_wire"
STATE_RAINDELAY = "rain_delay"
STATE_RETURNING = "returning"
STATE_REVERSE_WIRE = "reverse_wire"
STATE_RFID_ERROR = "rfid_reader_error"
STATE_SEARCHING_ZONE = "searching_zone"
STATE_STARTING = "starting"
STATE_TIMEOUT_HOME = "timeout_finding_home"
STATE_TRAINING_START_DISALLOWED = "training_start_disallowed"
STATE_TRAPPED = "trapped"
STATE_TRAPPED_TIMEOUT = "trapped_timeout"
STATE_UNREACHABLE_DOCK = "unreachable_charging_station"
STATE_UNREACHABLE_ZONE = "unreachable_zone"
STATE_UPSIDE_DOWN = "upside_down"
STATE_ZONING = "zoning"
STATE_WHEEL_BLOCKED = "wheel_motor_blocked"
STATE_WIRE_MISSING = "wire_missing"
STATE_WIRE_SYNC = "wire_sync"
Any possibility for some guidance on how I could do this? As you might notice I'm not very used to coding in Home Assistant...
Possible states are seen here:
landroid_cloud/custom_components/landroid_cloud/translations/en.json
Lines 27 to 36 in add4ec1
I thought so at first, but the current state of the mower says "docked" in Home Assistant, and docked is not in that list...