MQTT Sensors #1
|
|
@ -260,7 +260,12 @@ func (s *MQTTBrokersService) EnsureListeners() {
|
||||||
|
|
||||||
// TODO: This is sub-optional
|
// TODO: This is sub-optional
|
||||||
for _, sensor := range brokerSensors {
|
for _, sensor := range brokerSensors {
|
||||||
if sensor.MqttTopic == nil || *sensor.MqttTopic != data[0] || sensor.MqttPath == nil {
|
if sensor.MqttTopic == nil || sensor.MqttPath == nil {
|
||||||
|
fmt.Printf("Skipping %s because it's missing topic or path", sensor.Name)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if *sensor.MqttTopic != data[0] {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ type SensorsService struct {
|
||||||
func (s *SensorsService) GetList() ([]models.SensorItem, error) {
|
func (s *SensorsService) GetList() ([]models.SensorItem, error) {
|
||||||
sensors := []models.SensorItem{}
|
sensors := []models.SensorItem{}
|
||||||
|
|
||||||
err := s.ctx.DB.Select(&sensors, "SELECT id, name, type, mqtt_broker_id, mqtt_topic, auth_key, last_contact_at FROM sensors")
|
err := s.ctx.DB.Select(&sensors, "SELECT id, name, type, mqtt_broker_id, mqtt_topic, mqtt_path, auth_key, last_contact_at FROM sensors")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue