dec0ntamination/getDevices.js

9 lines
380 B
JavaScript
Raw Normal View History

2024-12-18 02:15:50 +00:00
const axios = require('axios')
const fs = require('fs')
let config = JSON.parse(fs.readFileSync('config.json', 'utf8'))
2024-12-18 04:24:19 +00:00
axios.get(`http://${config.servers.deconz.url}:${config.servers.deconz.apiPort}/api/${config.servers.deconz.apiKey}/sensors`)
2024-12-18 02:15:50 +00:00
.then(response => {
// console.log(response.data)
fs.writeFileSync('devices.json', JSON.stringify(response.data, null, 2))
})