Fibaro Universal Binary sensor wrong temperature, no outputs

For Z-Wave related questions in Domoticz

Moderator: leecollings

User avatar
Domosapiens
Posts: 232
Joined: Wednesday 20 August 2014 12:08
Target OS: Windows
Domoticz version: V3.5981
Location: NL
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Domosapiens »

Elektrotek,
Regarding my fibaro software, it shows exactly the same library, protocol and application version as yours.
Find below the code of one of my FGBS001 sensors as in my zwcfg_0xnnnnn.xml.
Looking at it, line by line, can you find any significant difference?
Spoiler: show

Code: Select all

<Node id="5" name="" location="" basic="4" generic="32" specific="1" type="Routing Binary Sensor" listening="true" frequentListening="false" beaming="true" routing="true" max_baud_rate="40000" version="4" query_stage="Complete">
		<Manufacturer id="010f" name="FIBARO System">
			<Product type="0501" id="1002" name="FGBS001 Universal Binary Sensor" />
		</Manufacturer>
		<CommandClasses>
			<CommandClass id="32" name="COMMAND_CLASS_BASIC" version="1" request_flags="5" after_mark="true" mapping="48" setasreport="true">
				<Instance index="1" endpoint="1" />
				<Instance index="2" endpoint="2" />
			</CommandClass>
			<CommandClass id="43" name="COMMAND_CLASS_SCENE_ACTIVATION" version="1" request_flags="5" after_mark="true">
				<Instance index="1" />
			</CommandClass>
			<CommandClass id="48" name="COMMAND_CLASS_SENSOR_BINARY" version="1" request_flags="5">
				<Instance index="1" endpoint="1" />
				<Instance index="2" endpoint="2" />
				<Value type="bool" genre="user" instance="1" index="0" label="Sensor" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="1" min="0" max="0" value="True" />
				<Value type="bool" genre="user" instance="2" index="0" label="Sensor" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="1" min="0" max="0" value="False" />
				<SensorMap index="0" type="85" />
				<SensorMap index="0" type="86" />
				<SensorMap index="0" type="169" />
				<SensorMap index="0" type="170" />
			</CommandClass>
			<CommandClass id="49" name="COMMAND_CLASS_SENSOR_MULTILEVEL" version="1">
				<Instance index="1" endpoint="3" />
				<Instance index="2" endpoint="4" />
				<Instance index="3" endpoint="5" />
				<Instance index="4" endpoint="6" />
				<Value type="decimal" genre="user" instance="1" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="2" min="0" max="0" value="26.00" />
				<Value type="decimal" genre="user" instance="2" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="2" min="0" max="0" value="29.00" />
				<Value type="decimal" genre="user" instance="3" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="2" min="0" max="0" value="37.18" />
				<Value type="decimal" genre="user" instance="4" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="2" min="0" max="0" value="25.18" />
			</CommandClass>
			<CommandClass id="96" name="COMMAND_CLASS_MULTI_INSTANCE/CHANNEL" version="2" request_flags="1" mapping="endpoints">
				<Instance index="1" />
			</CommandClass>
			<CommandClass id="112" name="COMMAND_CLASS_CONFIGURATION" version="1" request_flags="5">
				<Instance index="1" />
				<Value type="short" genre="config" instance="1" index="1" label="IN1 Alarm Cancellation Delay" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="65535" value="0">
					<Help>Input I alarm cancellation delay. Additional delay after an alarm from input IN1 has ceased. The parameter allows you to specify additional time, after which the input no. 1 alarm is cancelled once its violation has ceased. Default 0.</Help>
				</Value>
				<Value type="short" genre="config" instance="1" index="2" label="IN2 Alarm Cancellation Delay" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="65535" value="0">
					<Help>Input II alarm cancellation delay. Additional delay after an alarm from input IN1 has ceased. The parameter allows you to specify additional time, after which the input no. 1 alarm is cancelled once its violation has ceased. Default 0.</Help>
				</Value>
				<Value type="list" genre="config" instance="1" index="3" label="Type of input no. 1" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="1" size="1">
					<Help>Type of input no. 1, what the input 1 will report if no contact is made. Default 1.</Help>
					<Item label="Input NO (Normal Open)" value="0" />
					<Item label="Input NC (Normal Close)" value="1" />
					<Item label="Input MONOSTABLE" value="2" />
					<Item label="Input BISTABLE" value="3" />
				</Value>
				<Value type="list" genre="config" instance="1" index="4" label="Type of input no. 2" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="1" size="1">
					<Help>Type of input no. 2, what the input 2 will report if no contact is made. Default 1.</Help>
					<Item label="Input NO (Normal Open)" value="0" />
					<Item label="Input NC (Normal Close)" value="1" />
					<Item label="Input MONOSTABLE" value="2" />
					<Item label="Input BISTABLE" value="3" />
				</Value>
				<Value type="list" genre="config" instance="1" index="5" label="Type of transmitted control frame for association group 1" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="6" size="1">
					<Help>Type of transmitted control frame for association group 1, activated via input IN1. The parameter allows to specify the type of alarm frame or to force transmission of control commands (BASIC_SET). Default 255 - BASIC SET.</Help>
					<Item label="ALARM GENERIC" value="0" />
					<Item label="ALARM SMOKE" value="1" />
					<Item label="ALARM CO" value="2" />
					<Item label="ALARM CO2" value="3" />
					<Item label="ALARM HEAT" value="4" />
					<Item label="ALARM WATER" value="5" />
					<Item label="BASIC_SET" value="255" />
				</Value>
				<Value type="list" genre="config" instance="1" index="6" label="Type of transmitted control frame for association group 2" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="6" size="1">
					<Help>Type of transmitted control frame for association group 2, activated via input IN1. The parameter allows to specify the type of alarm frame or to force transmission of control commands (BASIC_SET). Default 255 - BASIC SET.</Help>
					<Item label="ALARM GENERIC" value="0" />
					<Item label="ALARM SMOKE" value="1" />
					<Item label="ALARM CO" value="2" />
					<Item label="ALARM CO2" value="3" />
					<Item label="ALARM HEAT" value="4" />
					<Item label="ALARM WATER" value="5" />
					<Item label="BASIC_SET" value="255" />
				</Value>
				<Value type="byte" genre="config" instance="1" index="7" label="Forced Level of Dimming group 1" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="1" max="255" value="255">
					<Help>Value of the parameter specifying the forced level of dimming / opening sun blinds when comes "switch on" / "open" command to devices from association group no. 1. In the case of alarm frames the alarm priority is specified. Possible parameter settings: (1 – 99) and 255. Value of 255 makes it possible to activate the device when using the Dimmer module it means activating the device and setting it to the previous stored condition, e.g. when Dimmer is set to 30%, then deactivated, and then reactivated using command 255, it will automatically be set to the previous condition, i.e. 30%. Default 255.</Help>
				</Value>
				<Value type="byte" genre="config" instance="1" index="8" label="Forced Level of Dimming group 2" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="1" max="255" value="255">
					<Help>Value of the parameter specifying the forced level of dimming / opening sun blinds when comes "switch on" / "open" command to devices from association group no. 2. In the case of alarm frames the alarm priority is specified. Possible parameter settings: (1 – 99) and 255. Value of 255 makes it possible to activate the device when using the Dimmer module it means activating the device and setting it to the previous stored condition, e.g. when Dimmer is set to 30%, then deactivated, and then reactivated using command 255, it will automatically be set to the previous condition, i.e. 30%. Default 255.</Help>
				</Value>
				<Value type="list" genre="config" instance="1" index="9" label="Deactivate transmission of frame cancelling alarm" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="1">
					<Help>Deactivating transmission of the frame cancelling the alarm or the control frame deactivating the device (Basic). It allows for disabling the deactivation function or the alarm cancellation function for devices associated with the appropriate input of the Fibaro Sensor. NOTE: Information concerning alarm violation or activation commands for devices from association groups are always sent. Default 0. ATTENTION: Information alarm triggered or command enabled for devices with associative groups are always sent. NOTE: Value "Group 1 not sent, Group 2 not sent" is only available in version 2.1 and up</Help>
					<Item label="Groups 1 and 2 sent" value="0" />
					<Item label="Group 1 sent, Group 2 not sent." value="1" />
					<Item label="Group 1 not sent, Group 2 sent." value="2" />
					<Item label="Group 1 not sent, Group 2 not sent." value="3" />
				</Value>
				<Value type="byte" genre="config" instance="1" index="10" label="Interval between successive readings of temperature sensors" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="1" max="255" value="20">
					<Help>Interval between successive readings of temperature from all sensors connected to the device in seconds. Possible parameter settings: (1 – 255). Default 20. ATTENTION: taking temperature readings from the sensor does not result in sending a temperature condition report to the central hub.</Help>
				</Value>
				<Value type="byte" genre="config" instance="1" index="11" label="Interval between forcing to send report concerning the temperature conditions" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="200">
					<Help>Interval between forcing to send report concerning the temperature conditions. The forced report is sent immediately after the next reading of temperature from the sensor, irrespective of the settings of parameter no. 12. Value 0 = Deactivates the function. Default 200. ATTENTION: Frequent sending of temperature condition reports is reasonable when the sensor is located somewhere where can occure rapid changes of ambient temperature. In other cases it is recommended to leave the parameter set to the default value.</Help>
				</Value>
				<Value type="byte" genre="config" instance="1" index="12" label="Insensitiveness to temperature changes." units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="8">
					<Help>Insensitiveness to temperature changes. This is the maximum acceptable difference between the last reported temperature and the current temperature taken from the sensor. If the temperatures differ by the set value or more, then a report with the current temperature value is sent to the device assigned to association group no. 3. Intervals between taking readings from sensors are specified by parameter no. 10. Possible parameter settings:0 – 255 [0oC to 16oC] [0 oF – 28.8oF] In order to set the appropriate value of the parameter, the following formula should be used: x = delta T x 16 - for Celsius x = delta T x 80 / 9 - for Fahrenheit x – parameter value delta T – maximum acceptable temperature gradient in Celsius or Fahrenheit If the value is set to 0, then information about the temperature will be sent every time, immediately once the readings have been taken from the sensor. Default 8.</Help>
				</Value>
				<Value type="list" genre="config" instance="1" index="13" label="Transmitting the alarm or control frame broadcast mode" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="1">
					<Help>Transmitting the alarm or control frame in "broadcast" mode (i.e. to all devices within range), information sent in this mode is not repeated by the mesh network. Default 0. ATTENTION: If the broadcast mode of information transmission is activated for a given channel, then transmission of information in singlecast mode to devices assigned to the association group of this channel is deactivated.</Help>
					<Item label="Sensor 1 and 2 Broadcast inactive" value="0" />
					<Item label="Sensor 1 broadcast mode active, Sensor 2 broadcast mode inactive" value="1" />
					<Item label="Sensor 1 broadcast mode inactive, Sensor 2 broadcast mode active" value="2" />
					<Item label="Sensor 1 and 2 broadcast mode active" value="3" />
				</Value>
				<Value type="list" genre="config" instance="1" index="14" label="Scene activation" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="1">
					<Help>Enable/Disable scene functionality. The device offers the possibility of sending commands compatible with Command class scene activation. Information is sent to devices assigned to association group no. 3. Default 0.</Help>
					<Item label="Scenes disabled" value="0" />
					<Item label="Scenes enabled" value="1" />
				</Value>
			</CommandClass>
			<CommandClass id="114" name="COMMAND_CLASS_MANUFACTURER_SPECIFIC" version="1" request_flags="5">
				<Instance index="1" />
			</CommandClass>
			<CommandClass id="133" name="COMMAND_CLASS_ASSOCIATION" version="2" request_flags="4">
				<Instance index="1" />
				<Associations num_groups="3">
					<Group index="1" max_associations="5" label="Input IN1" auto="true">
						<Node id="1" />
					</Group>
					<Group index="2" max_associations="5" label="Input IN2" auto="true">
						<Node id="1" />
					</Group>
					<Group index="3" max_associations="1" label="Temperature Sensor(s)" auto="true">
						<Node id="1" />
					</Group>
				</Associations>
			</CommandClass>
			<CommandClass id="134" name="COMMAND_CLASS_VERSION" version="1" request_flags="5">
				<Instance index="1" />
				<Value type="string" genre="system" instance="1" index="0" label="Library Version" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="3" />
				<Value type="string" genre="system" instance="1" index="1" label="Protocol Version" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="3.52" />
				<Value type="string" genre="system" instance="1" index="2" label="Application Version" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="2.01" />
			</CommandClass>
			<CommandClass id="142" name="COMMAND_CLASS_MULTI_INSTANCE_ASSOCIATION" version="2" request_flags="5">
				<Instance index="1" />
			</CommandClass>
			<CommandClass id="156" name="COMMAND_CLASS_SENSOR_ALARM" version="1" request_flags="2">
				<Instance index="1" endpoint="1" />
				<Instance index="2" endpoint="2" />
			</CommandClass>
		</CommandClasses>
	</Node>

