标签:#<标签:0x00007FC411D96110>

大家好!

我想知道是否有人可以帮助我为我的八pon骨服务器创建REST开关以连接到打印机。我在这里找到了文档:www.19463331.comhttp://docs.octoprint.org/en/master/api/connection.html

无法正常工作,这是我的配置:

- 平台:休息名称:“ Conectar八跨to”资源:'http://192.168.1.69/api/connection'body_on:'{“ command”:“ connect”}'}'BODY_OFF:'BODY_OFF:'{“ command”'}:“ disconnect”}'is_on_template: "{% if is_state('sensor.octoprint_current_state', 'unknown') %}off{% else %}on{% endif %}" headers: Content-Type: application/json X-Api-Key: !secret octoprint_api

我在日志上遇到此错误:

没有资源/端点的路线:http://192.168.1.69/api/connection

我只希望HA向我的Octoprint服务器发布连接或断开命令。

非常感谢!

3个喜欢

你取得了进步吗?基于错误消息,看起来像机器运行HA根本无法使用该地址与服务器通信。您是否尝试使用该计算机中使用命令行 /终端并使用卷曲发送邮政命令?

1喜欢

你好@pnbruckner呢谢谢你的时间。

不,我没有取得任何进展。

这很奇怪,因为我配置和运行了八跨分量:

我可以通过SSH访问服务器,效果很好。

我将不得不花一些时间学习卷曲,在这里初学者:liticle_smile:“></p>
      <p>www.19463331.com文档非常清晰,简单,我真的很艰难,我可以在没有太多知识的情况下做到这一点……</p>
      <p>非常感谢你的帮助!</p>
     </div>
     <meta itemprop=

我认为这是您可能想尝试的卷曲命令:

curl -v http://192.168.1.69/api/connection -d'{“命令”:“ connect”}'}'} -h content -type:application/json'-h'-h'x -api -key:!secret octoprint_api'

-v用于详细输出,该输出应该告诉您有关较低级别连接过程的一些详细信息。显然调整了真实细节(例如键等)

1喜欢

惊人!将尝试使用这些设置使用命令行开关,我会让您知道结果。再次感谢!

如果可以的话,您可能想从命令行(在HA之外,但在HA正在运行的同一台计算机上)尝试它。假设您确实在HA中尝试了它,那么您可能想将-v选项更改为-s。

太谢谢了!

此配置不起作用,我会发现和错误检查:

