com之间的链接是什么

com之间的链接是什么

本文介绍了< YOUR-FIREBASE> .firebaseio.com和home.nest.com之间的链接是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用与firebaseio交谈,但是我找不到任何教程如何使用firebaseio实际与NEST设备进行通信。



firebaseio上的所有例子都与NEST没有任何关系,同样NEST例子中也没有任何例子与firebaseio做。



firebaseio帐户应该以某种方式从home.nest.com导入数据?如何链接这两个?






为什么我要使用firebaseio进行身份验证,除非它具有NEST的数据? p>



  from firebase import firebase 
firebase = firebase.FirebaseApplication('https://your_storage.firebaseio.com',认证=无)
结果= firebase.get('/ users',None,{'print':'pretty'})
打印结果
{'error':'Permission denied。 '}

authentication = firebase.Authentication('THIS_IS_MY_SECRET','[email protected]',extra = {'id':123})
firebase.authentication = authentication
打印authentication.extra
{'admin':False,'debug':False,'email':'[email protected]','id':123,'provider':'password'}

user = authentication.get_user()
打印user.firebase_auth_token
eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJhZG1pbiI6 IGZhbHNlLCAiZGVidWciOiBmYWxzZSwgIml
hdCI6IDEzNjE5NTAxNzQsICJkIjogeyJkZWJ1ZyI6IGZhbHNlLCAiYWRtaW4iOiBmYWxzZSwgInByb3ZpZGVyIjog
InBhc3N3b3JkIiwgImlkIjogNSwgImVtYWlsIjogIm96Z3VydnRAZ21haWwuY29tIn0sICJ2IjogMH0.lq4IRVfvE
GQklslOlS4uIBLSSJj88YNrloWXvisRgfQ

结果= firebase.get('/用户的,无,{ '打印': '漂亮'})
打印结果
{'1':'John Doe','2':'Jane Doe'}

$ b

解决方案

Nest使用与Firebase托管服务协议兼容的服务器。这就是说,有一些细微的差别。尽管您仍然可以使用Firebase客户端库(以及REST包装器,如python-firebase),但您需要遵循特定说明(Nest Intro 评论)。另一个需要改变的地方是,所有Firebase网址都以 https 开头,而让它们以 https 或<$ c $开头另外,不要使用常规的Firebase工具(例如Firebase Dashboard <<< -firebase> .firebaseio.com 或我们的Chrome扩展程序管理你的Nest设备。



希望这有助于!


I can talk to firebaseio using python-firebase but I am not finding any tutorials on how to actually communicate with a NEST device using firebaseio.

None of the examples on firebaseio have anything to do with NEST and likewise it seems none of the NEST examples have anything to do with firebaseio.

Is the firebaseio account supposed to somehow import the data from home.nest.com? How do I link the two?


Why would I want to authenticate with firebaseio unless it has the NEST's data?

python-firebase:

from firebase import firebase
firebase = firebase.FirebaseApplication('https://your_storage.firebaseio.com', authentication=None)
result = firebase.get('/users', None, {'print': 'pretty'})
print result
{'error': 'Permission denied.'}

authentication = firebase.Authentication('THIS_IS_MY_SECRET', '[email protected]', extra={'id': 123})
firebase.authentication = authentication
print authentication.extra
{'admin': False, 'debug': False, 'email': '[email protected]', 'id': 123, 'provider': 'password'}

user = authentication.get_user()
print user.firebase_auth_token
"eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJhZG1pbiI6IGZhbHNlLCAiZGVidWciOiBmYWxzZSwgIml
hdCI6IDEzNjE5NTAxNzQsICJkIjogeyJkZWJ1ZyI6IGZhbHNlLCAiYWRtaW4iOiBmYWxzZSwgInByb3ZpZGVyIjog
InBhc3N3b3JkIiwgImlkIjogNSwgImVtYWlsIjogIm96Z3VydnRAZ21haWwuY29tIn0sICJ2IjogMH0.lq4IRVfvE
GQklslOlS4uIBLSSJj88YNrloWXvisRgfQ"

result = firebase.get('/users', None, {'print': 'pretty'})
print result
{'1': 'John Doe', '2': 'Jane Doe'}
解决方案

Nest operates its own servers that are protocol-compatible with the Firebase hosted service. That said, there are some minor differences. While you can still use the Firebase client libraries (and REST wrappers, like python-firebase), you need to follow specific instructions (Nest Intro here).

The major change has to deal with how you create a new Firebase instance: instead of using https://<your-firebase>.firebaseio.com, you use wss://developer-api.nest.com. You then use your Nest auth token to authenticate. The Nest-ified JS would look like:

var dataRef = new Firebase('wss://developer-api.nest.com');
dataRef.auth(nestToken);

The Python should look similar:

from firebase import firebase
authentication = firebase.Authentication('YOUR_NEST_TOKEN', 'YOUR_EMAIL', extra={})
firebase = firebase.FirebaseApplication('wss://developer-api.nest.com', authentication)

Typically for Nest, you only need the token, rather than the email or the extra, which means you may have to use the other python-firebase library, or modify the source to allow a provider other than wrapping Simple Login. Looks like the original library never uses the email field (see this comment). Another change that would have to be made is to change the asserts that all Firebase URL's start with https and instead allow them to start with https or wss.

Also, instead of using the regular Firebase tools (Like the Firebase Dashboard at <your-firebase>.firebaseio.com, or our Chrome extension Vulcan), you use the Nest Chrome Extension to manage your Nest devices.

Hopefully this helps!

这篇关于&lt; YOUR-FIREBASE&gt; .firebaseio.com和home.nest.com之间的链接是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 10:26