Hi. Need help. Uses Domotics 4.9700 on rpi
I am in need of several 1 wire buses (several big but independent star buses). I have solved it with Device tree so now I have 4 buses on 4 different gpio pins. They are labeled w1_bus_master(1-4)
So everything is fine, except that only one is identified by domoticz. How can I solve this?
Have been searching without finding anything.
/KG
1-wire reading from several 1-wire buses Topic is solved
Moderators: fantom, leecollings
-
- Posts: 10
- Joined: Sunday 25 January 2015 16:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
-
- Posts: 10
- Joined: Sunday 25 January 2015 16:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: 1-wire reading from several 1-wire buses
What I have found so far is
The source file 1WireByKernell.cpp needs to be edited.
This part
Now it looks only in w1_bus_master1
It needs to look in all bus_master, or in a other file allredy making a list of all availeble 1wire devices.
Found a sample code for this. https://www.raspberrypi.org/forums/view ... p?t=107894
But dont know how to get them together and runing... Anyone?
The source file 1WireByKernell.cpp needs to be edited.
This part
Code: Select all
bool C1WireByKernel::IsAvailable()
{
//Check if system have the w1-gpio interface
std::ifstream infile1wire;
std::string wire1catfile=Wire1_Base_Dir;
wire1catfile+="/w1_bus_master1/w1_master_slaves";
infile1wire.open(wire1catfile.c_str());
if (infile1wire.is_open())
{
infile1wire.close();
return true;
}
return false;
}
It needs to look in all bus_master, or in a other file allredy making a list of all availeble 1wire devices.
Found a sample code for this. https://www.raspberrypi.org/forums/view ... p?t=107894
But dont know how to get them together and runing... Anyone?
Code: Select all
void C1WireByKernel::ThreadBuildDevicesList()
{
std::string catdir=Wire1_Base_Dir;
std::string catfile1=catdir+"/w1_bus_master1/w1_master_slaves";
std::string catfile2=catdir+"/w1_bus_master2/w1_master_slaves";
std::string catfile3=catdir+"/w1_bus_master3/w1_master_slaves";
std::string catfile4=catdir+"/w1_bus_master4/w1_master_slaves";
std::ifstream infile;
std::ofstream fileOut("/home/pi/domoticz/Tempgivare.txt", std::ofstream::out);
std::string sLine;
for (DeviceCollection::iterator it=m_Devices.begin();it!=m_Devices.end();++it) {delete (*it).second;}
m_Devices.clear();
infile.open(catfile1.c_str());
if (!infile.is_open())
return;
while (!infile.eof())
{
getline(infile, sLine);
if (sLine.size()!=0)
{
fileOut <<(sLine)+"\n";
}
}
sLine="";
infile.close();
for (DeviceCollection::iterator it=m_Devices.begin();it!=m_Devices.end();++it) {delete (*it).second;}
m_Devices.clear();
infile.open(catfile2.c_str());
if (!infile.is_open())
return;
while (!infile.eof())
{
getline(infile, sLine);
if (sLine.size()!=0)
{
fileOut <<(sLine)+"\n";
}
}
infile.close();
for (DeviceCollection::iterator it=m_Devices.begin();it!=m_Devices.end();++it) {delete (*it).second;}
m_Devices.clear();
infile.open(catfile3.c_str());
if (!infile.is_open())
return;
while (!infile.eof())
{
getline(infile, sLine);
if (sLine.size()!=0)
{
fileOut <<(sLine)+"\n";
}
}
infile.close();
for (DeviceCollection::iterator it=m_Devices.begin();it!=m_Devices.end();++it) {delete (*it).second;}
m_Devices.clear();
infile.open(catfile4.c_str());
if (!infile.is_open())
return;
while (!infile.eof())
{
getline(infile, sLine);
if (sLine.size()!=0)
{
fileOut <<(sLine)+"\n";
}
}
fileOut.close();
infile.close();
std::string catfile="/home/pi/domoticz/Tempgivare.txt";
for (DeviceCollection::iterator it=m_Devices.begin();it!=m_Devices.end();++it) {delete (*it).second;}
m_Devices.clear();
infile.open(catfile.c_str());
if (!infile.is_open())
return;
Locker l(m_Mutex);
while (!infile.eof())
{
getline(infile, sLine);
if (sLine.size()!=0)
{
// Get the device from it's name
_t1WireDevice device;
GetDevice(sLine, device);
switch (device.family)
{
case high_precision_digital_thermometer:
case dual_channel_addressable_switch:
case _8_channel_addressable_switch:
case programmable_resolution_digital_thermometer:
m_Devices[device.devid]=new DeviceState(device);
_log.Log(LOG_STATUS,"1Wire: Added Device: %s",sLine.c_str());
break;
default: // Device not supported in kernel mode (maybe later...), use OWFS solution.
_log.Log(LOG_ERROR,"1Wire: Device not yet supported in Kernel mode (Please report!) ID:%s, family: %02X",sLine.c_str(),device.family);
break;
}
}
}
infile.close();
}
-
- Posts: 1
- Joined: Saturday 27 July 2019 0:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: 1-wire reading from several 1-wire buses
Hi eriksson25,
Did you ever get this working?
Tonight I changed my setup from a single bus (because I have been experiencing issues) to multi.
I've added:
to the /boot/config.txt and I can see the devices on the OS:
but domoticz is only seeing 1
Which according to dmesg is on w1_bus_master1
Looks exactly like the issue you were having.
Thanks,
Did you ever get this working?
Tonight I changed my setup from a single bus (because I have been experiencing issues) to multi.
I've added:
Code: Select all
dtoverlay=w1-gpio,gpiopin=4
dtoverlay=w1-gpio,gpiopin=17
dtoverlay=w1-gpio,gpiopin=18
dtoverlay=w1-gpio,gpiopin=22
dtoverlay=w1-gpio,gpiopin=23
dtoverlay=w1-gpio,gpiopin=24
dtoverlay=w1-gpio,gpiopin=27
Code: Select all
ls /sys/bus/w1/devices/
28-000003840085 28-031561c83bff 28-051686668cff 28-0516a50d12ff w1_bus_master1 w1_bus_master3 w1_bus_master5 w1_bus_master7
28-031561c707ff 28-0416a4de5bff 28-0516866992ff 28-0516a50e14ff w1_bus_master2 w1_bus_master4 w1_bus_master6