When you use the inputs 1 and/or 2, polling must be on.

Hope this helps
Domosapiens
Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
User avatar
Domosapiens
Posts: 232
Joined: Wednesday 20 August 2014 12:08
Target OS: Windows
Domoticz version: V3.5981
Location: NL
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Domosapiens »

And here are my settings:
FGBS001 Capture1.JPG
FGBS001 Capture1.JPG (218.24 KiB) Viewed 3272 times
FGBS001 Capture2.JPG
FGBS001 Capture2.JPG (294.52 KiB) Viewed 3272 times
Hope this helps too
Domosapiens
Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
Elektrotek
Posts: 12
Joined: Sunday 26 July 2015 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Elektrotek »

Domosapiens wrote:Elektrotek,
Regarding my fibaro software, it shows exactly the same library, protocol and application version as yours.
Find below the code of one of my FGBS001 sensors as in my zwcfg_0xnnnnn.xml.
Looking at it, line by line, can you find any significant difference?
Spoiler: show

Code: Select all

<Node id="5" name="" location="" basic="4" generic="32" specific="1" type="Routing Binary Sensor" listening="true" frequentListening="false" beaming="true" routing="true" max_baud_rate="40000" version="4" query_stage="Complete">
		<Manufacturer id="010f" name="FIBARO System">
			<Product type="0501" id="1002" name="FGBS001 Universal Binary Sensor" />
		</Manufacturer>
		<CommandClasses>
			<CommandClass id="32" name="COMMAND_CLASS_BASIC" version="1" request_flags="5" after_mark="true" mapping="48" setasreport="true">
				<Instance index="1" endpoint="1" />
				<Instance index="2" endpoint="2" />
			</CommandClass>
			<CommandClass id="43" name="COMMAND_CLASS_SCENE_ACTIVATION" version="1" request_flags="5" after_mark="true">
				<Instance index="1" />
			</CommandClass>
			<CommandClass id="48" name="COMMAND_CLASS_SENSOR_BINARY" version="1" request_flags="5">
				<Instance index="1" endpoint="1" />
				<Instance index="2" endpoint="2" />
				<Value type="bool" genre="user" instance="1" index="0" label="Sensor" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="1" min="0" max="0" value="True" />
				<Value type="bool" genre="user" instance="2" index="0" label="Sensor" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="1" min="0" max="0" value="False" />
				<SensorMap index="0" type="85" />
				<SensorMap index="0" type="86" />
				<SensorMap index="0" type="169" />
				<SensorMap index="0" type="170" />
			</CommandClass>
			<CommandClass id="49" name="COMMAND_CLASS_SENSOR_MULTILEVEL" version="1">
				<Instance index="1" endpoint="3" />
				<Instance index="2" endpoint="4" />
				<Instance index="3" endpoint="5" />
				<Instance index="4" endpoint="6" />
				<Value type="decimal" genre="user" instance="1" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="2" min="0" max="0" value="26.00" />
				<Value type="decimal" genre="user" instance="2" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="2" min="0" max="0" value="29.00" />
				<Value type="decimal" genre="user" instance="3" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="2" min="0" max="0" value="37.18" />
				<Value type="decimal" genre="user" instance="4" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="2" min="0" max="0" value="25.18" />
			</CommandClass>
			<CommandClass id="96" name="COMMAND_CLASS_MULTI_INSTANCE/CHANNEL" version="2" request_flags="1" mapping="endpoints">
				<Instance index="1" />
			</CommandClass>
			<CommandClass id="112" name="COMMAND_CLASS_CONFIGURATION" version="1" request_flags="5">
				<Instance index="1" />
				<Value type="short" genre="config" instance="1" index="1" label="IN1 Alarm Cancellation Delay" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="65535" value="0">
					<Help>Input I alarm cancellation delay. Additional delay after an alarm from input IN1 has ceased. The parameter allows you to specify additional time, after which the input no. 1 alarm is cancelled once its violation has ceased. Default 0.</Help>
				</Value>
				<Value type="short" genre="config" instance="1" index="2" label="IN2 Alarm Cancellation Delay" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="65535" value="0">
					<Help>Input II alarm cancellation delay. Additional delay after an alarm from input IN1 has ceased. The parameter allows you to specify additional time, after which the input no. 1 alarm is cancelled once its violation has ceased. Default 0.</Help>
				</Value>
				<Value type="list" genre="config" instance="1" index="3" label="Type of input no. 1" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="1" size="1">
					<Help>Type of input no. 1, what the input 1 will report if no contact is made. Default 1.</Help>
					<Item label="Input NO (Normal Open)" value="0" />
					<Item label="Input NC (Normal Close)" value="1" />
					<Item label="Input MONOSTABLE" value="2" />
					<Item label="Input BISTABLE" value="3" />
				</Value>
				<Value type="list" genre="config" instance="1" index="4" label="Type of input no. 2" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="1" size="1">
					<Help>Type of input no. 2, what the input 2 will report if no contact is made. Default 1.</Help>
					<Item label="Input NO (Normal Open)" value="0" />
					<Item label="Input NC (Normal Close)" value="1" />
					<Item label="Input MONOSTABLE" value="2" />
					<Item label="Input BISTABLE" value="3" />
				</Value>
				<Value type="list" genre="config" instance="1" index="5" label="Type of transmitted control frame for association group 1" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="6" size="1">
					<Help>Type of transmitted control frame for association group 1, activated via input IN1. The parameter allows to specify the type of alarm frame or to force transmission of control commands (BASIC_SET). Default 255 - BASIC SET.</Help>
					<Item label="ALARM GENERIC" value="0" />
					<Item label="ALARM SMOKE" value="1" />
					<Item label="ALARM CO" value="2" />
					<Item label="ALARM CO2" value="3" />
					<Item label="ALARM HEAT" value="4" />
					<Item label="ALARM WATER" value="5" />
					<Item label="BASIC_SET" value="255" />
				</Value>
				<Value type="list" genre="config" instance="1" index="6" label="Type of transmitted control frame for association group 2" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="6" size="1">
					<Help>Type of transmitted control frame for association group 2, activated via input IN1. The parameter allows to specify the type of alarm frame or to force transmission of control commands (BASIC_SET). Default 255 - BASIC SET.</Help>
					<Item label="ALARM GENERIC" value="0" />
					<Item label="ALARM SMOKE" value="1" />
					<Item label="ALARM CO" value="2" />
					<Item label="ALARM CO2" value="3" />
					<Item label="ALARM HEAT" value="4" />
					<Item label="ALARM WATER" value="5" />
					<Item label="BASIC_SET" value="255" />
				</Value>
				<Value type="byte" genre="config" instance="1" index="7" label="Forced Level of Dimming group 1" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="1" max="255" value="255">
					<Help>Value of the parameter specifying the forced level of dimming / opening sun blinds when comes "switch on" / "open" command to devices from association group no. 1. In the case of alarm frames the alarm priority is specified. Possible parameter settings: (1 – 99) and 255. Value of 255 makes it possible to activate the device when using the Dimmer module it means activating the device and setting it to the previous stored condition, e.g. when Dimmer is set to 30%, then deactivated, and then reactivated using command 255, it will automatically be set to the previous condition, i.e. 30%. Default 255.</Help>
				</Value>
				<Value type="byte" genre="config" instance="1" index="8" label="Forced Level of Dimming group 2" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="1" max="255" value="255">
					<Help>Value of the parameter specifying the forced level of dimming / opening sun blinds when comes "switch on" / "open" command to devices from association group no. 2. In the case of alarm frames the alarm priority is specified. Possible parameter settings: (1 – 99) and 255. Value of 255 makes it possible to activate the device when using the Dimmer module it means activating the device and setting it to the previous stored condition, e.g. when Dimmer is set to 30%, then deactivated, and then reactivated using command 255, it will automatically be set to the previous condition, i.e. 30%. Default 255.</Help>
				</Value>
				<Value type="list" genre="config" instance="1" index="9" label="Deactivate transmission of frame cancelling alarm" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="1">
					<Help>Deactivating transmission of the frame cancelling the alarm or the control frame deactivating the device (Basic). It allows for disabling the deactivation function or the alarm cancellation function for devices associated with the appropriate input of the Fibaro Sensor. NOTE: Information concerning alarm violation or activation commands for devices from association groups are always sent. Default 0. ATTENTION: Information alarm triggered or command enabled for devices with associative groups are always sent. NOTE: Value "Group 1 not sent, Group 2 not sent" is only available in version 2.1 and up</Help>
					<Item label="Groups 1 and 2 sent" value="0" />
					<Item label="Group 1 sent, Group 2 not sent." value="1" />
					<Item label="Group 1 not sent, Group 2 sent." value="2" />
					<Item label="Group 1 not sent, Group 2 not sent." value="3" />
				</Value>
				<Value type="byte" genre="config" instance="1" index="10" label="Interval between successive readings of temperature sensors" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="1" max="255" value="20">
					<Help>Interval between successive readings of temperature from all sensors connected to the device in seconds. Possible parameter settings: (1 – 255). Default 20. ATTENTION: taking temperature readings from the sensor does not result in sending a temperature condition report to the central hub.</Help>
				</Value>
				<Value type="byte" genre="config" instance="1" index="11" label="Interval between forcing to send report concerning the temperature conditions" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="200">
					<Help>Interval between forcing to send report concerning the temperature conditions. The forced report is sent immediately after the next reading of temperature from the sensor, irrespective of the settings of parameter no. 12. Value 0 = Deactivates the function. Default 200. ATTENTION: Frequent sending of temperature condition reports is reasonable when the sensor is located somewhere where can occure rapid changes of ambient temperature. In other cases it is recommended to leave the parameter set to the default value.</Help>
				</Value>
				<Value type="byte" genre="config" instance="1" index="12" label="Insensitiveness to temperature changes." units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="8">
					<Help>Insensitiveness to temperature changes. This is the maximum acceptable difference between the last reported temperature and the current temperature taken from the sensor. If the temperatures differ by the set value or more, then a report with the current temperature value is sent to the device assigned to association group no. 3. Intervals between taking readings from sensors are specified by parameter no. 10. Possible parameter settings:0 – 255 [0oC to 16oC] [0 oF – 28.8oF] In order to set the appropriate value of the parameter, the following formula should be used: x = delta T x 16 - for Celsius x = delta T x 80 / 9 - for Fahrenheit x – parameter value delta T – maximum acceptable temperature gradient in Celsius or Fahrenheit If the value is set to 0, then information about the temperature will be sent every time, immediately once the readings have been taken from the sensor. Default 8.</Help>
				</Value>
				<Value type="list" genre="config" instance="1" index="13" label="Transmitting the alarm or control frame broadcast mode" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="1">
					<Help>Transmitting the alarm or control frame in "broadcast" mode (i.e. to all devices within range), information sent in this mode is not repeated by the mesh network. Default 0. ATTENTION: If the broadcast mode of information transmission is activated for a given channel, then transmission of information in singlecast mode to devices assigned to the association group of this channel is deactivated.</Help>
					<Item label="Sensor 1 and 2 Broadcast inactive" value="0" />
					<Item label="Sensor 1 broadcast mode active, Sensor 2 broadcast mode inactive" value="1" />
					<Item label="Sensor 1 broadcast mode inactive, Sensor 2 broadcast mode active" value="2" />
					<Item label="Sensor 1 and 2 broadcast mode active" value="3" />
				</Value>
				<Value type="list" genre="config" instance="1" index="14" label="Scene activation" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="1">
					<Help>Enable/Disable scene functionality. The device offers the possibility of sending commands compatible with Command class scene activation. Information is sent to devices assigned to association group no. 3. Default 0.</Help>
					<Item label="Scenes disabled" value="0" />
					<Item label="Scenes enabled" value="1" />
				</Value>
			</CommandClass>
			<CommandClass id="114" name="COMMAND_CLASS_MANUFACTURER_SPECIFIC" version="1" request_flags="5">
				<Instance index="1" />
			</CommandClass>
			<CommandClass id="133" name="COMMAND_CLASS_ASSOCIATION" version="2" request_flags="4">
				<Instance index="1" />
				<Associations num_groups="3">
					<Group index="1" max_associations="5" label="Input IN1" auto="true">
						<Node id="1" />
					</Group>
					<Group index="2" max_associations="5" label="Input IN2" auto="true">
						<Node id="1" />
					</Group>
					<Group index="3" max_associations="1" label="Temperature Sensor(s)" auto="true">
						<Node id="1" />
					</Group>
				</Associations>
			</CommandClass>
			<CommandClass id="134" name="COMMAND_CLASS_VERSION" version="1" request_flags="5">
				<Instance index="1" />
				<Value type="string" genre="system" instance="1" index="0" label="Library Version" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="3" />
				<Value type="string" genre="system" instance="1" index="1" label="Protocol Version" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="3.52" />
				<Value type="string" genre="system" instance="1" index="2" label="Application Version" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="2.01" />
			</CommandClass>
			<CommandClass id="142" name="COMMAND_CLASS_MULTI_INSTANCE_ASSOCIATION" version="2" request_flags="5">
				<Instance index="1" />
			</CommandClass>
			<CommandClass id="156" name="COMMAND_CLASS_SENSOR_ALARM" version="1" request_flags="2">
				<Instance index="1" endpoint="1" />
				<Instance index="2" endpoint="2" />
			</CommandClass>
		</CommandClasses>
	</Node>

