OpenEPaperLink / Home_Assistant_Integration

Home assistant Integration for the OpenEPaperLink project
Apache License 2.0
137 stars 32 forks source link

Implement arrows (in addition to lines) in drawcustom #40

Closed psfales closed 7 months ago

psfales commented 10 months ago

It would be useful for me to be able to draw arrows on the screen. (Specifically, I would like to be able to show the wind direction graphically)

One way to do this would be to add some extra values to the "line" operator to put arrow heads at the beginning of the line, the end of the line, or both.

svenove commented 9 months ago

Arrows can be drawn with an "icon". I draw wind direction arrows using this method:

jonasniesner commented 9 months ago

@psfales does this fix work for you?

psfales commented 9 months ago

Thanks for the suggestion to use the icons. That technique is working quite nicely for me.

However, I'm curious what values are returned by the state_attr('sensor.weatherman_data_tag','wm_wind_dir_4'). I found it necessary to add 22.5 degrees to my sensor value so (for example) the left-arrow (east direction) will be active from 67.5 to 112.5 degrees instead of 90 to 135 degrees

svenove commented 9 months ago

It contains the wind bearings, 0-359. I found the code elsewhere, but it seems to show the correct arrows for me. I haven’t done any thorough testing though.

67.5/45 rounds to 2. 112.49/45 rounds to 2. So they both should return “arrow-left”, without adding 22.5…?

Also found out today that the array must contain an additional “arrow-down” at the end, to handle the last “sector” from 315.1 degrees and up.

psfales commented 9 months ago

Maybe I'm the one that needs to do some more testing! When I was doing my test calculations on paper, I was (for some reason) thinking of integer division where 89/45 would be 1 and 90/45 would be 2. But I think you are correct. Thanks!

svenove commented 9 months ago

Yeah, important to use “round” and not “int”. :)

jonasniesner commented 7 months ago

Im closing this because this should be covered by #62