Comments (22)
I will try to find a way to attach a font file
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Using TTF stored in a config is much better, as it doesn't require manual changes after every HA update. I will check if it is possible
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
It's impossible using default font, but when you use a font that supports latin characters everything works:
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Thanks, just need to know all of my font available. I am using HA in docker.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Here you have a command that should retrieve all available fonts:
https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor#texts-configuration
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
On RPi I have another error:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update
await self.hass.async_add_executor_job(self.update) # type: ignore
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/xiaomi_cloud_map_extractor/camera.py", line 185, in update
self._map_data = self._connector.get_map(map_name, self._colors, self._drawables, self._texts, self._sizes,
File "/config/custom_components/xiaomi_cloud_map_extractor/xiaomi_cloud_connector.py", line 105, in get_map
map_data = MapDataParser.parse(unzipped, colors, drawables, texts, sizes, image_config)
File "/config/custom_components/xiaomi_cloud_map_extractor/map_data_parser.py", line 76, in parse
MapDataParser.draw_elements(colors, drawables, texts, sizes, map_data)
File "/config/custom_components/xiaomi_cloud_map_extractor/map_data_parser.py", line 237, in draw_elements
ImageHandler.draw_texts(map_data.image, texts)
File "/config/custom_components/xiaomi_cloud_map_extractor/image_handler.py", line 170, in draw_texts
ImageHandler.__draw_text__(image, text_config[CONF_TEXT], x, y, text_config[CONF_COLOR],
File "/config/custom_components/xiaomi_cloud_map_extractor/image_handler.py", line 205, in __draw_text__
font = ImageFont.truetype(font_file, font_size)
File "/usr/local/lib/python3.8/site-packages/PIL/ImageFont.py", line 655, in truetype
return freetype(font)
File "/usr/local/lib/python3.8/site-packages/PIL/ImageFont.py", line 652, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/usr/local/lib/python3.8/site-packages/PIL/ImageFont.py", line 169, in __init__
if core.HAVE_RAQM:
File "/usr/local/lib/python3.8/site-packages/PIL/ImageFont.py", line 43, in __getattr__
raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Can you check which version of pillow
/PIL
you have?
pip3 list
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
I am trying to figure out how deps are installed for HA in docker... Which python is used and where to run the command.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Pillow 7.2.0
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
I am trying to run the next:
apk add --no-cache g++ freetype-dev jpeg-dev
pip uninstall pillow
pip install --no-cache-dir pillow
to make sure pillow will be compiled with libfreetype. I am not sure if this will be a persistent solution for HA in docker.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
It looks like no fonts preinstalled in homeassistant docker image
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Solution for me was to jump inside HA container and run the next commands:
apk add --no-cache g++ freetype-dev jpeg-dev
pip uninstall pillow
pip install --no-cache-dir pillow
apk add font-noto
and use NotoSansDisplay-Light.ttf font.
BTW it will be nice to choose TTF file stored somewhere in the config folder.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
But there is still an issue with Pillow installed(compiled during installation) without libfreetype. I don't know if there is any solution for that. That how homeassistant processing requirements, looks like no options to control that. So I still have to run the command after every update of HA.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
I've hit the same problem, unfortunately my understanding is too limited to follow the instructions above.
I'm left with "ImportError: The _imagingft C module is not installed"
My home assistant is also installed within docker.
Thanks for the great work, really looking forward to being able to utilise this! :-)
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
After HA was updated to 0.116.2 I cannot fix the issue with the above commands. Every time I see The _imagingft C module is not installed error.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
After HA was updated to 0.116.2 I cannot fix the issue with the above commands. Every time I see The _imagingft C module is not installed error.
I have the same error. So there is currently no solution to fix the Problem?
RPI4
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Unfortunately I haven't found a solution yet
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
I have added handling to errors thrown during fonts loading.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
I use HA on Docker with my NAS Synology. No fonts TTF on Synology...
it's Ok wihout font: "FreeSans.ttf" but i can't change the font_size...
texts:
- text: "Room 1"
x: 25
y: 25
color: [125, 20, 213]
font_size: 100
- text: "Room 2"
x: 25
y: 75
color: [125, 20, 213, 127]
font_size: 10
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
@Nicols07 unfortunately it's not possible to change size for a default font
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Hi! I came over this issue when troubleshooting a similar issue with one of my own integrations. Not sure if it helps for this case, but I found a workaround by using bitmap fonts and then converting to PIL-fonts. Quite cumbersome solution, but it works better in my case. More info here if you're interested.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.
Related Issues (20)
- Warning after upgrading to Core 2024.1.0 HOT 1
- Doesn't show map in HA, but shows it in Xiaomi app HOT 9
- SUPPORT_ON_OFF is deprecated HOT 4
- Rotate by Map ID HOT 1
- The map is not displayed
- Add two cameras on configuration.yaml HOT 1
- Support for xiaomi.vacuum.c103
- Time out error HOT 6
- Missing Python module after HASS update HOT 2
- Xiaomi Vacuum s10 (ijai.vacuum.v17) HOT 1
- Error: Failed to retreive map from vacuum. Was working flawlesly, stopped working without any updates HOT 7
- Deprecated supported features values HOT 2
- problem ViomiV3 (ViomiV13) HOT 2
- Xiaomi Rovot vaccum and mop 2 HOT 1
- Request new Vacuum Mijia Robot Vacuum M30 Pro HOT 1
- Failed to retrieve device HOT 3
- Record details (WARNING) HOT 1
- Entity camera.xiaomi_cloud_map_extractor (<class 'custom_components.xiaomi_cloud_map_extractor.camera.VacuumCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1 HOT 1
- Found an unsupported model 'roborock.vacuum.a38' for class 'RoborockVacuum'
- Request for Xiaomi Vacuum B106 BK / Xiaomi Robot Vacum T12 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from home-assistant-custom-components-xiaomi-cloud-map-extractor.