When you use the inputs 1 and/or 2, polling must be on.

Hope this helps
Domosapiens
Thank you Domosapiens,
Apart from the fact that you use 4 sensors instead of one, the only difference is the part in bold, which is totally missing in your file:
name="COMMAND_CLASS_SENSOR_BINARY" version="1" request_flags="5">
Mine:
name="COMMAND_CLASS_SENSOR_BINARY" version="1" request_flags="5" innif="true">

The rest of the code is the same.
Thank you very much Domosapiens. Can be the cause of this using OpenZwave?
Is anybody using OpenZwave with Fibaro universal controller with Domoticz?

BR,
Elektrotek
User avatar
Domosapiens
Posts: 232
Joined: Wednesday 20 August 2014 12:08
Target OS: Windows
Domoticz version: V3.5981
Location: NL
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Domosapiens »

Elektrotek
Mine:
name="COMMAND_CLASS_SENSOR_BINARY" version="1" request_flags="5" innif="true">
I don't know what innif means but I think it's not relevant for your temp problem.
"COMMAND_CLASS_SENSOR_BINARY" is related to IN1 and IN2

The relevant part for temperature is:
<CommandClass id="49" name="COMMAND_CLASS_SENSOR_MULTILEVEL" version="1">
here you need to see 1, 2, 3 or 4 sensor items
Is anybody using OpenZwave with Fibaro universal controller with Domoticz?
Postby Domosapiens » Mon Jul 27, 2015 8:13 pm
I have 4 of them working with Domoticz like a charm, for almost 1 year (?) now.
Domoticz is using OpenZwave.