Code: Select all
2019-07-26 23:37:50.048 Status: 1Wire: Added Device: 28-0516a50e14ff
Code: Select all
[ 4.018533] w1_master_driver w1_bus_master1: Attaching one wire slave 28.0516a50e14ff crc 84
[ 4.028293] w1_master_driver w1_bus_master2: Attaching one wire slave 28.031561c707ff crc 59
[ 4.075918] w1_master_driver w1_bus_master6: Attaching one wire slave 28.0416a4de5bff crc f6
[ 4.078346] w1_master_driver w1_bus_master5: Attaching one wire slave 28.051686668cff crc f1
[ 4.132277] w1_master_driver w1_bus_master7: Attaching one wire slave 28.031561c83bff crc 66
[ 4.217473] w1_master_driver w1_bus_master3: Attaching one wire slave 28.000003840085 crc 2c
[ 4.312789] w1_master_driver w1_bus_master5: Attaching one wire slave 28.0516a50d12ff crc 90
[ 4.444676] w1_master_driver w1_bus_master5: Attaching one wire slave 28.0516866992ff crc b5
Thanks,
-
- Posts: 7
- Joined: Monday 02 April 2018 13:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: 1-wire reading from several 1-wire buses
I had same issue.
Problem has been solved in the domoticz beta.
Problem has been solved in the domoticz beta.
Who is online
Users browsing this forum: No registered users and 1 guest