Get device configuration.
(dev_id)
| 1566 | |
| 1567 | |
| 1568 | def get_device_config(dev_id): |
| 1569 | """Get device configuration.""" |
| 1570 | result = data.get(dev_id, data.get(dev_id.lower(), {})) # noqa: F821 |
| 1571 | if not result: |
| 1572 | result = {} |
| 1573 | try: |
| 1574 | if len(result) > 0: |
| 1575 | result[0] |
| 1576 | except TypeError: |
| 1577 | logger.error("Wrong configuration for %s", dev_id) # noqa: F821 |
| 1578 | result = {} |
| 1579 | finally: |
| 1580 | return result |
| 1581 | |
| 1582 | |
| 1583 | def mqtt_publish(topic, payload, retain, json=False): |