In the meantime I share your disappointment, I discovered also a problem.
I have 4 of them working for a long time.
Two are under installation (DIN rail housing), so no result yet.
Number 5 works in the mean time correctly.
Number 6 has problems. No temperature sensors are detected. IN1 and IN2 are working correctly.
Exclude/Include gives a new Z-wave ID but no temp sensors.
Hard reset (Exclude, power off, button pushed, power on, pushed for 10 seconds, power off, release button, power on, Include) does not help for temp sensor detection.
No "COMMAND_CLASS_SENSOR_MULTILEVEL" in the zwcfg_0xnnnnn.xml.

Number 5 left, number 6 right:
20151002_122609_small.jpg
20151002_122609_small.jpg (230.8 KiB) Viewed 3216 times
Unit number 5 and it's temperature sensors, in the housing of 6 works correctly:
20151002_122917_small.jpg
20151002_122917_small.jpg (243.96 KiB) Viewed 3216 times
That means:
- The infrastructure of 6 is OK.
- FGBS-001 number 6 is defect OR,
- one or more DS18B20 temp sensors of number 6 are screwing the protocol
I still have to exclude the last one, before I declare the FGBS-001 "Defective on Arrival"

they have always voltage (2,6-3V). Is it normal?
Yes, this is normal (average voltage of the communication protocol)

