-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqueries.js
42 lines (39 loc) · 869 Bytes
/
queries.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const gql = require('graphql-tag');
module.exports = {
getHomesQuery: getHomesQuery,
getSubscriptionQuery: getSubscriptionQuery
};
function getHomesQuery() {
return `{
viewer {
homes {
id
features {
realTimeConsumptionEnabled
}
}
}
}
`;
}
function getSubscriptionQuery(homeId) {
return gql`
subscription{
liveMeasurement(homeId:"${homeId}"){
timestamp
power
accumulatedConsumption
accumulatedCost
currency
minPower
averagePower
maxPower
voltagePhase1
voltagePhase2
voltagePhase3
currentPhase1
currentPhase2
currentPhase3
}
}`;
}