所以我用 Python 构建了一个自定义的池控制系统。然后我使用 Flask-ask 将它与我的 Echo Dots 和 Show 集成。在 Echo Show 中,我使用的是 simple_card 格式,它会在屏幕上显示我的所有信息时读取它:
@ask.intent("GetAllStats")
def get_pool_stats():
pool_current_ph = read_database("pool_chemicals", "pool_current_ph")
pool_current_orp = read_database("pool_chemicals", "pool_current_orp")
pool_current_temp = int(float(read_database("system_status", "pool_current_temp")))
pool_level_percentage = read_database("pool_level", "pool_level_percentage")
pic = 'https://richard.mydomian.net/pool_control.jpg'
msg = render_template('our_stats', temperature=pool_current_temp,
ph=pool_current_ph,
orp=pool_current_orp,
level=pool_level_percentage)
return statement(msg).simple_card(title='Pool Control', content='Pool Temperature: {0}\n Pool PH: {1}\n Pool ORP: {2}\n Water Level: {3}% .format(pool_current_temp,pool_current_ph,pool_current_orp,pool_level_percentage))
这是我的 templates.yaml 中的 our_stats:
our_stats: |
<speak>
The pool temperature is currently {{temperature}} degrees. The P H of our pool water is currently {{ph}}, while our oxygen reduction potential
is right at {{orp}}. The level of our water is at {{level}} percent.
</speak>
这很好用,但我没有任何字体控件(我可以找到)并且背景总是灰色的。
所以我开始使用该display_render
方法进行研究,我能够让它为我的游泳池提供一张非常漂亮的背景图片,并且仍然读取我的统计信息,但现在我无法让它以打印形式显示信息。
我将return statement
上面的内容更改为:
return statement(msg).display_render(template='BodyTemplate3', title='Pool Control', background_image_url=pic)
Again, this works great and reads back my information, but it I try to pass any content to it via textContent
, primaryText
, content
, or text
it always fails. I have also tried various templates including BodyTemplate
's and listTemplate
's. All to no avail. Anytime I try to add content to the screen the skill fails. I remove the content and I get a fantastic picture and it will speak to me all of the information, but that is as far as I can get.
One of the main problems is that I just have not been able to find any pertinent kind of examples using Flask-Ask and the Echo Show with anything but the simple_card.
I am hoping someone has figured this out and can point me in the right direction.