Hope this helps,
Domosapiens
Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
Elektrotek
Posts: 12
Joined: Sunday 26 July 2015 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Elektrotek »

Thank you for your answers Domosapiens.
I am sorry that you also got problems in your installation.
What I mean is that I have only tried my two FUSensor with OpenZwave, both with a SIGMA dongle and the Razberry.
</CommandClass>
<CommandClass id="49" name="COMMAND_CLASS_SENSOR_MULTILEVEL" version="1">
<Instance index="1" endpoint="3" />
<Value type="decimal" genre="user" instance="1" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="164.00" />
</CommandClass>
This is my segment in regards to temperature. It just shows what can be seen right on the domoticz interface "164-172"c :lol:
I think I am just cursed with technology.
Thanks mate.
User avatar
Domosapiens
Posts: 232
Joined: Wednesday 20 August 2014 12:08
Target OS: Windows
Domoticz version: V3.5981
Location: NL
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Domosapiens »

Elektrotek

My problem is solved.
1 of the 4 DS18B20 sensors had a problem.
For 1 sensor there was zero Ohm between TP and TD, I think that caused a data fetch problem for all 4 sensors.
(all 3 combinations of GND, TP, TD measure infinite on my other sensors on a 200 Ohm scale)
Removal of the faulty DS18B20 did the job .... after a hard reset.
I executed the hard reset in this way:
Exclude from the dongle; power Off; push button; power On while button is pushed for 10 seconds; release button; power Off; Power on; wait a while; Include.

Elektrotek: did you executed that procedure carefully?

In the log of Domoticz, during Z-Wave start, I see that the old NodeID is removed and a new one appears.
Do you see the same?

Domoticz was not able to recognize the temp sensors within the "Allow new hardware for 5 minutes".
So I switched polling temporary On for the FGBS-001 and gave an additional "Allow new hardware for 5 minutes" and then the 3 temp sensors where there.

Your

Code: Select all

</CommandClass>
<CommandClass id="49" name="COMMAND_CLASS_SENSOR_MULTILEVEL" version="1">
<Instance index="1" endpoint="3" />
<Value type="decimal" genre="user" instance="1" index="1" label="Temperature" units="C" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="164.00" />
</CommandClass>
looks correct (you have polling off).
The temp value in the zwcfg_0xnnnnn.xml is afaik the last measured value before Domoticz switches off (a kind of data storage) and not the actual value.
It could be the data of the last inclusion.
Is the time/date of the Temp sensor in Domoticz close to the actual time?

An other option is to remove the whole section of the FGBS-001in zwcfg_0xnnnnn.xml.
The procedure for that is: disable your Z-stick, remove the section in zwcfg_0xnnnnn.xml, save zwcfg_0xnnnnn.xml, "Allow new hardware for 5 minutes" , enable your Z-stick.

Keep on trying !
Domosapiens
Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
Totof
Posts: 3
Joined: Wednesday 18 November 2015 21:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: France
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Totof »

Hello,

I've the same issue. The sensor give me a crazy value (between 160 and 180 degree!). I've tried others sensors but all have the same behaviour.
How do you solve this problem ?

Thx,
Totof.
cul8r
Posts: 14
Joined: Tuesday 05 January 2016 23:03
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by cul8r »

Hi,

Have same problem, my sensor is giving 160-200 degree readings. (Raspberry Pi 2 / Razberry / Domoticz / openZwave / FGBS-001)

Have an idea that it could be resolution setting, 9 bit to expected 12 because reading divided by 8 would give me almost correct values.

Tested sensor by making a simple connection to GPIO9 and 1-wire support in Razbian give me correct results: see attachment

Found a suggestion on how to change resolution in this post:
https://www.raspberrypi.org/forums/view ... 37&t=77611
Tested on GPIO10 but I cannot get it to work, no response from sensor after Start-conversion-request.

