},
    'middleware': {
        'type': 'volkszaehler',
        'middleware_url': 'http://localhost/middleware.php'
    }
}

SAMPLE_BME = Sample()
SAMPLE_BME.meter_id = '0x76'
SAMPLE_BME.channels = [{
    'objName': 'TEMPERATURE',
    'value': 20.0,
    'unit': 'C'
}, {
    'objName': 'HUMIDITY',
    'value': 50.0,
    'unit': '%'
}, {
    'objName': 'PRESSURE',
    'value': 1000.0,
    'unit': 'hPa'
}]

SAMPLE_SML = Sample()
SAMPLE_SML.meter_id = '1 EMH00 12345678'
SAMPLE_SML.channels = [{'objName': '1.8.0*255', 'value': 10000, 'unit': 'kWh'}]

SAMPLE_PLAIN = Sample()
SAMPLE_PLAIN.meter_id = 888777666
SAMPLE_PLAIN.channels = [{'objName': '6.8', 'value': 20000, 'unit': 'kWh'}]
示例#2
0
            },
            'id': 118,
            'protocol': 'BME280'
        }
    },
    'middleware': {
        'type': 'volkszaehler',
        'middleware_url': 'http://localhost/middleware.php'
    }
}

SAMPLE_BME = Sample()
SAMPLE_BME.meter_id = '0x76'
SAMPLE_BME.channels = [
    ChannelValue('TEMPERATURE', 20.0, 'C'),
    ChannelValue('HUMIDITY', 50.0, '%'),
    ChannelValue('PRESSURE', 1000.0, 'hPa')
]

SAMPLE_SML = Sample()
SAMPLE_SML.meter_id = '1 EMH00 12345678'
SAMPLE_SML.channels = [ChannelValue('1.8.0*255', 10000, 'kWh')]

SAMPLE_PLAIN = Sample()
SAMPLE_PLAIN.meter_id = '888777666'
SAMPLE_PLAIN.channels = [ChannelValue('6.8', 20000, 'kWh')]


class MockedGateway(VolkszaehlerGateway):
    def post(self, channel, value, sample_timestamp, poll_timestamp):
        return True