fineemb / lovelace-cn-map-card Goto Github PK
View Code? Open in Web Editor NEW复刻官方Lovelace地图卡片,基于高德地图
License: MIT License
复刻官方Lovelace地图卡片,基于高德地图
License: MIT License
首先感谢作者的付出,这几天试了一下感觉很实用。
只是高德地图功能升级后(仅限最近注册的KEY)无法显示标注点和行程了。对1.2.7版摸索了一番后,将第268-270行修改成:
if (result.info === 'ok') { that._showMarker(result.locations[0],entity,color,type); } else { console.info("%c 地图加载异常:%o", "color: white; font-weight: bold; background: dimgray",result); }
后得到高德地图返回“NVALID_USER_SCODE” 异常信息,通过查看高德API的“JSAPI key和安全密钥的使用”说明,我使用了第二个方法,在第4行追加下列代码后可以正常使用:
window._AMapSecurityConfig = { securityJsCode:'您申请的安全密钥', }
高德地图更新后需要安全密钥配合key一起使用,参考其他人的建议,在js文件中加入如下语句
window._AMapSecurityConfig = { securityJsCode:'您申请的安全密钥', }
但并没有效果。希望作者能够更新下程序,或者解答下安全密钥的使用方法。
另外吧高德官方使用说明附下供作者参考:
JSAPI key搭配静态安全密钥以明文设置(不安全,建议开发环境用):
引入地图 JSAPI 脚本之前增加设置 JSAPI 安全密钥的脚本标签,并将您的安全密钥「您申请的安全密钥」替换为您的安全密钥;(注意这个设置必须是在 JSAPI 的脚本加载之前进行设置,否则设置无效。)
`<script type="text/javascript">
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=您申请的key值"></script> `
window._AMapSecurityConfig = {
securityJsCode:'您申请的安全密钥',
}
</script>
HACS 添加后找不到卡片,直接添加配置代码显示:Custom element doesn't exist: gaode-map-card.
缓存什么的都清过也不行
手动配置的配了一遍到最后也是跟hacs的一样
希望楼主能看一下
树莓派4B Docker安装hassio版本2020.12.1:(
- type: 'custom:gaode-map-card' default_zoom: '9' dark_mode: false hours_to_show: '168' entities: - zone.home key: XXXXXXXXXXXX title: Map
鼠标移动到home图标有如下错误提示
maps?callback=___onAPILoaded&v=2.0&key=XXXXXXXXXXXX&plugin=AMap.MoveAnimation:1 Uncaught Error: Invalid Object: LngLat(NaN, NaN)
at new bM (maps?callback=___onAPILoaded&v=2.0&key=XXXXXXXXXXXX&plugin=AMap.MoveAnimation:1)
at ns.si (maps?callback=___onAPILoaded&v=2.0&key=XXXXXXXXXXXX&plugin=AMap.MoveAnimation:1)
at ns.fireEvent (maps?callback=___onAPILoaded&v=2.0&key=XXXXXXXXXXXX&plugin=AMap.MoveAnimation:1)
at ns.OL (maps?callback=___onAPILoaded&v=2.0&key=XXXXXXXXXXXX&plugin=AMap.MoveAnimation:1)
HA 0.115.2
lovelace-cn-map-card 1.2.4
win7+chrome和iphone 6s safari下现象一致
使用鼠标或双指捏合缩小地图,松开后地图立即刷新至设备当前位置(放大)
这样不好看历史轨迹,不知道是我个例还是插件问题?
PS:从1.0版本一路折腾过来,终于能正常看到地图和轨迹了!!!
HA 0.115.2
lovelace-cn-map-card 1.2.4
ios app 2020.6.2(1)
iphone 6s ios13.5 越狱环境
有路径,只是不加载地图
不知道怎么输出调试信息...
同iphone Safari浏览器登录可以用
PC win7+chrome也正常
hass core latest @ dev environment
加载1.27 js module后,尝试前台添加lovelace cn map card无法成功,并且无法添加其他内部卡片,后台报错:
2021-04-27 11:34:24 ERROR (MainThread) [frontend.js.latest.202104230] :0:0 Script error.
抽时间看看能否修复?本人水平还不够。
现在打开直接显示的是所在城市的中心,能否自定义?
可以显示地图,但是无法显示人员和设备的位置。
2021-07-21 15:22:21 ERROR (MainThread) [frontend.js.latest.202107070] :0:0 Script error.
2021-07-21 15:22:23 ERROR (MainThread) [frontend.js.latest.202107070] http://xxx.xxx.cn:8123/hacsfiles/lovelace-cn-map-card/cn-map-card.js?hacstag=259784620127:74:18 Uncaught TypeError: Cannot read property 'setPitch' of undefined
2021-07-21 15:22:44 ERROR (MainThread) [frontend.js.latest.202107070] http://xxx.xxx.cn:8123/hacsfiles/lovelace-cn-map-card/cn-map-card.js?hacstag=259784620127:74:18 Uncaught TypeError: Cannot read property 'setPitch' of undefined
2021-07-21 15:22:44 ERROR (MainThread) [frontend.js.latest.202107070] http://xxx.xxx.cn:8123/hacsfiles/lovelace-cn-map-card/cn-map-card.js?hacstag=259784620127:70:18 Uncaught TypeError: Cannot read property 'setPitch' of undefined
2021-07-21 15:24:05 ERROR (MainThread) [frontend.js.latest.202107070] http://xxx.xxx.cn:8123/hacsfiles/lovelace-cn-map-card/cn-map-card.js?hacstag=259784620127:74:18 Uncaught TypeError: Cannot read property 'setPitch' of undefined
2021-07-21 15:24:05 ERROR (MainThread) [frontend.js.latest.202107070] http://xxx.xxx.cn:8123/hacsfiles/lovelace-cn-map-card/cn-map-card.js?hacstag=259784620127:70:18 Uncaught TypeError: Cannot read property 'setPitch' of undefined
2021-07-21 15:26:18 ERROR (MainThread) [frontend.js.latest.202107070] :0:0 Script error.
2021-07-21 15:27:00 ERROR (MainThread) [frontend.js.latest.202107070] :0:0 Script error.
2021-07-21 15:29:41 ERROR (MainThread) [frontend.js.latest.202107070] :0:0 Script error.
errmsg:Cannot read properties of undefined (reading 'primary-background-color')
高德地图12月2号进行了升级
自2021年12月02日升级,升级之后所申请的 key 必须配备安全密钥 jscode 一起使用。
注意:此次升级不会影响之前已获得key的使用;升级之后的新增的key必须要配备安全密钥一起使用。
另外,无法示手机的位置怎么解决,device_tracker的状态一直是unknown
HassOS里面用
实体的图标在地图上没有显示,但鼠标移动到实体位置时会有鼠标状态的变化;
另外地图的中心位置能否设置?点开地图时,地图的中心并非设置的实体,能够设置以某一个实体为打开地图的中心位置
Logger: frontend.js.latest.202010012
Source: components/system_log/init.py:193
First occurred: 下午1:22:51 (2 occurrences)
Last logged: 下午1:22:53
:0:0 Script error.
http://192.168.1.100:8123/hacsfiles/lovelace-cn-map-card/cn-map-card.js:76:18 Uncaught TypeError: Cannot read property 'setPitch' of undefined
系统版本0.109.3,更新到V1.1,还是无法显示地图。
高德Key两种类型都试过。
PS:请问您这卡片应该用高德哪种Key,“Web服务”还是“Web端”?
地图上不显示实体位置而且每次都定位到国外同一位置,不知为何。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.