Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Search the Community

Showing results for tags 'websockets'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 2 results

  1. Anyone that can give some assistance with coding WebSockets in a QA?? Trying to build a really simple QA to collect data from my “Tibber Pulse”. The intention is to capture live energy consumption and put the code in a Energy Meter QA. In the Tibber iPhone app I get updated values every 10’s second from my Tibber Pulse and to get similar in a Fibaro HC3 QA would be ideal. Have never worked with WebSockets in the past so have no clue to how to do this…. But as a general concept it looks doable, but my attempt so far have only failed. General simple idea is to create a QA (Energy Meter type) with WebSocket code that listens to data from my “Tibber Pulse” and simply store the data received to the QA with self:updateProperty("value", TibberDataRecieved). There are some information in regards to WebSockets on the Tibber development pages: https://developer.tibber.com/docs/guides/graphql-concepts https://developer.tibber.com/docs/guides/calling-api Subscriptions GraphQL Subscriptions is the mechanism that is used for streaming data. It is basically a layer built on top of standard web sockets. A client starts a subscription by issuing a subscription query: subscription{ liveMeasurement(homeId:"c70dcbe5-4485-4821-933d-a8a86452737b"){ timestamp power accumulatedConsumption accumulatedCost currency minPower averagePower maxPower } } The server will then push results conforming to this query over the socket that is kept open between client and server. GraphQL Subscriptions Endpoint wss://api.tibber.com/v1-beta/gql/subscriptions Subscribing to data While queries and mutations are typically handled over HTTP some data are better suited to handled as streams over a persistent connection (web socket). Subscriptions follows the same semantics as queries and mutations - the shape of what is returned/sent from the server is determined by the client when invoking the api: subscription{ liveMeasurement(homeId:"c70dcbe5-4485-4821-933d-a8a86452737b"){ timestamp power accumulatedConsumption accumulatedCost currency minPower averagePower maxPower } } Since subscriptions are handled over web sockets they can be a bit more challenging to handle from the client’s perspective. Many GraphQL client libraries provide good abstractions for this though. Note that the maximum number of open websockets is limited to two. Streaming live data from Tibber Pulse Python example to get live streaming data from your Tibber Pulse over GraphQl. This also works for any other type of smart energy meter supported by Tibber, such as Watty. Requires ‘Python GraphQL Client’ package: pip install python-graphql-client from python_graphql_client import GraphqlClient import asyncio def print_handle(data): print(data["data"]["liveMeasurement"]["timestamp"]+" "+str(data["data"]["liveMeasurement"]["power"])) client = GraphqlClient(endpoint="wss://api.tibber.com/v1-beta/gql/subscriptions") query = """ subscription{ liveMeasurement(homeId:"c70dcbe5-4485-4821-933d-a8a86452737b"){ timestamp power } } """ asyncio.run(client.subscribe(query=query, headers={'Authorization': "476c477d8a039529478ebd690d35ddd80e3308ffc49b59c65b142321aee963a4"}, handle=print_handle)) Tibber GraphiQL example from (https://developer.tibber.com/explorer) subscription{ liveMeasurement(homeId:"cc83e83e-8cbf-4595-9bf7-c3cf192f7d9c"){ timestamp power accumulatedConsumption accumulatedCost currency minPower averagePower maxPower } }
  2. Hi all, I want to send commands to my Rotel amplifier from my HC2, using lua in a virtual device. The service I want to connect to is a websockets service on an RPi2 connected to the Rotel over USB. It's the json-serial-port-server by John Lauer, https://github.com/chilipeppr/serial-port-json-server. I did find connections using tcpsockets in lua, but tcpsockets and websockets are different things. All other (http) connections don't work. If I get something like a connection from lua, an additional window opens on top of my browser connection to my HC2. This is not useful. Anyone any idea how to use websockets from lua? Thanks in advance, Evert
×
×
  • Create New...