- 平台:command_line switches:conectar_octoprint:friendly_name:“ conectar octoprint” command_on:'curl -v http://192.168.1.69/api/connection/connection -d'{“:application/json' -h'x -api -key:2bf5f70fdb884f528464f137a2654444fd'command_off:'curl -v http://v http://192.168.1.1.69/api/connection/connection/connection-connection-connection -d of-Type:application/json'-h x-api-key:2bf5f70fdb884f528464f137a2654444fd'value_template:“ {%is_state(if_state)('sensor.octoprint_current_current_current_state'“

我认为您的引用错误。尝试:

-  platform:command_line交换机:conectar_octoprint:friendly_name:“ conectar octoprint” command_on:“ curl -s http://192.168.1.69/api/api/connection -d''content -type:application/json'-h x -api -key:2bf5f70fdb884f528464f528464f137a2654444fd'“ command_off:” curl -s http:///192.168.1.1.69/api/api/api/api/papi/api/api/papi/api/connection/papi/connection-connection/dection -d'disconnect \“}'-h'content-type:application/json'-h x-api-key:2bf5f70fdb884f528464f528464f137a2654444fd'value_template:{not Is_state eS_STATE(nos_state)

我还认为此更简单的值_template将起作用。

1喜欢

再次感谢!只是等待打印完成。我将分享我的结果。谢谢!

朋友你好!

这些命令像魅力一样工作,感谢您的时间!这是最终代码:

-  platform:command_line交换机:conectar_octoprint:friendly_name:“ conectar octoprint” command_on:“ curl -s http://192.168.1.69/api/api/connection -d''content -type:application/json'-h'x -pi -key:2bf5f30fdb884f528964f137a56544444fd'“ command_off:” curl -s http://192.168.1.1.69/api/api/api/api/connection/api/connection-connection-connection-connection-connection-connection -d'disconnect\"}' -H 'Content-Type: application/json' -H 'X-Api-Key: 2BF5F30FDB884F528964F137A56544FD'" value_template: "{% if is_state('sensor.octoprint_current_state', 'unknown') %}false{%else%} true {%endif%}”

现在唯一的问题是value_template不为我工作。我不得不将其更改为此,因为还有更多状态(操作和印刷)。在HA工具上测试了模板和工作效果很好,但是在手动断开连接到Octoprint Server时,UI中没有显示更新……如果连接了服务器,则开关打开了,但是当服务器断开连接时什么也不会发生。

也许我必须为命令创建几个脚本,并使用此模板进行模板开关。

再次感谢你的帮助!

我怀疑这是因为您没有指定command_state配置变量。没有这些,我认为不使用value_template。

我以为你可能必须这样做。或者,也许您可​​以找到一种使用命令行传感器的命令_STATE&value_template变量来使其工作的方法。

1喜欢

再一次问好!

因此,是的,创建几个外壳命令和模板开关解决了我的问题。

这是最终代码:

外壳命令:

octoprint_connect:“ curl -s http://192.168.1.69/api/connection -d'{\” command \“:\” connect \“ connect \”} -h content -type:application/application/json'-h'-h'-h'x- x--API -KEY:2BF5F70FDB884F528464F137A26544FD'“ octoprint_disconnect:“ curl -s http://192.168.1.69/api/connection/connection/connection -dd'JSON' -H'X-API-KEY:2BF5F70FDB884F528464F137A26544FD'“”

转变:

- platform: template switches: conectar_octoprint: friendly_name: "Conectar Octoprint" value_template: "{{ not is_state('sensor.octoprint_current_state', 'unknown') }}" turn_on: service: shell_command.octoprint_connect turn_off: service: shell_command.octoprint_disconnect

自动化(我有一些想法):

- 别名:自动连接到打印机触发器:平台:state entity_id:switch.ender3 to:'on'动作: - 延迟:00:00:05-服务:switch.turn_on entity_id:switch.conectar_octoprint:conectar_octoprint-同行:高温:高温 -关闭(Sonoff Relay)触发器:平台:template value_template:“ {%if(states.sensor.octoprint_actual_bed_bed_bed_temp.state | int> = states.sensor.sensor.octoprint_target_target_bed_bed_bed_bed_temp.state | int * 1.2>= states.sensor.octoprint_target_tool0_temp.state | int * 1.2) and is_state('sensor.octoprint_current_state', 'Printing') %}true{% else %}false{% endif %}" action: - service: notify.ios_iphone_de_antoniodata_template:标题:“ impressora”消息:“atenção!perveraturas passaram dos限制,impressora foi desligada da energia!”- 服务:persistent_notification.create数据:标题:“ impressora({{now()。strftime('%h:%m')}})”消息:“atenção!persaturas passaturas passaram dos限制,Impressora foi foi desligada da da energia!”- 服务:switch.turn_off entity_id: -  switch.ender3

谢谢@pnbruckner您的帮助!

1喜欢

你好@pnbruckner呢你今天怎么样?

很抱歉再次打扰您,但我无法在Octoprint集成上获得下一步:预热床或/和工具壳命令。源自英国始于1946

我正在阅读有关www.19463331.com工具命令并提出了这一点,但它不起作用:

octoprint_preheat_bed:“ curl -s http://192.168.1.69/api/printer/bed-d'{\“ command \”:\“ target \”,\“ target \”,\“ target \”:\“ 60 \” 60 \“} -h} -h} -H'content -type:application/json'-h x -api -key:2bf5f70fdb884f528464f137a2654444fd'“ octoprint_preheat_tool:”\“ target \”,\“ targets \”:{\“ tool0 \”:\“ 100 \”}}'-h content-type:application/json'-h'-h x-pi-key:2bf5f70f70fdb8844f52844f5284646464f137a265444fd type:

知道如何解决这个问题?这些命令什么也不做,我相信JSON格式有问题。

谢谢!

您是否尝试过在外壳中运行命令?添加Curl的-v选项可以帮助您提供一些见识。

1喜欢

你好!我的一个朋友帮助了我,现在它就像魅力一样。这是结果:

octoprint_preheat_bed:“ curl -s http://192.168.1.69/api/printer/printer/bed-d'{\“ command \”:\“ target \”,\“ target \”,\“ target \”:60}'-H'-h content -'content -'''content -type:application/json' -h'x -api -key:2bf5f70fdb884f528464f137a265444fd'“ octoprint_preheat_tool:”“,\” targets \“:{\” tool0 \“:100}}'-H'content-type:application/json'-h'-h x-api-key:2bf5f70fdb884f528464f528464f137a265444fd'

谢谢!

啊,数字必须是数字,而不是字符串。说得通。

1喜欢

这是HA面板:

我相信这个线程可以帮助许多人试图将八普林与HA集成。

谢谢。

1喜欢

您是如何从Octoprint获得接力控制以在家庭助理中展示的?19463331伟德国际我正在使用封装插件,并且在HA中配置了Octoprint

你好先生。

我相信这个问题是给我的,对吗?

我使用的是Sonoff Basic作为Ender 3的主要电源开关,除了PICAM之外,我没有其他任何连接到我的rpizw…

供电话语,最好使用JavaScript启用