Any suggestion on how to change resolution? or maybe just go out and by a new sensor :)
Attachments
1-wire reading
1-wire reading
Screenshot 2016-01-07 21.10.33.png (30.94 KiB) Viewed 3074 times
cul8r
Posts: 14
Joined: Tuesday 05 January 2016 23:03
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by cul8r »

I will answer myself on the temperature question:

The logs from OpenZWave show that FGBS-001 was reporting temperature and always with last byte = 0:
... Node013, Received: 0x01, 0x12, 0x00, 0x04, 0x00, 0x0d, 0x0c, 0x60, 0x0d, 0x03, 0x01, 0x31, 0x05, 0x01, 0x44, 0x00, 0x00, 0x55, 0xf0, 0x72
otherwise the hex values correspond to correct temp with resolution 9 bits (0,5 degree resolution) Tested with kernel GPIO 1-wire and readings where ok. (see previous post) Still Domoticz is showing wrong values and this happens when DS18B20 is not set to 12 bits resolution.

This is what I did to fix the problem:
My sensor, brand new from a well known store here in Sweden, was showing 160-200 degrees for room temperature 20-25 degrees C:
Image
For a while I was thinking to make a Dummy Temp. sensor and a LUA script that divided the result by 8 and updated the Dummy sensor!

Made an DS9097E interface, dusted off an old XP, installed my old 1-wire program from 2004 (Tsa-Lämpömittari):
Image

and changed resolution to 12 bits, now it is showing result with decimals:
Image

Now installed sensor back in the FGBS-001 and now the values in Domoticz/OpenZWave correct!
Image
Totof
Posts: 3
Joined: Wednesday 18 November 2015 21:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: France
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Totof »

Thank you cul8r for your investigation !

I have no luck ! I've buyed 5 sensors who are setted to 9 bits resolution by default ...
It will be nice if Domoticz could read correctly all sensors type.
cul8r
Posts: 14
Joined: Tuesday 05 January 2016 23:03
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by cul8r »

And also if Fibaro could make a change in the Config options so one could define the resolution of the temp. sensors, that would be even better!

I am leaving the FGBS-001 as a 1-wire interface, will use kernel support (w1-gpio/w1-therm modules) and with my own script to update User Variables from the temp. sensors.

I have decided to use User Variables instead of dummy temp. sensors, in this way I do not need to change the script with information of any change in Domoticz. I am not god enough to write all in python (to be able to handle decimal) so it is done in 2 scripts. It handles only DS18B20 sensors, but could easily be change to also look for other types of sensors (the prefix “28-“ says that it is a DS18B20 sensor)

To do is to check and avoid updates if values are not changed and some more error checking.

