question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Binary sensor not properly shown

See original GitHub issue

I want to graph two different binary sensors, one for a door lock sensor, the other for my heating systeem

Now, using this code

type: 'custom:mini-graph-card'
entities:
  - entity: binary_sensor.carajito_active
    name: State
    color: red
name: Heating
hours_to_show: 24
points_per_hour: 4
aggregate_func: max
line_width: 2
smoothing: false
state_map:
  - value: 'off'
    label: Waiting
  - value: 'on'
    label: Heating

I’m just getting a flat line, even though as you can see the sensor assumes on/off values properly

immagine


For the door sensor is even weirder, as I’m getting an inverse graph:

type: 'custom:mini-graph-card'
entities:
  - entity: binary_sensor.tuya_door_sensor
name: Hold the door!
icon: 'mdi:door-closed'
hours_to_show: 24
points_per_hour: 4
update_interval: 30
aggregate_func: max
line_width: 2
smoothing: false
state_map:
  - value: 'on'
    label: Mooooar
  - value: 'off'
    label: Bravo Hodor!

immagine

immagine

So the values are exactly the opposite value.

Any hint?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
JoachimEngelmanncommented, Feb 1, 2021

I did it like this and works. The binary_sensor.isNight provides true and false, but if i use state_map with this, it won’t work. It seems “off” and “on” does the trick, but don’t ask me why

type: 'custom:mini-graph-card'
icon: 'mdi:thought-bubble'
name: Feinstaubbelastung
hours_to_show: 24
points_per_hour: 2
update_interval: 1
cache: false
hour24: true
entities:
  - entity: sensor.feinstaubsensor_pm25
    name: PM2.5
    color: orange
  - entity: sensor.feinstaubsensor_pm10
    name: PM10
  - entity: binary_sensor.isNight
    name: Nighttime
    color: grey
    show_line: false
    show_points: false
    show_legend: false
    y_axis: secondary
state_map:
  - value: 'off'
    label: Day
  - value: 'on'
    label: Night
show:
  labels_secondary: false
grafik
2reactions
luebbecommented, Dec 30, 2020

Thanks for the info. I reckoned there was a caching issue, because after a day or so there would be at least “wrong” results meaning the graph was inverted or something similar.

No, the issue didn’t resolve itself. My solution was to create a template value sensor in HA which translates the binary “on”/“off” or whatever to numeric 0/1 and use this numeric value instead on the secondary axis.

This gives me the desired result

grafik

The gray shadow in the background shows whether the the thermostat is in “eco” or “comfort” mode and the orange line shows the current temperature of the room.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Binary sensor not showing up - Home Assistant Community
I am tinkering with Home-Assistant for some month now. I upgraded from a raspi 3 to a virtual machine on proxmox now the...
Read more >
How to create a new binary sensor? : r/homeassistant - Reddit
Is there anything I am doing wrong that would cause the new binary sensor to show as "closed". r/homeassistant - How to create...
Read more >
Pedestrian counting with grid-based binary sensors ... - NCBI
Abstract. In this paper, we propose a method for estimating the number of pedestrians walking in opposite directions, as in cases of a...
Read more >
Konnected not updating status of HA binary_sensors
I have just installed Home Assistant v0.7.0 and it successfully discovers my Konnected and pulls through all the binary sensors and switches I've...
Read more >
Configuring binary sensors and template switches in Home ...
This video is a tutorial on how to configure binary sensors and template switches in Home Assistant Here are a couple of links...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found