Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dannybloe committed May 31, 2016
2 parents f561c5a + d3f8659 commit 423423b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ You can control this fetching in the [settings](#settings).
- **updateAirQuality(quality)**: *Function*.
- **updateAlertSensor(level, text)**: *Function*. Level can be domoticz.ALERTLEVEL_GREY, ALERTLEVEL_GREE, ALERTLEVEL_YELLOW, ALERTLEVEL_ORANGE, ALERTLEVEL_RED
- **updateBarometer(pressure, forecast)**: *Function*. Update barometric pressure. Forecast can be domoticz.BARO_STABLE, BARO_SUNNY, BARO_CLOUDY, BARO_UNSTABLE, BARO_THUNDERSTORM, BARO_UNKNOWN, BARO_CLOUDY_RAIN
- **updateCounter(value)**: *Function*.
- **updateCounter(value)**: *Function*.
- **updateCustomSensor(value)**: *Function*.
- **updateDistance(distance)**: *Function*.
- **updateElectricity(power, energy)**: *Function*.
- **updateGas(usage)**: *Function*.
Expand Down
5 changes: 5 additions & 0 deletions dzVents/Device.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ local function Device(domoticz, name, state, wasChanged)
self.update(0, distance)
end

function self.updateCustomSensor(value)
self.update(0, value)
end


function self.updateSetPoint(setPoint, mode, untilDate)
if (self.hardwareTypeVal == 15 and self.deviceSubType == 'SetPoint') then -- dummy hardware
-- send the command using openURL otherwise, due to a bug in Domoticz, you will get a timeout on the script
Expand Down
4 changes: 3 additions & 1 deletion dzVents/HistoricalStorage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ local function HistoricalStorage(data, maxItems, maxHours, maxMinutes, getData)
end

function self.reset()
self.storage = {}
for k, v in pairs(self.storage) do
self.storage[k] = nil
end
self.size = 0
self.newData = nil
end
Expand Down
3 changes: 2 additions & 1 deletion dzVents/QUICKREF.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ Available on the collections: devices, variables, scenes, groups:
- **updateAirQuality(quality)**: *Function*.
- **updateAlertSensor(level, text)**: *Function*. Level can be domoticz.ALERTLEVEL_GREY, ALERTLEVEL_GREE, ALERTLEVEL_YELLOW, ALERTLEVEL_ORANGE, ALERTLEVEL_RED
- **updateBarometer(pressure, forecast)**: *Function*. Update barometric pressure. Forecast can be domoticz.BARO_STABLE, BARO_SUNNY, BARO_CLOUDY, BARO_UNSTABLE, BARO_THUNDERSTORM, BARO_UNKNOWN, BARO_CLOUDY_RAIN
- **updateCounter(value)**: *Function*.
- **updateCounter(value)**: *Function*.
- **updateCustomSensor(value)**: *Function*.
- **updateDistance(distance)**: *Function*.
- **updateElectricity(power, energy)**: *Function*.
- **updateGas(usage)**: *Function*.
Expand Down
4 changes: 4 additions & 0 deletions dzVents/dzVents history.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[1.0.1]
* Added updateCustomSensor(value) method.
* Fixed reset() for historical data.

[1.0][1.0-beta2]
* Deprecated setNew(). Use add() instead. You can now add multiple values at once in a script by calling multiple add()s in succession.
* Fixed printing device logs when a value was boolean or nil
Expand Down
5 changes: 5 additions & 0 deletions dzVents/tests/testDevice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ describe('device', function()
assert.is_same({{["UpdateDevice"]="100|0|67"}}, commandArray)
end)

it('should update a custom sensor', function()
device.updateCustomSensor(67)
assert.is_same({ { ["UpdateDevice"] = "100|0|67" } }, commandArray)
end)

it('should update dummy setpoint', function()
device.hardwareTypeVal = 15
device.deviceSubType = 'SetPoint'
Expand Down
1 change: 1 addition & 0 deletions dzVents/tests/testEventHelpersStorage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ describe('event helper storage', function()
hs.reset()
assert.is_same(0, hs.size)
assert.is_nil(hs.getLatest())
assert.is_same({}, hs._getForStorage())
end)

it('should return a subset', function()
Expand Down

0 comments on commit 423423b

Please sign in to comment.