This is how to use it:
Install and make a 1-wire interface (http://www.raspberrypi-spy.co.uk/2013/0 ... er-sensor/)

Make a note of your sensors serial numbers, for ex.: 28-xxxxxxxxxxxx

For any sensor that you want the script to update, make a User Variable type Float with name = sensor serial number. For all other sensors that do not have a matching User Variable are ignored.

Place the python script in /home/pi/get-ds1820.py and make it executable:
(Can be used from command line like this: “./get-ds1820.py 28-0215618024ff”)

Code: Select all

#!/usr/bin/python
#
# get-temp.py
# Read 1-wire temperature sensor
# Expect to have Sensor number as argument, return temp in degree C one decimal or
# on CRC error or missing sensor, returns "999".
# CF 160114
# Install 1-wire:
#http://www.raspberrypi-spy.co.uk/2013/03/raspberry-pi-1-wire-digital-thermometer-sensor/
#--------------------------------------
import sys

def gettemp(id):
    try:
        mytemp = ''
        filename = 'w1_slave'
        f = open('/sys/bus/w1/devices/' + id + '/' + filename, 'r')
        line = f.readline() # read 1st line
        crc = line.rsplit(' ',1)
        crc = crc[1].replace('\n', '')
        if crc=='YES':
            line = f.readline() # read 2nd line
            mytemp = line.rsplit('t=',1)
        
        else:
            mytemp = 199999
        f.close()
        
        return int(mytemp[1])
    
    except:
        return 199999



if __name__ == '__main__':
    # Direct call of script
    # print 'Argumenst= ',len(sys.argv),'first arg.is',sys.argv[1],' length',len(sys.argv[1]),'-'
    if (len(sys.argv) > 1) and ("28-" in sys.argv[1]) and (len(sys.argv[1]) == 15):
        #        id = sys.argv[1]
        #TEMP = '{:.1f}'.format(gettemp(id)/float(1000))
        TEMP = gettemp(sys.argv[1])
        if (TEMP == 199999):
            print 999
        else:
            TEMP = '{:.1f}'.format(TEMP/float(1000))
            print TEMP
    else:
        # print 'Missing or wrong argument of',len(sys.argv), ' arguments'
        print 999
Place the bash script in /home/pi/update-temp-var.sh, edit and change to your Domoticz server IP number and make in make it executable:
(Every time it runs it will update all User Variables with names that matches a sensor serial number and also write info into Domoticz log)

Code: Select all

#!/bin/bash
# Script dependent on get-ds1820.py to get Temp valueas and format it to Float and one decimal
# First install 1-wire DS18B20 sensor with kenerl support and w1-gpio/w1-therm
# For any sensor you want to use: add a User Variable in Domoticz with same name that the sensor
# unique number: example 28-0215618024ff, and of type Float
# This script will fetch all User varianles and for all that start with "28-" (wich are DS-18b20 sensor)
# it will get the temperature and update the user variable.
# Carlos F 20160116
#
# Use "crontab -e" to run this script every xx minits. Example: */10 * * * * /home/pi/update-temp-var.sh
#Change to your IP number.

# Domoticz server
SERVER="'':''@192.168.0.5:8080"
#SERVER="'':''@127.0.0.1:8080"

# Make arrays with User-variables: names, type and index. Only for names that start with "28-" e.g. DS18B20 sensors
declare -a namearray
declare -a typearray
declare -a idxarray
# Get a sting with all Users variables
UserVars=`curl -s  -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command&param=getuservariables"`
# debug! echo $UserVars
# Strip of LF character:
UserVars=$(echo  "$UserVars" | tr '\n' ";")
# Make and array using separator " e.g. separate text strings
IFS='"' read -a XXarray <<< "$UserVars"
# Get length of array
arraylength=${#XXarray[@]}
# use for loop to read all names types and indexes
ii=0
for (( i=1; i<${arraylength}+1; i++ ));
do
    if [ "${XXarray[$i-1]}" == "Name" ]
    then
        if [[ ${XXarray[$i+1]} == "28-"* ]]
        # if varaible name start with "28-" then save name/type/index in array
        then
            ii=${#namearray[@]}
            namearray[$ii]="${XXarray[$i+1]}"
            typearray[$ii]="${XXarray[$i+5]}"
            idxarray[$ii]="${XXarray[$i+13]}"
        fi
    fi
done

# Get nuber of sensors tp update
arraylength=${#namearray[@]}
##echo $arraylength
# use for loop to read Temp and update User Variable
for (( i=0; i<${arraylength}; i++ ));
do
    UV_name=${namearray[$i]}
    UV_type=1  #Force type to Float! Otherwise variable type is in typearray[$i]
    UV_idx=${idxarray[$i]}
    UV_value=`python /home/pi/get-ds1820.py  $UV_name`
    # test if correct temp, py script gives 999 on error
    if [ "999" != $UV_value ]; then
    echo "Sensor "$UV_name": Temp= "$UV_value" C "
        # Send data, update User variables:
        curl -s -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command&param=updateuservariable&idx=$UV_idx&vname=$UV_name&vtype=$UV_type&vvalue=$UV_value"
        curl -s -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command&param=addlogmessage&message=Temp-script:%20Updated%20User%20Variable%20$UV_name"
    else
        curl -s -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command&param=addlogmessage&message=Temp-script:%20Error%20reading%20sensor%20for%20variable%20$UV_name"
        echo "Error reading sensor "$file
    fi

done
and make it run at desired intervals with cron.
(With command “crontab –e” insert this line to run every 10 minutes: */10 * * * * /home/pi/update-temp-var.sh)

Please make backup of database before installation, I have only tested for 1 day!

/Carlos
Attachments
script-ds18b20.zip
(3.05 KiB) Downloaded 53 times
cul8r
Posts: 14
Joined: Tuesday 05 January 2016 23:03
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by cul8r »

Totof:
There is a way to change resolution from a Raspberry Pi! I have tested and it is working.

Found a program Raspberry forum, courtesy of Daniel Perron, modified to work on Pi2 and now I can change resolution on sensor.
Found it here: https://www.raspberrypi.org/forums/view ... 37&t=77611

Install GPIO 1-wire per this instructions: http://www.raspberrypi-spy.co.uk/2013/0 ... rettyPhoto
Connect only one DS18B20 to 1-wire and check installation.

Change this code to desired GPIO pin (I use GPIO 11) and also BCM2708_PERI_BASE depending is you have Pi2 or PiB

Code: Select all

    // modified version to read DS18B20 in bit banging
    //
    //  24 May 2014
    //  Daniel Perron
    //
    // Use At your own risk
    // Modified for Pi2 /CF 160116



    //
    //  How to access GPIO registers from C-code on the Raspberry-Pi
    //  Example program
    //  15-January-2012
    //  Dom and Gert
    //  Revised: 15-Feb-2013
    //  Compile: gcc -o configDS18B20 configDS18B20.c

    // Access from ARM Running Linux

    // Raspberry B/B+
    // #define BCM2708_PERI_BASE        0x20000000
    // Raspberry Pi2
    #define BCM2708_PERI_BASE        0x3F000000

    #define GPIO_BASE                (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */

    // Change pin according to your hardware conf:
    // #define  DS_PIN  4
    #define  DS_PIN  11

    #include <stdio.h>
    #include <stdlib.h>
    #include <fcntl.h>
    #include <sys/mman.h>
    #include <unistd.h>
    #include <time.h>

    #define PAGE_SIZE (4*1024)
    #define BLOCK_SIZE (4*1024)

    int  mem_fd;
    void *gpio_map;

    // I/O access
    volatile unsigned *gpio;


    // GPIO setup macros. Always use INP_GPIO(x) before using OUT_GPIO(x) or SET_GPIO_ALT(x,y)
    #define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
    #define OUT_GPIO(g) *(gpio+((g)/10)) |=  (1<<(((g)%10)*3))
    #define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3))

    #define GPIO_SET *(gpio+7)  // sets   bits which are 1 ignores bits which are 0
    #define GPIO_CLR *(gpio+10) // clears bits which are 1 ignores bits which are 0

    #define GPIO_READ(g)  (*(gpio + 13) &= (1<<(g)))


    #define DS18B20_SKIP_ROM           0xCC
    #define DS18B20_CONVERT_T          0x44
    #define DS18B20_READ_SCRATCHPAD    0xBE
    #define DS18B20_WRITE_SCRATCHPAD   0x4E
    #define DS18B20_COPY_SCRATCHPAD    0x48

    unsigned char ScratchPad[9];
    double  temperature;
    int   resolution;

    void setup_io();


    //    #define  DS_PIN  11


    int  DoReset(void)
    {
     int loop;

       INP_GPIO(DS_PIN);


       usleep(1000);

       INP_GPIO(DS_PIN);
       OUT_GPIO(DS_PIN);
       
       // pin low for 480 us
       GPIO_CLR=1<<DS_PIN;
       usleep(480);
       INP_GPIO(DS_PIN);
       usleep(60);
       if(GPIO_READ(DS_PIN)==0)
       {
         usleep(380);
         return 1;
       }
     
      return 0;
    }

    #define DELAY1US  smalldelay();

    void  smalldelay(void)
    {
      int loop2;
       for(loop2=0;loop2<100;loop2++);
    }



    void WriteByte(unsigned char value)
    {
      unsigned char Mask=1;
      int loop;

       for(loop=0;loop<8;loop++)
         {
           INP_GPIO(DS_PIN);
           OUT_GPIO(DS_PIN);
           GPIO_CLR= 1 <<DS_PIN;

           if((value & Mask)!=0)
            {
               DELAY1US
                INP_GPIO(DS_PIN);
               usleep(60);

            }
            else
            {
               usleep(60);
               INP_GPIO(DS_PIN);
               usleep(1);
            }
          Mask*=2;
          usleep(60);
        }


       usleep(100);
    }


    unsigned char ReadBit(void)
    {
       INP_GPIO(DS_PIN);
       OUT_GPIO(DS_PIN);
       // PIN LOW
       GPIO_CLR= 1 << DS_PIN;
       DELAY1US
       // set INPUT
       INP_GPIO(DS_PIN);
       DELAY1US
       DELAY1US
       DELAY1US
       if(GPIO_READ(DS_PIN)!=0)
         return 1;
       return 0;
    }

    unsigned char ReadByte(void)
    {

       unsigned char Mask=1;
       int loop;
       unsigned  char data=0;

      int loop2;


       for(loop=0;loop<8;loop++)
         {
           //  set output
           INP_GPIO(DS_PIN);
           OUT_GPIO(DS_PIN);
           //  PIN LOW
           GPIO_CLR= 1<<DS_PIN;
           DELAY1US
           //  set input
           INP_GPIO(DS_PIN);
           // Wait  2 us
           DELAY1US
           DELAY1US
           DELAY1US
           if(GPIO_READ(DS_PIN)!=0)
           data |= Mask;
           Mask*=2;
           usleep(60);
          }

        return data;
    }



    int ReadScratchPad(void)
    {
       int loop;

        if(DoReset())
         {
           WriteByte(DS18B20_SKIP_ROM);
           WriteByte(DS18B20_READ_SCRATCHPAD);
           for(loop=0;loop<9;loop++)
             {
              ScratchPad[loop]=ReadByte();
            }
        return 1;
      }
      return 0;
    }

    unsigned char  CalcCRC(unsigned char * data, unsigned char  byteSize)
    {
       unsigned char  shift_register = 0;
       unsigned char  loop,loop2;
       char  DataByte;

       for(loop = 0; loop < byteSize; loop++)
       {
          DataByte = *(data + loop);
          for(loop2 = 0; loop2 < 8; loop2++)
          {
             if((shift_register ^ DataByte)& 1)
             {
                shift_register = shift_register >> 1;
                shift_register ^=  0x8C;
             }
             else
                shift_register = shift_register >> 1;
             DataByte = DataByte >> 1;
          }
       }
       return shift_register;
    }

    int ReadSensor(void)
    {
      int maxloop;
      int RetryCount;
      int loop;
      unsigned char  CRCByte;
      union {
       short SHORT;
       unsigned char CHAR[2];
      }IntTemp;


      time_t t = time(NULL);
      struct tm tm = *localtime(&t);

      temperature=-9999.9;

      for(RetryCount=0;RetryCount<3;RetryCount++)
      {

      if(!DoReset()) continue;

      // start a conversion
      WriteByte(DS18B20_SKIP_ROM);
      WriteByte(DS18B20_CONVERT_T);


      maxloop=0;
      // wait until ready
       while(!ReadBit())
       {
        putchar('.');
         maxloop++;
        if(maxloop>100000) break;
       }

      if(maxloop>100000) continue;


      if(!ReadScratchPad()) continue;

         for(loop=0;loop<9;loop++)
           printf("%02X ",ScratchPad[loop]);
         printf("\n");fflush(stdout);

      // OK Check sum Check;
      CRCByte= CalcCRC(ScratchPad,8);

      if(CRCByte!=ScratchPad[8]) continue;

      //Check Resolution
       resolution=0;
       switch(ScratchPad[4])
       {

         case  0x1f: resolution=9;break;
         case  0x3f: resolution=10;break;
         case  0x5f: resolution=11;break;
         case  0x7f: resolution=12;break;
       }

       if(resolution==0) continue;
        // Read Temperature

        IntTemp.CHAR[0]=ScratchPad[0];
        IntTemp.CHAR[1]=ScratchPad[1];


        temperature =  0.0625 * (double) IntTemp.SHORT;
         
          printf("%02d bits  Temperature: %6.2f +/- %f Celsius\n", resolution ,temperature, 0.0625 * (double)  (1<<(12 - resolution)));

        return 1;
       }
      return 0;
    }




    void WriteScratchPad(unsigned char TH, unsigned char TL, unsigned char config)
    {
    int loop;

        // First reset device

        DoReset();

        usleep(1000);
        // Skip ROM command
         WriteByte(DS18B20_SKIP_ROM);


         // Write Scratch pad

        WriteByte(DS18B20_WRITE_SCRATCHPAD);

        // Write TH

        WriteByte(TH);

        // Write TL

        WriteByte(TL);

        // Write config

        WriteByte(config);
    }

    void  CopyScratchPad(void)
    {

       // Reset device
        DoReset();
        usleep(1000);

       // Skip ROM Command

        WriteByte(DS18B20_SKIP_ROM);

       //  copy scratch pad

        WriteByte(DS18B20_COPY_SCRATCHPAD);
        usleep(100000);
    }


    int main(int argc, char **argv)
    {
      int loop;
      int config;
      // Set up gpi pointer for direct register access
      setup_io();
      if(ReadSensor())
        {
         printf("DS18B20 Resolution (9,10,11 or 12) ?");fflush(stdout);

        config=0;
        if(scanf("%d",&resolution)==1)
          {
            switch(resolution)
             {
               case 9:  config=0x1f;break;
               case 10: config=0x3f;break;
               case 11: config=0x5f;break;
               case 12: config=0x7f;break;
             }
          }

        if(config==0)
             printf("Invalid Value! Nothing done.\n");
        else
        {
          printf("Try to set %d bits  config=%2X\n",resolution,config);
          usleep(1000);
          WriteScratchPad(ScratchPad[2],ScratchPad[3],config);
          usleep(1000);
          CopyScratchPad();
        }
      }

      return 0;

    } // main


    //
    // Set up a memory regions to access GPIO
    //
    void setup_io()
    {
       /* open /dev/mem */
       if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) {
          printf("can't open /dev/mem \n");
          exit(-1);
       }

       /* mmap GPIO */
       gpio_map = mmap(
          NULL,             //Any adddress in our space will do
          BLOCK_SIZE,       //Map length
          PROT_READ|PROT_WRITE,// Enable reading & writting to mapped memory
          MAP_SHARED,       //Shared with other processes
          mem_fd,           //File to map
          GPIO_BASE         //Offset to GPIO peripheral
       );

       close(mem_fd); //No need to keep mem_fd open after mmap

       if (gpio_map == MAP_FAILED) {
          printf("mmap error %d\n", (int)gpio_map);//errno also set!
          exit(-1);
       }

       // Always use volatile pointer!
       gpio = (volatile unsigned *)gpio_map;


    } // setup_io

Compile with
gcc -o configDS18B20 configDS18B20.c
and run it with
sudo ./configDS18B20

and you can change resolution!

/Carlos
Totof
Posts: 3
Joined: Wednesday 18 November 2015 21:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: France
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no out

Post by Totof »

It sounds great Carlos !!

Now I've to find my electronic tool box and if I've all needed resistors to connect the sensor to the Raspberry Pi. :D

Thank you very much.
marcoblacks
Posts: 3
Joined: Thursday 12 May 2016 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Fibaro Universal Binary sensor wrong temperature, no outputs

Post by marcoblacks »

Hi guys!
My problem with universal binary sensor and 3 DS18B20 is the teperature values:
They are all about 5-8 degrees hiyer then real ones!!!!!
Seems incredible.. so in my case the temp. 'Range' is correct (resolution is ok) but detect an offset of some degrees!!
Could be a power source problem (ripple)? I am using a 12v 500mA power supply....
I conneced temp. sensor with an audio cable (2 wire +ground wire and shielding)...
All inclusion and exclusion goes like a charm.....
I also tried to reset the UBS but nothing changed.
Help me!!!!!
Marco
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest